All topics
Association Rules
Market-basket analysis: support, confidence and lift, and how the Apriori property prunes the itemset search.
Sort:
5 questions
JuniorTheoryCommonHow does the frequent-itemset algorithm Apriori avoid counting most candidate itemsets?
JuniorTheoryCommon
How does the frequent-itemset algorithm Apriori avoid counting most candidate itemsets?
Apriori relies on one property: every subset of a frequent itemset is also frequent. So once an itemset falls below minimum support, every superset of it is dropped as a candidate without ever being counted in the data.
Common mistakes
- ✗Assuming supersets of a frequent set are frequent: adding items can only lower support, so the guarantee runs from infrequent sets up to their supersets.
- ✗Assuming Apriori prunes by confidence: itemset pruning uses support alone; confidence is applied later, when rules are built from the frequent itemsets.
Follow-up questions
- →Why does each Apriori pass still need a full scan of the baskets?
- →Which candidate 3-itemsets survive if {bread, milk} is infrequent?
JuniorTheoryCommonWhat does this program print?
JuniorTheoryCommon
What does this program print?
0.67 0.83
Open full question →Common mistakes
- ✗Expecting a lift above 1 because two thirds of chips baskets hold soda: soda is in
0.8of all baskets, so the rule is below the usual rate and lift is0.83. - ✗Expecting
0.4for confidence: that is the pair's share of all five baskets, its support; confidence divides by the three baskets with chips.
Follow-up questions
- →What are the confidence and lift of the reverse rule, soda → chips?
- →Which basket would you add to push the lift of chips → soda above 1?
JuniorTheoryCommonWhy can an association rule with high confidence still be useless, and what does lift show?
JuniorTheoryCommon
Why can an association rule with high confidence still be useless, and what does lift show?
Lift is confidence divided by the consequent's support. If butter is in 80% of baskets, a 70% confidence for bread → butter gives lift below 1, so bread baskets hold butter less often. Lift of 1 means independence.
Common mistakes
- ✗Trusting high confidence alone: if the consequent sits in most baskets anyway, confidence is high for any antecedent, and lift below 1 exposes that.
- ✗Reading lift above 1 as causation: lift compares co-occurrence with independence; it does not show that one purchase triggers the other.
Follow-up questions
- →Why is lift the same for bread → butter and butter → bread?
- →Which rules would you keep if a store wants cross-sell suggestions?
JuniorTheoryCommonOf 100 baskets, 20 hold bread and 10 hold both bread and butter — what is the confidence of bread → butter?
JuniorTheoryCommon
Of 100 baskets, 20 hold bread and 10 hold both bread and butter — what is the confidence of bread → butter?
0.5
Common mistakes
- ✗Answering 0.1: that is the rule's support, the share of all 100 baskets holding both; confidence divides by the 20 bread baskets.
- ✗Answering 2: dividing bread baskets by bread-and-butter baskets inverts the ratio; confidence is a conditional probability and never exceeds 1.
Follow-up questions
- →What is the support of the rule bread → butter in this data?
- →If 40 of the 100 baskets contain butter, what is the lift of bread → butter?
JuniorTheoryCommonWhat does this program print?
JuniorTheoryCommon
What does this program print?
0.5
Open full question →Common mistakes
- ✗Expecting
1.0: on sets<=is the subset test, not a size comparison, so a basket counts only if it holds bothteaandsugar. - ✗Expecting
0.25:<=lets a basket hold extra items, so the basket withlemoncounts as well; only==demands an exact match.
Follow-up questions
- →What would the program print with
==in place of<=? - →How would the support change if a fifth basket held only
tea?