CAB206 · Unit 5: AI for business intelligence
Market-basket analysis and association rules
9 practice questions
Key points
- Support, confidence, lift formulas
- Lift > 1 positive, 1 independent, < 1 negative
- Apriori pruning: infrequent set means infrequent supersets
- Higher min support gives fewer frequent itemsets
- Confidence can mislead if B is popular; check lift
Association rule mining finds items that occur together in transactions ("customers who buy X often buy Y"). It is used for cross-selling, store layout and bundling.
For a rule A -> B over N transactions:
- Support(A -> B) = transactions containing both A and B / N. How common the pair is.
- Confidence(A -> B) = support(A and B) / support(A). How often B appears when A does.
- Lift(A -> B) = confidence / support(B). Lift > 1 means positive association, = 1 independence, < 1 negative association (buying A makes B less likely than normal).
Worked example (5 baskets): {Bread, Milk}; {Bread, Diaper, Beer, Eggs}; {Milk, Diaper, Beer, Cola}; {Bread, Milk, Diaper, Beer}; {Bread, Milk, Diaper, Cola}.
- support({Diaper, Beer}) = 3/5 = 0.60.
- confidence(Diaper -> Beer) = 3/4 = 0.75; confidence(Beer -> Diaper) = 3/3 = 1.0.
- support(Beer) = 0.60, so lift(Diaper -> Beer) = 0.75 / 0.60 = 1.25.
- confidence(Milk -> Diaper) = 0.75 but support(Diaper) = 0.80, so lift = 0.9375: slightly negative.
Apriori principle. Every subset of a frequent itemset is frequent; equivalently, if an itemset is infrequent, all its supersets are infrequent. Apriori uses this to prune candidates level by level. Raising the minimum support reduces the number of frequent itemsets.
Counting. n items give 2^n - 1 non-empty itemsets. An itemset of size k yields 3^k - 2^(k+1) + 1 possible rules (12 for k = 3, 602 for k = 6).
Caution. High confidence can come from a very popular item B, which is why lift is checked. Association is not causation.
Try two questions
A lift of exactly 1 for A -> B means:
- A and B occur together as often as independence predicts
- A and B never occur together in any recorded transaction
- B is the most frequent item among all of the transactions
- A always leads to B in every transaction that contains A
Show the answer
A. Lift of 1 means no association beyond chance; above 1 is positive, below 1 negative.
In an association rule A -> B, support measures:
- The fraction of A transactions that also contain B
- The fraction of all transactions containing both A and B
- How many times larger the co-occurrence is than expected
- The number of items in the rule
Show the answer
B. Support counts how common the itemset is across all transactions; confidence is conditional on A, and lift compares with independence.