- Introduced by
- Rakesh Agrawal & Ramakrishnan Srikant
- Year
- 1994
- Type
- Unsupervised pattern discovery algorithm
- Family
- Pattern mining
What does it do?
Association Rule Mining is an unsupervised data-mining technique that discovers co-occurrence patterns among items in transactional datasets.
Agrawal, Imieliński, and Swami formally introduced the problem in 1993, and Agrawal and Srikant's 1994 Apriori algorithm made it practical at scale. It identifies rules of the form X ⇒ Y, meaning that transactions containing itemset X tend to also contain itemset Y, and quantifies them with support, confidence, and lift.
The intuition behind the method
Imagine a supermarket receipt log in which many customers who buy bread and butter also buy milk. That pattern is worth examining. Association Rule Mining works like a careful librarian who goes through every receipt, counts how often item combinations appear together, and keeps the combinations that exceed a minimum frequency. Apriori works level by level: it first counts single items, then pairs, then larger sets, and it only extends sets that are already frequent. Once frequent sets are found, the algorithm asks how reliably the presence of one group of items predicts another item.
History
Agrawal, Imieliński, and Swami (1993) defined the association rule problem using customer transaction data from a large retailing company. Agrawal and Srikant's 1994 VLDB paper introduced the Apriori algorithm and its pruning strategy, which made mining large databases practical. Later algorithms in this family include FP-Growth (Han et al., 2000), which avoids explicit candidate generation, and ECLAT, which works in a vertical data format.
When to use it
Choose Association Rule Mining when you have a large collection of transactions, each recorded as a set of items, and the goal is to find which items co-occur without a predefined target variable. The standard formulation assumes binary presence or absence per item. It fits market basket analysis, recommendation from purchase or browsing histories, and exploratory analysis of co-occurring diagnoses or medications. Do not use it for continuous or ordinal measurements unless they have been discretised first. It is also a poor choice for very wide item spaces, where the candidate space grows combinatorially, and when the question is causal rather than associative. For faster enumeration of frequent itemsets, FP-Growth is the usual alternative; when the order of events matters, sequence mining is more appropriate.
Limitations and considerations
- The candidate space grows exponentially with the number of distinct items, which limits level-wise search on very wide data.
- Support and confidence alone can rank rules that mostly reflect a frequent consequent; lift is needed to check whether X and Y are actually dependent.
- The binary transaction model requires continuous or ordinal variables to be discretised first, and discretisation discards information.
- A single minimum support threshold serves rare and common items poorly: a high value misses rare but valuable rules, while a low value produces many trivial ones.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- No labelled outcome is needed: the method works directly on the item sets recorded in each transaction.
- Rules are if-then statements whose support and confidence can be read directly from the data and checked by hand.
- Apriori's pruning lets the search skip any candidate with an infrequent subset. FP-Growth avoids explicit candidate generation, although it still needs a database pass to build its FP-tree.
- Nothing in the method depends on one domain: the same procedure applies to retail baskets, diagnosis codes, or clickstreams wherever each record is a set of items.
Applications
- Retail: product placement and cross-selling recommendation from point-of-sale transaction logs.
- Healthcare: co-occurrence analysis of diagnoses, procedures, or medications in electronic health records.
- Web analytics: clickstream pattern discovery for page recommendation and navigation optimization.
- Bioinformatics: identification of co-expressed gene sets and protein interaction motifs.
- Cybersecurity: detection of correlated network events indicative of intrusion patterns.
How it works
How it works
The algorithm scans the transaction database D to count how often each itemset X appears. An itemset is declared frequent, and placed in L_k, only when its support (the fraction of transactions containing it) meets or exceeds the user-defined minimum support threshold σ_min. The search starts with single items (k = 1) and builds candidate sets of increasing size from the frequent sets found at the previous level.
Formula
L_k = \{ X \subseteq I \mid |X| = k,\; \text{support}(X) = \frac{|\{t \in D : X \subseteq t\}|}{|D|} \geq \sigma_{\min} \}Support is anti-monotone: every subset of a frequent itemset must itself be frequent. Apriori uses this to discard a candidate k-itemset as soon as any of its (k−1)-subsets is missing from the verified frequent set L_{k−1}, without counting it in the database. This pruning removes candidates that cannot possibly be frequent and is the main reason the level-wise search stays manageable.
Formula
\forall X \in C_k,\; \forall Y \subset X,\; |Y| = k-1 : Y \notin L_{k-1} \Rightarrow X \notin L_kFrom each frequent itemset, the algorithm generates rules X ⇒ Y, where X and Y are disjoint and X ∪ Y is the frequent itemset. A rule is kept only if its confidence, the conditional probability of Y given X computed as support(X ∪ Y) / support(X), meets or exceeds the minimum confidence threshold γ_min. This step turns symmetric co-occurrence counts into directional statements.
Formula
X \Rightarrow Y \text{ where } X \cap Y = \emptyset,\quad \text{confidence}(X \Rightarrow Y) = \frac{\text{support}(X \cup Y)}{\text{support}(X)} \geq \gamma_{\min}Retained rules are ranked and filtered by lift, the ratio of confidence to the support of the consequent Y. In the sample, a lift above 1 means that Y appears with X more often than independence would predict, a value of 1 means the observed co-occurrence matches independence, and a value below 1 means they co-occur less often than expected. A lift above 1 describes the observed data only and does not by itself establish dependence: it can arise from noise, especially when many candidate rules are examined. Check important rules with a suitable significance test or hold-out validation. Other interestingness measures, such as conviction and leverage, can be used alongside lift to refine the rule set.
Formula
\text{lift}(X \Rightarrow Y) = \frac{\text{confidence}(X \Rightarrow Y)}{\text{support}(Y)} = \frac{\text{support}(X \cup Y)}{\text{support}(X) \cdot \text{support}(Y)}Common pitfalls
- Setting minimum support too low floods the analyst with spurious rules; the threshold should be chosen with domain knowledge or checked on held-out data.
- Confusing statistical association with causation: a high lift shows that X and Y co-occur more than independence would predict in the sample, but does not show that X causes Y.
- Reading lift above 1 as proven dependence: with many candidate rules tested, some will show high lift by chance, so validate key rules with a significance test or hold-out data.
- Ignoring the item frequency distribution: very common items dominate the rule set and can crowd out meaningful associations among rare items.
- Treating confidence as the only quality measure: a rule with high confidence but lift close to 1 may be no more informative than the base rate of Y.
Frequently asked questions
What is the difference between support, confidence, and lift?
Support measures how frequently an itemset appears in the dataset as a whole. Confidence measures the conditional probability of the consequent given the antecedent. Lift divides confidence by the consequent's support, showing whether the co-occurrence exceeds what independence would predict. All three are needed together, because each one can mislead on its own.
How does the Apriori algorithm reduce computational cost?
Apriori exploits the anti-monotonicity of support: if an itemset is infrequent, all of its supersets are also infrequent. Any candidate with an infrequent subset is discarded before it is counted, so far fewer candidates need to be checked against the database than in brute-force enumeration.
When should I use FP-Growth instead of Apriori?
FP-Growth is often preferred when the dataset is large and the minimum support threshold is low. It compresses the transactions into an FP-tree and mines frequent itemsets from that structure without generating explicit candidates. It still requires a database pass to build the tree, but it avoids the level-by-level candidate counting that Apriori performs, which is where its speed advantage usually comes from.
Related methods
Sources
Agrawal, R., Imieliński, T., & Swami, A. (1993). Mining association rules between sets of items in large databases. ACM SIGMOD, 207–216.
Open DOI referenceAgrawal, R., & Srikant, R. (1994). Fast algorithms for mining association rules. Proceedings of the 20th VLDB Conference, 487–499.
Open publication reference