If you have specified an upper limit for the number of rules to be included in a generated model, you can specify count constraints to select the 'best rules'. You can specify integers or strings.
Count constraint | Integer | String |
---|---|---|
Accessible volume | 28 | accessibleVolume |
Weight of the rule body | 22 | bodyWeight |
Confidence | 2 | confidence |
Weight of the rule head | 21 | headWeight |
Weight of each item in rules or item sets | 24 | itemWeight |
Lift | 3 | lift |
Number of items | 5 | nbOfItems |
Number of item sets | 6 | nbOfItemsets |
Weight of the rule | 20 | ruleWeight |
Support | 1 | support |
Support*confidence | 4 | suppTimesConf |
Support times weight of the rule | 23 | suppTimesRuleWeight |
Elapsed time between adjacent parts of the rule | 10 | stepWindow |
Total elapsed time from the beginning to the end of the rule | 9 | totalWindow |
Average weight of the transactions (Associations) or transaction groups (Sequences) that support the rule | 29 | transactionWeight |
This example specifies that the model must not contain more than 100 rules. If more rules are found, the 100 'best' rules are included in the model.
IDMMX.DM_RuleFilter() ..DM_setMaxNumRules(100) ..DM_addCountConstr(1,'nbOfItems','ascending') ..DM_addCountConstr(2,'lift','descending')
With item constraints, you can limit the number of rules to be generated in a model. You can specify to include or to exclude items in the rule body, in the rule head, or in the complete rule.
If you want to include the specified items, the rules that contain at least one of the specified items are generated. Including specified items is called a positive item constraint.
If you want to exclude the specified items, the rules that contain any of the specified items are discarded from the results. Excluding specified items is called a negative item constraint.
You can combine positive item constraints and negative item constraints that apply to the rule body, the rule head, or to the complete rule by using the boolean predicates AND or OR. Item constraints that are connected by the predicate AND must be matched simultaneously. If you apply item constraints that are connected by the predicate OR, at least one of the item constraints must be satisfied.
Item constraints also work with the categories of a taxonomy. Taxonomies are classes or categories of items. For example, if Drink is a taxonomy parent of the items Juice and Milk, and the item Juice is a taxonomy parent of the item Orange juice, you can specify one of the available item constraints for the taxonomy parent Drink. This constraint affects any occurrence of the items Orange Juice, Juice, Milk, or Drink in the data.
If you want to include the specified categories, only rules that contain at least one of the specified categories or at least one of their direct or indirect members are generated. If you want to exclude the specified categories, the rules that contain the specified categories or their direct or indirect members are discarded from the result.
If you use name mappings, you can use the original item names or their name mapping to define item constraints.
Item constraint | Integer | String |
---|---|---|
The item must exist in the rule body. | 1 | isInBody |
The item must exist in the rule head. | 2 | isInHead |
The item must exist in the rule. | 3 | isInRule |
The item must not exist in the rule body. | -1 | notInBody |
The item must not exist in the rule head. | -2 | notInHead |
The item must not exist in the rule | -3 | notInRule |
At least one item of this category, or the category name, must exist in the rule body. | 11 | categoryIsInBody |
At least one item of this category, or the category name, must exist in the rule head. | 12 | categoryIsInHead |
At least one item of this category, or the category name, must exist in the rule. | 13 | categoryIsInRule |
An item of this category must not exist in the rule body. | -11 | categoryNotInBody |
An item of this category must not exist in the rule head. | -12 | categoryNotInHead |
An item of this category must not exist in the rule. | -13 | categoryNotInRule |
Average weight of the transactions (Associations) or transaction groups (Sequences) that support the rule | 29 | transactionWeight |
Item constraints that include an identical third argument are concatenated by the logical OR. Constraint groups that include different third arguments are concatenated by the logical AND. Therefore, the boolean predicate that matches the rule filter below looks like this:
IDMMX.DM_RuleFilter() ..DM_setItemConstr('Roquefort','isInHead',1) ..DM_setItemConstr('Camembert','isInHead',1) ..DM_setItemConstr('alcoholic drinks','categoryIsInHead',2) ..DM_setItemConstr('alcoholic drinks','categoryNotInBody',3) ..DM_setItemConstr('non food','categoryNotInRule',4)
With range constraints, you can limit the search space for new rules by specifying valid ranges for particular numeric properties of a rule, for example, the support value or the confidence value. You can use methods for specifying range constraints with integer IDs or with textual key words.
Range constraint | Integer | String |
---|---|---|
Accessible volume | 28 | accessibleVolume |
Weight of the rule body | 22 | bodyWeight |
Confidence | 2 | confidence |
Weight of the rule head | 21 | headWeight |
Weight of each item in rules or item sets | 24 | itemWeight |
Lift | 3 | lift |
Number of items | 5 | nbOfItems |
Number of item sets | 6 | nbOfItemsets |
Number of items in the rule body | 7 | nbOfBodyItems |
Number of items in the rule head | 8 | nbOfHeadItems |
Weight of the rule | 20 | ruleWeight |
Support | 1 | support |
Support*confidence | 4 | suppTimesConf |
Support times weight of the rule | 23 | suppTimesRuleWeight |
Elapsed time between adjacent parts of the rule | 10 | stepWindow |
Total elapsed time from the beginning to the end of the rule | 9 | totalWindow |
This example specifies that the rules that meet the following criteria are included in the model:
IDMMX.DM_RuleFilter() ..DM_addRangeConstr('support',2.7,100.0,'isInClosed') ..DM_addRangeConstr('confidence',50.0,100.0,'isInClosed') ..DM_addRangeConstr('lift',0.5,2.0,'notInOpen') ..DM_addRangeConstr('nbOfItems',2,4,'isInClosed') ..DM_addRangeConstr('nbOfHeadItems',0,2,'isInOpen')