Association Rules: Support, Confidence & Lift
Association-rule mining finds itemsets that recur across transactions and turns them into directional co-occurrence rules. Support controls frequency, confidence measures a conditional rate, lift compares it with the consequent's baseline, and generalized rules repeat the search across an item taxonomy without mistaking hierarchy for evidence.
Association-rule mining starts from transactions—sets of items, events, or properties—and asks which item combinations recur. A rule says that transactions containing itemset often also contain disjoint itemset . The arrow records a directional conditional frequency: it is not logical implication, temporal order, causation, or a recommendation policy.
The method separates a computational problem from an interpretive one. First find frequent itemsets without enumerating the full power set; then decide which rules are surprising, stable, and useful enough to act on.
From transactions to rules #
Let be the item universe and a transaction database, where each . A transaction contains itemset when . Define its count as
An association rule is with and . Requiring disjoint sides avoids restating an item already assumed in the antecedent. The same framework works for shopping baskets, diagnoses recorded during one encounter, pages within one session, or alarms within one incident—but the definition of a transaction changes what co-occurrence means.
Support, confidence, and lift #
Support is the fraction of transactions containing an itemset. For a rule it is the support of the union:
Confidence asks what fraction of antecedent transactions also contain the consequent:
Lift divides that conditional rate by the baseline prevalence of :
| Quantity | Question it answers | What it misses |
|---|---|---|
| Support | How much of the database does this joint pattern cover? | Whether the items occur together more than their separate prevalences predict |
| Confidence | When occurs, how often does occur? | Whether is common even without |
| Lift | How many times the baseline rate of is observed among transactions? | Sample size, uncertainty, action cost, and causality |
Lift 1 is the value expected under independence in the observed sample; above 1 means positive association and below 1 negative association. Support and lift are symmetric in and , but confidence is not, because reversing a rule changes the denominator.
Basket example #
Among 100 baskets, 40 contain bread, 30 butter, and 24 both. Then
and lift is . Butter is twice as common in bread baskets as overall. The reverse confidence is , while lift remains 2. Confidence is directional because denominators differ; lift is symmetric for the pair even though the displayed rule arrow is not causal.
Now consider 1,000 baskets in which 100 contain tea, 800 contain a bag, and 80 contain both. The rule has confidence , which sounds strong, but lift is . Tea adds no information about a bag: the consequent is simply common. Conversely, a rule observed twice can have spectacular lift and almost no evidential or operational value.
Apriori controls combinatorial search #
With items there are itemsets. Apriori uses anti-monotonicity:
If an itemset is infrequent, every superset is infrequent.
It first finds frequent single items, joins them to propose candidate pairs, prunes any candidate whose subsets are not all frequent, scans support, and repeats for larger sets. This removes entire branches of the itemset lattice. After frequent itemsets are known, candidate rules are generated and filtered by confidence or other criteria.
For each frequent itemset and each non-empty proper subset , the remaining items form . The rule survives a confidence threshold when
This two-stage decomposition matters: minimum support prunes itemsets during the expensive search, while minimum confidence filters directions after their counts exist. Low minimum support can still produce an explosion of candidates; high support can erase rare but important combinations. FP-growth and related methods avoid explicit candidate generation by compressing transactions, but a faster search does not make the resulting rules statistically valid.
Generalized rules use an item taxonomy #
Leaf-level identifiers are often too sparse. Individual green-tea and black-tea products may each miss minimum support even though the broader category tea has a stable relationship with bakery. A generalized, hierarchical, or multilevel association rule allows either side to contain nodes from any level of an is-a taxonomy.
flowchart TD Beverage --> Tea Beverage --> Coffee Beverage --> Soda Tea --> Green["Green tea"] Tea --> Black["Black tea"] Bakery --> Cookies Bakery --> Bread
Arrows in the diagram run from category to child: green tea is-a tea, and tea is-a beverage. The taxonomy may be a tree or a directed acyclic graph when an item participates in more than one classification. A transaction supports category when it contains itself or any descendant of . The simplest implementation forms an extended transaction by adding every observed item's ancestors and removing duplicates, then runs an ordinary frequent-itemset miner.
Consider these eight baskets:
| Basket | Leaf items |
|---|---|
| 1 | green tea, cookies |
| 2 | black tea, cookies |
| 3 | coffee, cookies |
| 4 | coffee, bread |
| 5 | soda, chips |
| 6 | black tea, bread |
| 7 | green tea, coffee, cookies |
| 8 | bread |
After ancestor expansion, Beverage is present in baskets 1–7, so its support is . Bakery is present in baskets 1–4 and 6–8, also . Their intersection contains baskets 1–4, 6, and 7, giving
The generalized rule has high coverage and confidence but essentially no positive association. More importantly, basket 7 contains both green tea and coffee yet contributes only once to Beverage support. Category support is therefore not the sum of child supports: overlapping descendants would double-count transactions.
Generalization also creates structural redundancy:
- is true by taxonomy, not discovered behavior, so rules whose consequent is an ancestor of an antecedent item must be rejected.
- An itemset containing both green tea and Tea has the same support as the itemset without the ancestor; it adds no constraint.
- A specialized rule is uninformative when its support and confidence are no more surprising than those predicted by its closest ancestor rule.
- Very broad categories gain support but can wash out a strong leaf-level association. Search and report the abstraction level at which the effect changes, not only the broadest rule that clears a threshold.
Taxonomy-aware miners exploit these relations without materializing every ancestor in every transaction. The historical Cumulate and EstMerge algorithms precompute relevant ancestors, avoid candidates containing an item and its ancestor, and use hierarchy-aware pruning or sampling. Those optimizations change runtime, not the definitions above.
What makes a rule actionable #
Evaluate rules on later or held-out transactions. Attach counts and uncertainty, not only ratios. Check whether association persists across stores, periods, customer segments, taxonomy revisions, and exposure conditions. Compare with a popularity baseline and with the cost of the proposed action.
For a fixed rule, the four counts , , , and form a contingency table. An independence test can quantify whether the observed departure from lift 1 is compatible with sampling noise, but mining first and testing the selected winner invalidates an ordinary single-test interpretation. Searching millions of candidates almost guarantees extreme-looking lift by chance. Stability filters, false-discovery control, shrinkage, minimum counts, and a confirmatory holdout reduce this risk; see goodness-of-fit and independence tests.
If a rule will drive a recommendation, promotion, or alert, test that policy itself. Deployment changes exposure: recommending to people with alters later confidence, and a profitable intervention depends on incremental effect, margin, and opportunity cost—not historical co-occurrence alone.
Diagnostic checklist #
| Symptom | Likely cause | Check |
|---|---|---|
| High confidence, lift near 1 | Consequent is common | Compare confidence with |
| Huge lift, tiny support | Rare-event ratio instability | Inspect joint count and an uncertainty interval |
| Many near-duplicate rules | Nested items or adjacent taxonomy levels | Remove item–ancestor itemsets and compare with closest ancestor rules |
| Rule disappears by store or month | Mixture, seasonality, promotion, or drift | Recompute counts by meaningful segment and later period |
| Rule appears after a campaign | Exposure policy created the co-occurrence | Use an experiment or causal design |
| Category support exceeds 1 when summed | Descendant transactions were double-counted | Count each transaction once per category after ancestor closure |
Other common failures include duplicated or bot transactions, inconsistent item identifiers, and treating a basket as a sequence. Promotions, layout, season, or customer type can cause both sides of a rule; next-event claims require ordered event data and a sequential-pattern method.
Association rules are compact exploratory summaries. Their role is to surface hypotheses and candidate policies; causal impact requires an experiment or a design that addresses confounding and exposure.