MonotonicVCDomLem
, StandardVCDomLem
public abstract class VCDomLem extends RuleGenerator
deleteRedundantConditions
, deleteRedundantRules
, deleteNotMinimalRules
,
and checkVCDRSAMeasureValueDuringMinimalityTest
) or using setting methods setModeOfPositiveExamplesForDRSA(int)
and setModeOfPositiveExamplesForVCDRSA(int)
.Modifier and Type | Field | Description |
---|---|---|
static int |
ALL_DIFFERENT_BORDER_POSITIVE_EXAMPLES |
Possible value of
modeOfPositiveExamplesForDRSA and modeOfPositiveExamplesForVCDRSA , indicating that among positive examples
(i.e., belonging to lower/upper approximation of a considered union of decision classes in case of DRSA, or
belonging to lower approximation of a considered union of decision classes in case of VC-DRSA) only different border examples (i.e., belonging to EDGE) should be considered when generating rules' conditions. |
static int |
ALL_DIFFERENT_POSITIVE_EXAMPLES |
Possible value of
modeOfPositiveExamplesForDRSA and modeOfPositiveExamplesForVCDRSA , indicating that all different positive examples
(i.e., belonging to lower/upper approximation of a considered union of decision classes in case of DRSA, or
belonging to lower approximation of a considered union of decision classes in case of VC-DRSA) should be considered when generating rules' conditions. |
static int |
ALL_DIFFERENT_SUFFICIENTLY_CONSISTENT_POSITIVE_EXAMPLES |
Possible value of
modeOfPositiveExamplesForVCDRSA , indicating that among positive examples
(i.e., belonging to VC-lower approximation of a considered union of decision classes) only different sufficiently consistent examples should be considered when generating rules' conditions. |
boolean |
checkVCDRSAMeasureValueDuringMinimalityTest |
Tells if rules' confidence / inconsistency measure value should be taken into account while testing if one rule
(induced for one approximation or boundary) is minimal in context of all rules induced so far
(for all previously considered approximations or boundaries).
|
static int |
CHOOSE_CONDITIONS_FROM_ONE_OBJECT |
Possible value of the
conditionsSelectionMethod parameter, defined for generateRulesForPositiveExamples method. |
static int |
COVER_ANY_NEGATIVE_EXAMPLES |
Possible value of the
negativeExamplesTreatment parameter, defined for generateRules method. |
static int |
COVER_NONE_OF_NEGATIVE_EXAMPLES |
Possible value of the
negativeExamplesTreatment parameter, defined for generateRules method. |
static int |
COVER_ONLY_INCONSISTENT_AND_BOUNDARY_NEGATIVE_EXAMPLES |
Possible value of the
negativeExamplesTreatment parameter, defined for generateRules method. |
static int |
COVER_ONLY_INCONSISTENT_NEGATIVE_EXAMPLES |
Possible value of the
negativeExamplesTreatment parameter, defined for generateRules method. |
static int |
DEFAULT_CONSISTENCY_IN |
Default method of calculating value of used rule consistency measure for certain rules.
|
boolean |
deleteNotMinimalRules |
Tells if any new rule (induced for one approximation or boundary) not minimal in context of all rules induced so far
(for all previously considered approximations or boundaries) may be deleted.
|
boolean |
deleteRedundantConditions |
Tells if conditions redundant in any induced rule may be deleted.
|
boolean |
deleteRedundantRules |
Tells if rules redundant in context of one approximation or boundary may be deleted.
|
static int |
MIX_CONDITIONS_FROM_DIFFERENT_OBJECTS |
Possible value of the
conditionsSelectionMethod parameter, defined for generateRulesForPositiveExamples method. |
Modifier and Type | Method | Description |
---|---|---|
java.util.ArrayList<Rule> |
generateRules() |
Generates decision rules just like
generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int) method,
but uses fields of this object, rather than given parameters. |
java.util.ArrayList<Rule> |
generateRules(ApproximatedEntity[] approximatedEntities,
double[] variableConsistencyParameterValueThresholds,
ApproximatedEntityDecisionsPredictor approximatedEntityDecisionsPredictor,
int type,
int characteristicDecisionClassUsageTip,
ConditionValidator conditionValidator,
MemoryContainer learningMemoryContainer,
int conditionsSelectionMethod,
int negativeExamplesTreatment) |
Generates decision rules of given type (certain, possible or approximate),
for given set (array) of approximated entities (unions of decision classes or single decision classes),
for given variable consistency parameter value thresholds (support for variable consistency approach),
for given characteristic decision class usage tip (which affects type of created conditions and decisions)
and for given learning memory container which may be either decision table, or PCT, or similarity table.
This method can be used to generate all minimal cover rules of given type, for all possible decision classes or for all possible upward / downward unions of decision classes. This method assumes that if given set of approximated entities contains unions of decision classes, these unions are sorted from most specific to less specific. |
java.util.ArrayList<Rule> |
generateRules(ApproximatedEntity[] approximatedEntities,
double variableConsistencyParameterValueThreshold,
ApproximatedEntityDecisionsPredictor approximatedEntityDecisionsPredictor,
int type,
int characteristicDecisionClassUsageTip,
ConditionValidator conditionValidator,
MemoryContainer learningMemoryContainer,
int conditionsSelectionMethod,
int negativeExamplesTreatment) |
Wrapper for
generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int) method. |
java.util.ArrayList<Rule> |
generateRulesForPositiveExamples(int type,
int characteristicDecisionClassUsageTip,
Field characteristicDecisionClass,
ConditionValidator conditionValidator,
java.util.HashSet<Condition> decisions,
MemoryContainer learningMemoryContainer,
int[] numbersOfPositiveExamples,
int[] numbersOfApproximatedEntityExamples,
double variableConsistencyMeasureValueThreshold,
int conditionsSelectionMethod,
java.util.HashSet<java.lang.Integer> numbersOfPermittedNegativeCoveredExamples,
java.util.HashSet<java.lang.Integer> numbersOfNeutralExamples) |
Generates decision rules of given type (certain, possible or approximate),
for given characteristic decision class (basic class of some union of decision classes or single decision class),
for given characteristic decision class usage tip (which tells if given characteristic decision class is
basic class of some upward (
Rule.AT_LEAST ) or downward (Rule.AT_MOST ) union of decision classes
or just single decision class (Rule.EQUAL );
value of this parameter affects also type of created conditions),
for given decisions (which will be set on the right (decision) side of all created and returned rules),
for given learning memory container which may be either decision table, or PCT, or similarity table,
for given array with numbers of positive examples from given learning memory container
(which may come from lower / upper approximation or boundary of some decision class
or from lower / upper approximation of some upward / downward union of decision classes),
for given variable consistency measure value threshold (support for variable consistency approach),
for given method of selection of conditions
and for given hash set with numbers of permitted negative examples (used only for VC-IRSA / VC-DRSA).SIC! |
ApproximatedEntity[] |
getApproximatedEntities() |
Gets array of approximated entities, used by
generateRules() method. |
ApproximatedEntityDecisionsPredictor |
getApproximatedEntityDecisionsPredictor() |
Gets approximated entity decisions' predictor, used by
generateRules() method. |
int |
getCharacteristicDecisionClassUsageTip() |
Gets usage tip for characteristic decision classes of generated rules, used by
generateRules() method. |
int |
getConditionsSelectionMethod() |
Gets method of selection of conditions during induction of single decision rule, used by
generateRules() method. |
ConditionValidator |
getConditionValidator() |
Gets condition validator stored in generated rules, used by
generateRules() method. |
int |
getConsistencyIn() |
Gets method of calculating value of used rule consistency measure for certain rules.
|
MemoryContainer |
getLearningMemoryContainer() |
Gets learning memory container for which all rules are generated, used by
generateRules() method. |
int[] |
getMaxQuantitiesOfRulesForPositiveExamples() |
Gets array of maximal quantities of rules for each approximated entity passed to
generateRules method.SIC! |
int |
getMaxQuantityOfRulesForPositiveExamples() |
Gets maximal quantity of rules for one set of positive examples.
|
double |
getMinRateOfCoveredPositiveExamples() |
Gets minimal rate of covered positive examples for one set of positive examples.
|
double[] |
getMinRatesOfCoveredPositiveExamples() |
Gets array of minimal rates of covered positive examples for each approximated entity passed to
generateRules method.SIC! |
int |
getModeOfPositiveExamplesForDRSA() |
Gets mode of positive examples for DRSA.
|
int |
getModeOfPositiveExamplesForVCDRSA() |
Gets mode of positive examples for VC-DRSA.
|
int |
getNegativeExamplesTreatment() |
Gets method of treatment for negative examples, used by
generateRules() method. |
int |
getOptimizedRuleConsistencyMeasure() |
Gets rule consistency measure optimized in last call to
generateRulesForPositiveExamples(int, int, Field, ConditionValidator, HashSet, MemoryContainer, int[], int[], double, int, HashSet, HashSet)
or any generateRules(...) method.The result can be one of: RuleConstants.UNDEFINED_RULE_CONSISTENCY_MEASURE (initial value), RuleConstants.MU_CONSISTENCY , RuleConstants.EPSILON_CONSISTENCY or RuleConstants.EPSILON_PRIM_CONSISTENCY . |
int |
getType() |
Gets type of generated rules, used by
generateRules() method. |
double[] |
getVariableConsistencyParameterValueThresholds() |
Gets subsequent variable consistency parameter value thresholds for subsequent approximated entities, used by
generateRules() method. |
void |
setApproximatedEntities(ApproximatedEntity[] approximatedEntities) |
Sets array of approximated entities, used by
generateRules() method. |
void |
setApproximatedEntityDecisionsPredictor(ApproximatedEntityDecisionsPredictor approximatedEntityDecisionsPredictor) |
Sets approximated entity decisions' predictor, used by
generateRules() method. |
void |
setCharacteristicDecisionClassUsageTip(int characteristicDecisionClassUsageTip) |
Sets usage tip for characteristic decision classes of generated rules, used by
generateRules() method. |
void |
setConditionsSelectionMethod(int conditionsSelectionMethod) |
Sets method of selection of conditions during induction of single decision rule, used by
generateRules() method. |
void |
setConditionValidator(ConditionValidator conditionValidator) |
Sets condition validator stored in generated rules, used by
generateRules() method. |
void |
setConsistencyIn(int consistencyIn) |
Sets method of calculating value of used rule consistency measure for certain rules.
|
abstract void |
setDefaultModeOfPositiveExamplesForVCDRSA() |
Sets default mode of positive examples for VC-DRSA.
|
void |
setLearningMemoryContainer(MemoryContainer learningMemoryContainer) |
Sets learning memory container for which all rules are generated, used by
generateRules() method. |
void |
setMaxQuantitiesOfRulesForPositiveExamples(int[] maxQuantitiesOfRulesForPositiveExamples) |
Sets array of maximal quantities of rules for each approximated entity passed to
generateRules method. |
void |
setMaxQuantityOfRulesForPositiveExamples(int maxQuantityOfRulesForPositiveExamples) |
Sets maximal quantity of rules for one set of positive examples.
|
void |
setMinRateOfCoveredPositiveExamples(double minRateOfCoveredPositiveExamples) |
Sets minimal rate of covered positive examples for one set of positive examples.
|
void |
setMinRatesOfCoveredPositiveExamples(double[] minRatesOfCoveredPositiveExamples) |
Sets array of minimal rates of covered positive examples for each approximated entity passed to
generateRules method. |
void |
setModeOfPositiveExamplesForDRSA(int modeOfPositiveExamplesForDRSA) |
Sets mode of positive examples for DRSA.
|
abstract void |
setModeOfPositiveExamplesForVCDRSA(int modeOfPositiveExamplesForVCDRSA) |
Sets mode of positive examples for VC-DRSA.
|
void |
setNegativeExamplesTreatment(int negativeExamplesTreatment) |
Sets method of treatment for negative examples, used by
generateRules() method. |
void |
setType(int type) |
Sets type of generated rules, used by
generateRules() method. |
void |
setVariableConsistencyParameterValueThresholds(double[] variableConsistencyParameterValueThresholds) |
Sets variable consistency parameter value thresholds for subsequent approximated entities, used by
generateRules() method. |
public static final int CHOOSE_CONDITIONS_FROM_ONE_OBJECT
conditionsSelectionMethod
parameter, defined for generateRulesForPositiveExamples
method.
This value is used when all conditions for each generated rule should be taken from one positive example (object-based rules).public static final int MIX_CONDITIONS_FROM_DIFFERENT_OBJECTS
conditionsSelectionMethod
parameter, defined for generateRulesForPositiveExamples
method.
This value is used when mix of conditions created on the basis of different positive examples is allowed.public static final int COVER_NONE_OF_NEGATIVE_EXAMPLES
negativeExamplesTreatment
parameter, defined for generateRules
method.
This value is used only in case of IRSA or DRSA. It means that induced rules must cover only positive examples.public static final int COVER_ONLY_INCONSISTENT_NEGATIVE_EXAMPLES
negativeExamplesTreatment
parameter, defined for generateRules
method.
This value is used only in case of VC-IRSA or VC-DRSA, when inducing certain decision rules.
It means that any induced rule, having acceptable quality (e.g. confidence or inconsistency measure value),
apart from positive examples may also cover only those negative examples, which are inconsistent with examples from lower approximation.
For example in case of upward union of decision classes, inconsistent examples are those, which dominate
examples from lower approximation but do not belong to the considered union.
In case of single decision class, inconsistent examples are those, which are indiscernible with positive
examples from lower approximation but do not belong to the considered decision class.public static final int COVER_ONLY_INCONSISTENT_AND_BOUNDARY_NEGATIVE_EXAMPLES
negativeExamplesTreatment
parameter, defined for generateRules
method.
This value is used only in case of VC-IRSA or VC-DRSA, when inducing certain decision rules.
It means that any induced rule, having acceptable quality (e.g. confidence or inconsistency measure value),
may not cover any example belonging to negative (NEG) region of given union (decision class). Induction of a decision rule is finished when
that rule has sufficient quality and covers positive examples and possibly negative examples being
inconsistent with (among) examples from extended lower approximation or negative examples belonging to
boundary (BND) region of considered entity (union or decision class).public static final int COVER_ANY_NEGATIVE_EXAMPLES
negativeExamplesTreatment
parameter, defined for generateRules
method.
This value is used only in case of VC-IRSA or VC-DRSA, when inducing certain decision rules.
It means that any induced rule, having acceptable quality (e.g. confidence or inconsistency measure value),
apart from positive examples may also cover any negative examples, not only those which are inconsistent with (among) examples from lower approximation.
For example in case of upward union of decision classes, inconsistent examples are those,
which dominate examples from lower approximation but do not belong to the considered union.
In case of single decision class, inconsistent examples are those, which are indiscernible with positive
examples from lower approximation but do not belong to the considered decision class.public static int DEFAULT_CONSISTENCY_IN
RuleConstants.CONSISTENCY_IN_SET
.public static final int ALL_DIFFERENT_POSITIVE_EXAMPLES
modeOfPositiveExamplesForDRSA
and modeOfPositiveExamplesForVCDRSA
, indicating that all different positive examples
(i.e., belonging to lower/upper approximation of a considered union of decision classes in case of DRSA, or
belonging to lower approximation of a considered union of decision classes in case of VC-DRSA) should be considered when generating rules' conditions.public static final int ALL_DIFFERENT_SUFFICIENTLY_CONSISTENT_POSITIVE_EXAMPLES
modeOfPositiveExamplesForVCDRSA
, indicating that among positive examples
(i.e., belonging to VC-lower approximation of a considered union of decision classes) only different sufficiently consistent examples should be considered when generating rules' conditions.
This value makes sense only in case of standard VC-DomLEM (i.e., VC-DomLEM employing confidence measure) since in case of monotonic VC-DomLEM all examples from a lower approximation are sufficiently consistent.public static final int ALL_DIFFERENT_BORDER_POSITIVE_EXAMPLES
modeOfPositiveExamplesForDRSA
and modeOfPositiveExamplesForVCDRSA
, indicating that among positive examples
(i.e., belonging to lower/upper approximation of a considered union of decision classes in case of DRSA, or
belonging to lower approximation of a considered union of decision classes in case of VC-DRSA) only different border examples (i.e., belonging to EDGE) should be considered when generating rules' conditions.public boolean deleteRedundantConditions
true
.public boolean deleteRedundantRules
true
.public boolean deleteNotMinimalRules
true
.public boolean checkVCDRSAMeasureValueDuringMinimalityTest
true
.
This flag is meaningful only when deleteNotMinimalRules
flag is true
.public java.util.ArrayList<Rule> generateRules(ApproximatedEntity[] approximatedEntities, double[] variableConsistencyParameterValueThresholds, ApproximatedEntityDecisionsPredictor approximatedEntityDecisionsPredictor, int type, int characteristicDecisionClassUsageTip, ConditionValidator conditionValidator, MemoryContainer learningMemoryContainer, int conditionsSelectionMethod, int negativeExamplesTreatment)
type == Rule.AT_LEAST
(upward unions) then approximatedEntities
array should contain two unions in that order:
"union class 3 or better", "union class 2 or better". In case of cost decision criterion it should be:
"union class 1 and better", "union class 2 and better".UnionContainer
class to deal with unions, it returns upward and downward unions
in required order.type
parameter value),ApproximatedEntity.getCharacteristicDecisionClass
method for details) andtype
parameter value - see
ApproximatedEntityDecisionsPredictor.getDecisionsForRuleInducedFromLowerApproximation
,
ApproximatedEntityDecisionsPredictor.getDecisionsForRuleInducedFromUpperApproximation
and
ApproximatedEntityDecisionsPredictor.getDecisionsForRuleInducedFromBoundary
methods for details).generateRulesForPositiveExamples
method for:generateRulesForPositiveExamples
method minimality test is performed before storing that rule in the set of all rules induced so far.
Decision rule is said to be minimal if there is no another rule which has weaker or less conditions
and stronger conclusion. In case of unions of decision classes stronger conclusion means more specific union of decision classes.
In case of boundaries of single decision classes, there may by many = conclusions, connected by means of OR conjunction.
In that case stronger conclusion means conclusion containing at most the same decisions, and no other decisions.
For example if first rule's conclusion is (technical_state = bad OR technical_state = medium OR technical_state = good) and
second rule's conclusion is (technical_state = bad OR technical_state = medium) then second rule has stronger conclusion
(because it has less of the same possibilities).RulesContainer rulesContainer = new RulesContainer(learningMemoryContainer, variableConsistencyParameterValueThreshold);
ArrayList<Rule> rules = vcDomLem.generateRules(approximatedEntities, variableConsistencyParameterValueThresholds, approximatedEntityDecisionsPredictor, type, characteristicDecisionClassUsageTip, conditionValidator, learningMemoryContainer, conditionsSelectionMethod, negativeExamplesTreatment);
for(int i = 0; i < rules.size(); i++) {
rulesContainer.storeRule(rules.get(i));
}
----------------------------------------------------------basicValidationOfGenerateRulesParameters
method.approximatedEntities
- Set (array) of approximated entities. It may contain unions of decision classes
or single decision classes. For each union / decision class appropriate approximation or boundary
is calculated, according to the value of type
parameter and for given variable consistency parameter value threshold.
Calculated approximation or boundary is a set of positive examples used when calling
generateRulesForPositiveExamples
method.approximatedEntities
set is compatible with a value of
characteristicDecisionClassUsageTip
parameter, which describes that contents.
Otherwise unforeseen problems may arise while inducing decision rules. Correct combinations are:approximatedEntities
set contains single decision classes and characteristicDecisionClassUsageTip
is equal to Rule.EQUAL
,approximatedEntities
set contains upward unions and characteristicDecisionClassUsageTip
is equal to Rule.AT_LEAST
,approximatedEntities
set contains downward unions and characteristicDecisionClassUsageTip
is equal to Rule.AT_MOST
.variableConsistencyParameterValueThresholds
- Variable consistency parameter value thresholds for subsequent approximated entities, used to calculate lower / upper approximations or
boundaries of subsequent approximated entities (unions of decision classes or single decision classes). If for some entity value of this
parameter is the most restrictive (IRSA / DRSA), then for that entity this method induces rules, for which variable consistency measure value is the most restrictive.
If value of this parameter is not the most restrictive (VC-IRSA / VC-DRSA), then this method induces rules, for which variable consistency measure value may be not the most restrictive.approximatedEntityDecisionsPredictor
- object implementing ApproximatedEntityDecisionsPredictor
interface, which can predict right (decision) side of all rules of given type, induced for lower / upper approximation or boundary
of one approximated entity (union or single decision class)type
- Type of generated rules. Can be Rule.CERTAIN
, Rule.POSSIBLE
or Rule.APPROXIMATE
.characteristicDecisionClassUsageTip
- Usage tip for characteristic decision classes of generated rules.
Can be Rule.AT_LEAST
, Rule.AT_MOST
or Rule.EQUAL
.
Value of this parameter is passed to generateRulesForPositiveExamples
method
to influence type of relations in created conditions and decisions.Rule.EQUAL
=> given set (array) of approximated entities contains only single decision classes;
learning memory container contains only attributes without preference type assigned;
= conditions and decisions should be created basing on evaluations of given positive examples;
if additionally all variable consistency parameter value thresholds have the most restrictive values, then VC-DOMLEM behaves like LEM2 algorithmRule.AT_LEAST
=> given set (array) of approximated entities contains only upward unions of decision classes;
learning memory container contains at least one active condition criterion and possibly also attributes without preference type assigned;
>= (for gain criteria), <= (for cost criteria) or = (for attributes without preference type assigned)
conditions and >= (for gain decision criterion) or <= (for cost decision criterion) decisions should be created basing on evaluations of given positive examples;
if additionally all variable consistency parameter value thresholds have the most restrictive values, then VC-DOMLEM behaves like DOMLEM algorithmRule.AT_MOST
=> given set (array) of approximated entities contains only downward unions of decision classes;
learning memory container contains at least one active condition criterion and possibly also attributes without preference type assigned;
<= (for gain criteria), >= (for cost criteria) or = (for attributes without preference type assigned)
conditions and <= (for gain decision criterion) or >= (for cost decision criterion) decisions should be created basing on evaluations of given positive examples;
if additionally all variable consistency parameter value thresholds have the most restrictive values, then VC-DOMLEM behaves like DOMLEM algorithmconditionValidator
- condition validator stored in generated rules and used to validate all conditions
and decisions added to these ruleslearningMemoryContainer
- learning memory container for which all rules are generatedconditionsSelectionMethod
- Method of selection of conditions during induction of single decision rule.
Can be CHOOSE_CONDITIONS_FROM_ONE_OBJECT
or MIX_CONDITIONS_FROM_DIFFERENT_OBJECTS
.negativeExamplesTreatment
- Method of treatment for negative examples. Can be COVER_NONE_OF_NEGATIVE_EXAMPLES
,
COVER_ONLY_INCONSISTENT_NEGATIVE_EXAMPLES
, COVER_ANY_NEGATIVE_EXAMPLES
or COVER_ONLY_INCONSISTENT_AND_BOUNDARY_NEGATIVE_EXAMPLES
.
See description of listed public constants for details of usage.negativeExamplesTreatment
value is incompatible with chosen rough set approach
(i.e. IRSA, DRSA, VC-IRSA or VC-DRSA), then it is corrected in the following way:negativeExamplesTreatment == COVER_NONE_OF_NEGATIVE_EXAMPLES
and VC-IRSA or VC-DRSA, then
negativeExamplesTreatment
is corrected to COVER_ONLY_INCONSISTENT_NEGATIVE_EXAMPLES
;negativeExamplesTreatment != COVER_NONE_OF_NEGATIVE_EXAMPLES
and IRSA or DRSA, then
negativeExamplesTreatment
is corrected to COVER_NONE_OF_NEGATIVE_EXAMPLES
.java.lang.NullPointerException
- see basicValidationOfGenerateRulesParameters(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
InvalidValueException
- see basicValidationOfGenerateRulesParameters(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
and advancedValidationOfGenerateRulesParameters()
InvalidTypeException
- see basicValidationOfGenerateRulesParameters(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
and advancedValidationOfGenerateRulesParameters()
public java.util.ArrayList<Rule> generateRules(ApproximatedEntity[] approximatedEntities, double variableConsistencyParameterValueThreshold, ApproximatedEntityDecisionsPredictor approximatedEntityDecisionsPredictor, int type, int characteristicDecisionClassUsageTip, ConditionValidator conditionValidator, MemoryContainer learningMemoryContainer, int conditionsSelectionMethod, int negativeExamplesTreatment)
generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
method.
Checks if given array of approximated entities is not null
, and if so, then creates
array of variable consistency parameter values' thresholds with length equal to the length of approximatedEntities
.
Next, this array is filled with the value of variableConsistencyParameterValueThreshold
.
Finally, generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
method is invoked
and its result is returned.generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
method.approximatedEntities
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodvariableConsistencyParameterValueThreshold
- variable consistency parameter value threshold used to fill array of thresholds
used by generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodapproximatedEntityDecisionsPredictor
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodtype
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodcharacteristicDecisionClassUsageTip
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodconditionValidator
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodlearningMemoryContainer
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodconditionsSelectionMethod
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodnegativeExamplesTreatment
- see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodgenerateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodjava.lang.NullPointerException
- when array with approximated entities is null
public java.util.ArrayList<Rule> generateRules()
generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
method,
but uses fields of this object, rather than given parameters. For details see
generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
method.generateRules
in class RuleGenerator
generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
methodjava.lang.NullPointerException
- see checkGenerateRulesFieldsSetup()
InvalidValueException
- see checkGenerateRulesFieldsSetup()
and advancedValidationOfGenerateRulesParameters()
InvalidTypeException
- see checkGenerateRulesFieldsSetup()
and advancedValidationOfGenerateRulesParameters()
public java.util.ArrayList<Rule> generateRulesForPositiveExamples(int type, int characteristicDecisionClassUsageTip, Field characteristicDecisionClass, ConditionValidator conditionValidator, java.util.HashSet<Condition> decisions, MemoryContainer learningMemoryContainer, int[] numbersOfPositiveExamples, int[] numbersOfApproximatedEntityExamples, double variableConsistencyMeasureValueThreshold, int conditionsSelectionMethod, java.util.HashSet<java.lang.Integer> numbersOfPermittedNegativeCoveredExamples, java.util.HashSet<java.lang.Integer> numbersOfNeutralExamples)
Rule.AT_LEAST
) or downward (Rule.AT_MOST
) union of decision classes
or just single decision class (Rule.EQUAL
);
value of this parameter affects also type of created conditions),
for given decisions (which will be set on the right (decision) side of all created and returned rules),
for given learning memory container which may be either decision table, or PCT, or similarity table,
for given array with numbers of positive examples from given learning memory container
(which may come from lower / upper approximation or boundary of some decision class
or from lower / upper approximation of some upward / downward union of decision classes),
for given variable consistency measure value threshold (support for variable consistency approach),
for given method of selection of conditions
and for given hash set with numbers of permitted negative examples (used only for VC-IRSA / VC-DRSA).conditionsSelectionMethod
parameter value, subsequent conditions of single decision rule
may be created on the basis of evaluations from one positive object (robust decision rules) or on the basis of evaluations
from different positive objects (mix of conditions).type
- Type of generated rules. Can be Rule.CERTAIN
, Rule.POSSIBLE
or Rule.APPROXIMATE
.
In fact this parameter is not used during calculations, but needed for validation and stored in generated rules.characteristicDecisionClassUsageTip
- Usage tip for characteristic decision class of generated rules.
Can be Rule.AT_LEAST
, Rule.AT_MOST
or Rule.EQUAL
.
Value of this parameter is used by constructor of Rule
class.
It affects also, together with the type of generated rules, the type of conditions added to generated rules.type == Rule.CERTAIN
or type == Rule.POSSIBLE
) and
(characteristicDecisionClassUsageTip == Rule.AT_LEAST
)type == Rule.CERTAIN
or type == Rule.POSSIBLE
) and
(characteristicDecisionClassUsageTip == Rule.AT_MOST
)characteristicDecisionClassUsageTip == Rule.EQUAL
characteristicDecisionClass
- Decision class characteristic for generated rules. Decision class Cl is
characteristic for a rule if:conditionValidator
- condition validator stored in generated rules and used to validate all conditions
and decisions added to these rulesdecisions
- Hash set with decisions established at the right (decision) part of generated rules.
In fact this parameter is not used during calculations.
Decisions are stored in each rule and may be used in the future, when the rule is converted to textual form.learningMemoryContainer
- reference to learning memory container for which rules are generatednumbersOfPositiveExamples
- Array with numbers of positive examples for which rules are generated.
These positive examples may come from lower / upper approximation or boundary of a decision class
or lower / upper approximation or boundary of a union of decision classes.
Numbers concern examples from learning memory container.numbersOfApproximatedEntityExamples
- Array with numbers of examples belonging to the approximated entity
for which the rules should be generated. Can be null
(when the numbers are unknown).variableConsistencyMeasureValueThreshold
- Variable consistency measure value threshold for each generated rule.
During rule generation process each rule is extended (by adding next conditions) until it satisfies given threshold.conditionsSelectionMethod
- Method of selection of conditions during induction of single decision rule.
Can be CHOOSE_CONDITIONS_FROM_ONE_OBJECT
or MIX_CONDITIONS_FROM_DIFFERENT_OBJECTS
.numbersOfPermittedNegativeCoveredExamples
- Hash set which may be used only in case of VC-IRSA / VC-DRSA
(for other approaches must be null
), containing Integer
numbers of negative examples,
which may be covered by any induced rule, apart from positive examples.
All other negative examples are not permitted and cause that even if rule satisfies given threshold,
induction of that rule continues until only permitted negative examples are covered and threshold is satisfied as well.
If for VC-IRSA / VC-DRSA value of this parameter is null
, it means that apart from
positive examples any negative examples may be covered. The only requirement in this case is for the threshold.numbersOfNeutralExamples
- Hash set containing numbers of examples from learning memory container that are neutral
(i.e., neither positive nor negative) to each rule to be generated.
Such examples do not influence rule statistics. May be null, which indicates no neutral examples (most frequent case).Rule
.
Rules appear in the list in the order in which they have been induced.
If the set of positive examples is empty (but reference is not null
), then
empty list of rules is returned.InvalidValueException
- when type of the rules in none of Rule.CERTAIN
, Rule.POSSIBLE
or Rule.APPROXIMATE
,
when characteristicDecisionClassUsageTip is none of Rule.AT_LEAST
, Rule.AT_MOST
or Rule.EQUAL
,
when any decision is invalid according to condition validator,
when learning memory container contains no attributes or no examples,
when variable consistency measure value threshold for the rules does not belong to [0, 1] range,
when method of selection of conditions for single decision rule is none of CHOOSE_CONDITIONS_FROM_ONE_OBJECT
and MIX_CONDITIONS_FROM_DIFFERENT_OBJECTS
,
when combination of (type, usage tip for characteristic decision class, variable consistency measure value threshold) parameters' values is not supported by this method
(see description of whole class to see allowed combinations),
when numbers of permitted negative examples are different than null
while not
VC-IRSA nor VC-DRSA are used,
when generateRulesCalledFirst
is false
and minimal rate of covered positive examples (minRateOfCoveredPositiveExamples
variable) and
maximal quantity of rules (maxQuantityOfRulesForPositiveExamples
variable) are set (not equal to-1
) at the same time,
when no active condition attribute has been found in memory container
or when characteristic decision class usage tip is not compatible with learning memory container, which happens if:characteristicDecisionClassUsageTip
== EQUAL
(since there is no sense in generating equality conditions for criteria)characteristicDecisionClassUsageTip
== AT_LEAST
or AT_MOST
(since there is no sense in generating >= or <= conditions for attributes)java.lang.NullPointerException
- when decision class characteristic for this rule is null
,
when condition validator is null
,
when decisions are null
,
when learning memory container is null
or when array with numbers of positive examples is null
InvalidTypeException
- when type of initial value of any active condition attribute / criterion from learning memory container is not acceptable,
which happens if type is different than SimpleField
and SimilarityField
in case of IRSA / VC-IRSA
or different than SimpleField
, PairField
and SimilarityField
in case of DRSA / VC-DRSApublic double[] getMinRatesOfCoveredPositiveExamples()
generateRules
method.generateRules
methodpublic void setMinRatesOfCoveredPositiveExamples(double[] minRatesOfCoveredPositiveExamples)
generateRules
method.
If null
is passed here, then array of minimal rates will not be used during generation of decision rules
by means of generateRules
method.
Otherwise, each value must belong to [0, 1] range.minRatesOfCoveredPositiveExamples
- array of minimal rates of covered positive examples for each approximated entity passed to
generateRules
method. Can be null
, but cannot be empty.InvalidValueException
- when given array of minimal rates is empty
or when minRatesOfCoveredPositiveExamples != null
and some value of given array does not belong to [0, 1] rangepublic int[] getMaxQuantitiesOfRulesForPositiveExamples()
generateRules
method.generateRules
methodpublic void setMaxQuantitiesOfRulesForPositiveExamples(int[] maxQuantitiesOfRulesForPositiveExamples)
generateRules
method.
If null
is passed here, then array of maximal quantities will not be used during generation of decision rules
by means of generateRules
method.
Otherwise, each value must be grater than zero.maxQuantitiesOfRulesForPositiveExamples
- array of maximal quantities of rules for each approximated entity passed to
generateRules
method. Can be null
, but cannot be empty.InvalidValueException
- when given array of maximal quantities is empty
or when maxQuantitiesOfRulesForPositiveExamples != null
and some value of given array is not greater than zeropublic double getMinRateOfCoveredPositiveExamples()
generateRulesForPositiveExamples
method, if this method is called directly,
and also in generateRules
method, if both minRatesOfCoveredPositiveExamples
and maxQuantitiesOfRulesForPositiveExamples
arrays are null
(in such a case the same minimal rate of covered positive examples is assumed for all the approximated entities).public void setMinRateOfCoveredPositiveExamples(double minRateOfCoveredPositiveExamples)
generateRulesForPositiveExamples
method, if this method is called directly,
and also in generateRules
method, if both minRatesOfCoveredPositiveExamples
and maxQuantitiesOfRulesForPositiveExamples
arrays are null
(in such a case the same minimal rate of covered positive examples is assumed for all the approximated entities).
Must belong to [0, 1] range or be equal to -1, in which case minimal rate constraint will not be used.minRateOfCoveredPositiveExamples
- minimal rate of covered positive examples for one set of positive examples
or -1 if minimal rate constraint should not be usedInvalidValueException
- when minimal rate of covered positive examples is different than -1
and does not belong to [0, 1] rangepublic int getMaxQuantityOfRulesForPositiveExamples()
generateRulesForPositiveExamples
method, if this method is called directly,
and also in generateRules
method, if both minRatesOfCoveredPositiveExamples
and maxQuantitiesOfRulesForPositiveExamples
arrays are null
(in such a case the same maximal quantity of rules is assumed for all the approximated entities).public void setMaxQuantityOfRulesForPositiveExamples(int maxQuantityOfRulesForPositiveExamples)
generateRulesForPositiveExamples
method, if this method is called directly,
and also in generateRules
method, if both minRatesOfCoveredPositiveExamples
and maxQuantitiesOfRulesForPositiveExamples
arrays are null
(in such a case the same maximal quantity of rules is assumed for all the approximated entities).
Must be greater than zero or equal to -1, in which case maximal quantity of rules constraint will not be used.maxQuantityOfRulesForPositiveExamples
- maximal quantity of rules for one set of positive examples
or -1 if maximal quantity of rules constraint should not be usedInvalidValueException
- when maximal quantity of rules is different than -1
and is not greater than zeropublic ApproximatedEntity[] getApproximatedEntities()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setApproximatedEntities(ApproximatedEntity[] approximatedEntities)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.approximatedEntities
- array of approximated entitiesjava.lang.NullPointerException
- when array with approximated entities is null
InvalidValueException
- when array with approximated entities is empty or
when not all approximated entities are defined for the same decision attribute from learning memory containerInvalidTypeException
- when any approximated entity is not compatible with this VC-DOMLEM implementation (see RuleGenerator.approximatedEntityIsCompatible(ApproximatedEntity)
method)public double[] getVariableConsistencyParameterValueThresholds()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setVariableConsistencyParameterValueThresholds(double[] variableConsistencyParameterValueThresholds)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.variableConsistencyParameterValueThresholds
- variable consistency parameter value thresholds for subsequent approximated entitiesjava.lang.NullPointerException
- when array with variable consistency parameter value thresholds is null
InvalidValueException
- when any variable consistency parameter value threshold is not in [0, 1] rangepublic ApproximatedEntityDecisionsPredictor getApproximatedEntityDecisionsPredictor()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setApproximatedEntityDecisionsPredictor(ApproximatedEntityDecisionsPredictor approximatedEntityDecisionsPredictor)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.approximatedEntityDecisionsPredictor
- approximated entity decisions' predictorjava.lang.NullPointerException
- when given approximated entity decisions predictor is null
public int getType()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setType(int type)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.type
- type of generated rulesInvalidValueException
- when type of the rules in none of Rule.CERTAIN
, Rule.POSSIBLE
or Rule.APPROXIMATE
public int getCharacteristicDecisionClassUsageTip()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setCharacteristicDecisionClassUsageTip(int characteristicDecisionClassUsageTip)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.characteristicDecisionClassUsageTip
- usage tip for characteristic decision classes of generated rulesInvalidValueException
- when characteristicDecisionClassUsageTip
is none of Rule.AT_LEAST
,
Rule.AT_MOST
or Rule.EQUAL
public ConditionValidator getConditionValidator()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setConditionValidator(ConditionValidator conditionValidator)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.conditionValidator
- condition validator stored in generated rulesjava.lang.NullPointerException
- when condition validator is null
public MemoryContainer getLearningMemoryContainer()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setLearningMemoryContainer(MemoryContainer learningMemoryContainer)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.learningMemoryContainer
- learning memory container for which all rules are generatedjava.lang.NullPointerException
- when learning memory container is null
InvalidValueException
- when learning memory container contains no attributes or no examplespublic int getConditionsSelectionMethod()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setConditionsSelectionMethod(int conditionsSelectionMethod)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.conditionsSelectionMethod
- method of selection of conditions during induction of single decision ruleInvalidValueException
- when method of selection of conditions for single decision rule is none of
CHOOSE_CONDITIONS_FROM_ONE_OBJECT
and MIX_CONDITIONS_FROM_DIFFERENT_OBJECTS
public int getNegativeExamplesTreatment()
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.public void setNegativeExamplesTreatment(int negativeExamplesTreatment)
generateRules()
method.
For details - see generateRules(ApproximatedEntity[], double[], ApproximatedEntityDecisionsPredictor, int, int, ConditionValidator, MemoryContainer, int, int)
.negativeExamplesTreatment
- method of treatment for negative examplesInvalidValueException
- when value of negative examples treatment is none of COVER_NONE_OF_NEGATIVE_EXAMPLES
,
COVER_ONLY_INCONSISTENT_NEGATIVE_EXAMPLES
, COVER_ANY_NEGATIVE_EXAMPLES
and COVER_ONLY_INCONSISTENT_AND_BOUNDARY_NEGATIVE_EXAMPLES
public int getOptimizedRuleConsistencyMeasure()
generateRulesForPositiveExamples(int, int, Field, ConditionValidator, HashSet, MemoryContainer, int[], int[], double, int, HashSet, HashSet)
or any generateRules(...)
method.RuleConstants.UNDEFINED_RULE_CONSISTENCY_MEASURE
(initial value), RuleConstants.MU_CONSISTENCY
, RuleConstants.EPSILON_CONSISTENCY
or RuleConstants.EPSILON_PRIM_CONSISTENCY
.generateRulesForPositiveExamples(int, int, Field, ConditionValidator, HashSet, MemoryContainer, int[], int[], double, int, HashSet, HashSet)
or any generateRules(...)
method.public int getConsistencyIn()
public void setConsistencyIn(int consistencyIn)
consistencyIn
- method of calculating value of used rule consistency measure for certain rulesInvalidValueException
- when given value is none of:
RuleConstants.CONSISTENCY_IN_POS
,
RuleConstants.CONSISTENCY_IN_POS_AND_BND
and RuleConstants.CONSISTENCY_IN_SET
public int getModeOfPositiveExamplesForDRSA()
modeOfPositiveExamplesForDRSA
.public void setModeOfPositiveExamplesForDRSA(int modeOfPositiveExamplesForDRSA)
modeOfPositiveExamplesForDRSA
.modeOfPositiveExamplesForDRSA
- Mode of positive examples for DRSA. Can be ALL_DIFFERENT_POSITIVE_EXAMPLES
or ALL_DIFFERENT_BORDER_POSITIVE_EXAMPLES
.public int getModeOfPositiveExamplesForVCDRSA()
modeOfPositiveExamplesForVCDRSA
.public abstract void setModeOfPositiveExamplesForVCDRSA(int modeOfPositiveExamplesForVCDRSA)
modeOfPositiveExamplesForVCDRSA
.modeOfPositiveExamplesForVCDRSA
- mode of positive examples for VC-DRSApublic abstract void setDefaultModeOfPositiveExamplesForVCDRSA()
modeOfPositiveExamplesForVCDRSA
.
This method is called in each constructor of VCDomLem
class to set default (initial) mode for any subclass object.