Five shopping baskets are T1 = {A, B, C}, T2 = {A, B}, T3 = {A, C}, T4 = {B, C, D} and T5 = {A, B, C, D}. Run Apriori with minimum support count 2 to list all frequent itemsets. Then, for the rules and , compute confidence and lift. Which rule shows a real association?
Unsupervised learning, Association rules
Level L2 Elementary. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can run the level-wise Apriori search with pruning and then compute support, confidence and lift correctly.
Key idea
Support of an itemset is the number of baskets containing it. Apriori uses the rule that every subset of a frequent itemset must be frequent, so candidates with an infrequent subset are pruned. For a rule , and .
Steps
- Count single items. appears in T1, T2, T3, T5, so 4. appears in T1, T2, T4, T5, so 4. appears in T1, T3, T4, T5, so 4. appears in T4, T5, so 2. All reach 2, so all four are frequent.
- Form the six candidate pairs and count them. , , , , , . Drop because its count 1 is below 2. Frequent pairs are .
- Prune and count triples: only and have all pairs frequent ( and contain and are pruned without counting). appears in T1 and T5 (count 2) and in T4 and T5 (count 2), so both are frequent; is pruned via , giving 4 singletons, 5 pairs and 2 triples.
- Rule . Confidence is . The base rate of is . Lift is .
- Rule . Confidence is . The base rate is . Lift is .
- Both rules have the same confidence, but lift tells them apart. Lift below 1 means make less likely than usual. Lift above 1 means make more likely than usual. Only is a real positive association.
Common mistakes
- Counting candidates that contain an infrequent subset instead of pruning them. This is the whole point of Apriori.
- Judging a rule by confidence alone. A rule with high confidence can still have lift below 1 when the consequent is very common.
- Dividing by the number of baskets in the confidence formula. Confidence divides by the support of the antecedent, not by the total.
- Forgetting that minimum support here is a count of 2, which is 40% of 5 baskets.
How long your answer should be
Half a page with a small table of counts; 4–5 minutes.
Read this
Previous in Unsupervised learning: A one-class SVM with an RBF kernel is trained on normal points with . (a) What does guarantee about the number of training points outside the learned boundary and the number of support vectors? (b) What happens if you set instead, and why would be a poor choice for contaminated data if set too small?
Next in Unsupervised learning: Six points on a line are 1, 2, 3, 10, 11 and 12. Using a flat kernel of radius 2.5 (all points within distance 2.5 get equal weight), run mean shift by hand from the starting positions and . Where does each run stop, and what do you learn about the number of clusters?