Association Rules
People who buy X also tend to buy Y. Finding those patterns automatically.
Key Points
- Support: how often an itemset appears in the dataset. Support({bread, jam}) = fraction of transactions containing both.
- Confidence: given X was bought, how often is Y also bought. Confidence(bread → jam) = support({bread, jam}) / support({bread}).
- Lift: how much more likely Y is given X, compared to Y's baseline rate. Lift > 1 means X and Y co-occur more than by chance.
- A rule with high confidence but low lift might just reflect that Y is extremely common — not a useful pattern.
- The Apriori algorithm prunes the search space by noting that if an itemset is rare, all its supersets will also be rare.
What it is
Association rule mining finds co-occurrence patterns in transactional data. Given a set of transactions, it identifies which items frequently appear together and produces rules like 'if a customer buys bread and butter, they also tend to buy jam.' The classic algorithm is Apriori.
Why it exists
You can't manually check every possible combination of products in a store with thousands of items. Association rule mining automates the search for non-obvious co-occurrence patterns across millions of transactions. It turns raw transaction logs into actionable patterns.
Intuition
Formulas
Support
|X \cup Y|— Number of transactions containing both X and Y|\text{Transactions}|— Total number of transactions
Confidence
\text{Support}(X \cup Y)— Fraction of transactions with both X and Y\text{Support}(X)— Fraction of transactions with X
Lift
\text{Confidence}(X \Rightarrow Y)— How often Y appears given X\text{Support}(Y)— How often Y appears in general — the baseline
When to use
- Market basket analysis — finding what products to bundle, cross-sell, or place near each other.
- Recommendation systems — 'users who did X also did Y'.
- Medical research — finding which symptoms or treatments co-occur.
- Web analytics — which pages are viewed together in the same session.
Common mistakes
- Looking only at confidence and ignoring lift. High confidence on a very common item is meaningless.
- Setting minimum support too low — you end up with millions of rules including a lot of noise.
- Treating correlation as causation. Bread and jam appearing together doesn't mean buying bread causes someone to buy jam.
Notes
- Apriori can be slow on large datasets because of multiple passes over the data. FP-Growth is a faster alternative that avoids candidate generation.
- Association rules are symmetric in discovery but asymmetric in interpretation. The rule bread → jam is different from jam → bread even if support is the same.
In practice
Used in e-commerce for product recommendations and store layout decisions. Also shows up in fraud detection (which transaction patterns appear together) and in clinical data mining (which diagnoses or medications co-occur).
Was this concept helpful?
Related concepts