intermediatedata-mining

Association Rules

People who buy X also tend to buy Y. Finding those patterns automatically.

Key Points

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

The beer and diapers story is the famous one — supermarket analysis supposedly found that men buying diapers on Friday evenings also tended to buy beer, so the store moved them closer together. True or not, it captures the idea: you're looking for combinations that show up together more often than you'd expect by chance. Lift is the key number. If 60% of all customers buy milk anyway, finding that 62% of customers who bought cereal also bought milk isn't interesting — the lift is barely above 1. But if 80% of customers who bought espresso also bought a specific flavored syrup, and that syrup is normally in only 10% of baskets, that lift of 8 is a real pattern worth acting on.

Formulas

Support

Support(X⇒Y)=∣X∪Y∣∣Transactions∣\text{Support}(X \Rightarrow Y) = \frac{|X \cup Y|}{|\text{Transactions}|}
  • |X \cup Y| — Number of transactions containing both X and Y
  • |\text{Transactions}| — Total number of transactions

Confidence

Confidence(X⇒Y)=Support(X∪Y)Support(X)\text{Confidence}(X \Rightarrow Y) = \frac{\text{Support}(X \cup Y)}{\text{Support}(X)}
  • \text{Support}(X \cup Y) — Fraction of transactions with both X and Y
  • \text{Support}(X) — Fraction of transactions with X

Lift

Lift(X⇒Y)=Confidence(X⇒Y)Support(Y)\text{Lift}(X \Rightarrow Y) = \frac{\text{Confidence}(X \Rightarrow Y)}{\text{Support}(Y)}
  • \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

Common mistakes

Notes

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?

Spot an error or gap? Suggest an edit →

Related concepts

anomaly-detectionclustering-overviewtext-mining
Chirp at me!