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 {A,B}→C and {B,C}→D, 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 X→Y, conf=sup(X∪Y)/sup(X) and lift=conf/P(Y).

Steps

  1. Count single items. A appears in T1, T2, T3, T5, so 4. B appears in T1, T2, T4, T5, so 4. C appears in T1, T3, T4, T5, so 4. D appears in T4, T5, so 2. All reach 2, so all four are frequent.
  2. Form the six candidate pairs and count them. AB=3, AC=3, AD=1, BC=3, BD=2, CD=2. Drop AD because its count 1 is below 2. Frequent pairs are AB,AC,BC,BD,CD.
  3. Prune and count triples: only ABC and BCD have all pairs frequent (ABD and ACD contain AD and are pruned without counting). ABC appears in T1 and T5 (count 2) and BCD in T4 and T5 (count 2), so both are frequent; ABCD is pruned via AD, giving 4 singletons, 5 pairs and 2 triples.
  4. Rule {A,B}→C. Confidence is sup(ABC)/sup(AB)=2/3≈0.667. The base rate of C is P(C)=4/5=0.8. Lift is 0.667/0.8≈0.83.
  5. Rule {B,C}→D. Confidence is sup(BCD)/sup(BC)=2/3≈0.667. The base rate is P(D)=2/5=0.4. Lift is 0.667/0.4≈1.67.
  6. Both rules have the same confidence, but lift tells them apart. Lift below 1 means A,B make C less likely than usual. Lift above 1 means B,C make D more likely than usual. Only {B,C}→D is a real positive association.

Common mistakes

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 n=200 normal points with ν=0.05. (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 ν=0.5 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 x=4 and x=9. Where does each run stop, and what do you learn about the number of clusters?