Association Rule Mining in Data Mining
Association rule mining finds "if-then" relationships hiding in large datasets — transaction records, medical histories, financial logs — in the general form X → Y: if the antecedent X is present, the consequent Y tends to be present too. Market basket analysis, covered in its own dedicated lesson, is the retail-specific application of exactly this technique; this lesson focuses on the full family of measures used to judge whether a discovered rule is actually worth acting on, several of which go well beyond the support/confidence/lift trio covered there.
The Five Measures, Computed Together on One Dataset
Rather than present each formula in isolation, computing all five together on the same small dataset shows how they relate — and, done carefully, catches a real error worth calling out directly: confidence is frequently misstated as Support(X) / Support(X∪Y), which is backwards. The correct formula divides the other way: Confidence(X→Y) = Support(X∪Y) / Support(X) — among transactions that already contain the antecedent, what fraction also contain the consequent. Ten transactions, tracking whether each contains milk (M) and/or bread (B):
T1: M, B T2: M, B T3: M T4: B T5: M, B
T6: M T7: B T8: M, B T9: M T10: B
Counting directly: M appears in 7 transactions, B appears in 7, and both appear together in 4 (T1, T2, T5, T8).
Support(M) = 7/10 = 0.70
Support(B) = 7/10 = 0.70
Support(M, B) = 4/10 = 0.40
Confidence(M -> B) = Support(M,B) / Support(M) = 0.40 / 0.70 ≈ 0.571 (57.1%)
Lift(M -> B) = Support(M,B) / (Support(M) * Support(B)) = 0.40 / (0.70 * 0.70) ≈ 0.816
Leverage(M -> B) = Support(M,B) - (Support(M) * Support(B)) = 0.40 - 0.49 = -0.09
Conviction(M -> B) = (1 - Support(B)) / (1 - Confidence(M -> B)) = 0.30 / 0.429 = 0.70
This is a genuinely instructive result, not just an arithmetic exercise: a 57.1% confidence sounds like a reasonably strong rule at first glance — better than a coin flip. But lift (0.816), leverage (-0.09), and conviction (0.70) all agree that the rule is actually slightly negative — milk and bread occur together less often than pure chance would predict, given how common each item already is individually (70% each). Confidence alone would have overstated this relationship; the other three measures, computed from the exact same underlying counts, correctly reveal there's no real positive association here at all.
What Each Measure Actually Answers
- Support — how common the itemset is overall:
Support(X) = count(X) / total transactions. - Confidence — among transactions containing
X, what fraction also containY:Support(X∪Y) / Support(X). - Lift — how much more (or less) often
XandYco-occur than pure chance predicts:Support(X∪Y) / (Support(X) × Support(Y)). A value above 1 means positive association, below 1 means negative association, and exactly 1 means no relationship at all. - Leverage — the same comparison as lift, but as a difference rather than a ratio:
Support(X∪Y) − (Support(X) × Support(Y)). It's worth being precise here since these two get conflated in some sources: this difference-based measure is properly called leverage; the term "interest" is more commonly used elsewhere in the literature as another name for lift's ratio form, not for this subtraction form — treating them as two separately named measures with the same formula, as if by coincidence, is a mislabeling worth avoiding. - Conviction — measures how much the rule's implication actually depends on the antecedent:
(1 − Support(Y)) / (1 − Confidence(X→Y)). A value of exactly 1 indicates independence; above 1 indicates a genuine positive dependency (converging toward infinity as confidence approaches a perfect 100%); below 1, as in the example above, aligns with the negative association lift and leverage already identified.
How Rules Are Actually Found: The Apriori Principle
Checking every possible combination of items for these measures is computationally infeasible once a database has thousands of distinct products. The standard solution — covered with a fully worked example in the lesson on market basket analysis, and improved on by the FP-Growth algorithm covered in its own dedicated lesson — relies on one key pruning insight: if an itemset is frequent, every subset of it must also be frequent (equivalently, if any subset is infrequent, the larger itemset built from it cannot possibly be frequent either). This single fact is what lets the Apriori algorithm skip checking the vast majority of possible itemsets, building up only from combinations that have already survived at a smaller size.
Where This Shows Up in Practice
Beyond retail shelf placement, the same technique — find co-occurring items or events, then filter by these measures — recurs across genuinely different domains: healthcare (symptom and test-result patterns supporting diagnosis), financial services (unusual combinations of transactions flagging potential fraud), telecommunications (usage patterns preceding customer churn), web usage analysis (page sequences informing site navigation and recommendations), and recommendation systems (the same co-occurrence logic behind "customers who bought this also bought" features on retail and streaming platforms). What ties all of these together is the same underlying question this lesson's worked example answers concretely: not just does X occur with Y, but does it occur with Y more than chance alone would already explain — the question confidence alone cannot answer, and lift, leverage, and conviction can.