Examples for creating association rules
This example shows how to detect interesting and useful association rules on the RETAIL sample data set.
To select interesting rules from the set of all possible rules, constraints on various measures of significance and interest can be used. The best-known constraints are minimum thresholds on support and confidence.
The following call shows how to discover association rules.
CALL IDAX.ASSOCRULES('model=retail_assoc, intable=retail, tid=tid, item=item, maxlen=6, minsupport=0.01, minconf=0.5');
The call runs the algorithm on the Retail data set and requests the following rules:
- Frequent item sets and rules with the absolute support for one percent of the transactions or more
- Rules with confidence of 50 percent and more
- Maximum number of items for rules (maxlen) of 6 and less
To inspect the built model, you can use the PRINT_MODEL stored procedure as shown in the following example:
CALL IDAX.PRINT_MODEL('model=retail_assoc, minlen=3, minconf=0.75, minlift=1.5');
In the example, the additional rule selection filter limits the number of presented rules as follows:
- The minimum number of the items of a rule (minlen)
- The minimum confidence (minconf)
- The minimum lift (minlift)
By applying the limitation, the number of presented rules decreases from 95 to 7 for the RETAIL_ASSOC model.
The model can be reduced to these seven rules by applying the same limitation with the PRUNE_ASSOCRULES stored procedure as shown in the following example:
CALL IDAX.PRUNE_ASSOCRULES('model=retail_assoc, minlen=3, minconf=0.75, minlift=1.5');
The PREDICT_ASSOCRULES stored procedure predicts which of the seven rules of the model can be best associated to new transactions as shown in the following example:
CALL IDAX.PREDICT_ASSOCRULES('model=retail_assoc, intable=retail, outtable=retail_assoc_out');