- Introduced by
- Agrawal, R., Imielinski, T., & Swami, A.
- Year
- 1993
- Type
- Unsupervised pattern discovery
- Family
- Machine learning
What does it do?
Association rule learning is an unsupervised method for finding co-occurrence patterns, expressed as 'if X then Y' implications, in transactional or binary-coded data.
Agrawal, Imielinski, and Swami (1993) introduced it for retail sales data, where the aim was to find combinations of items bought together. The same approach is now applied to recommendation, clinical, bioinformatic, and behavioural datasets wherever records can be represented as sets of items.
The intuition behind the method
Picture a large set of shopping baskets and the question of which products tend to appear in the same basket. Association rule mining answers this by counting how often a set of items occurs together (support), how often Y appears among baskets that already contain X (confidence), and whether that co-occurrence exceeds what independence would predict (lift). A rule with high confidence but lift near 1 mostly reflects a very common consequent, so lift is what separates a non-trivial pattern from a frequent one. Because no outcome variable is specified, the output is a set of candidate patterns to examine, not a verified relationship.
History
Agrawal, Imielinski, and Swami introduced association rule learning in 1993. Their paper presented an algorithm for generating all significant association rules in large databases of customer transactions and reported results on sales data from a large retailing company. The Apriori algorithm, which uses the principle that subsets of frequent itemsets are themselves frequent to limit the search, followed as the standard pruning-based approach. Subsequent work has proposed alternative algorithms that reduce the cost of the search.
When to use it
Choose association rules when the question is exploratory: which items, codes, or behaviours co-occur in records that are already binary or can be meaningfully binned, such as purchase baskets, co-diagnoses, clickstreams, or questionnaire items. No outcome label is needed, so the method suits hypothesis generation. Do not use it when a specific outcome is to be predicted, since a supervised model optimises for that outcome directly. Avoid it when variables are continuous and no defensible discretisation exists, when the sample is small so that rare itemsets have unstable support, or when the rules will be read as causal effects, because they describe co-occurrence only.
Limitations and considerations
- Requires transactional or binary-coded data; continuous variables must be binned, and the analyst's bin boundaries change the rules obtained.
- Rule counts can be very large, so filtering and ranking by lift or another interestingness measure is needed before interpretation.
- Minimum support and confidence are set by the analyst, and the resulting rule set depends on these choices.
- Support, confidence, and lift describe co-occurrence in the observed records; they do not separate direct association from shared causes or sampling artefacts.
- Search cost rises with the number and size of frequent itemsets, so dense data with many common items can be slow even with Apriori-style pruning.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Unsupervised: no outcome variable is needed, so it can be run on records without a predefined target.
- Readable output: each rule is an IF–THEN statement reported with its support, confidence, and lift.
- The Apriori principle prunes the search, so frequent itemsets can be enumerated in catalogues too large for exhaustive counting.
- Applies to any data that can be encoded as item sets, including purchases, diagnoses, and survey items.
- Useful for hypothesis generation: unexpected co-occurrences can be tested in a separate, confirmatory study.
Applications
- Market basket analysis: identifying which products are frequently purchased together to guide product placement and promotions.
- E-commerce recommendation: generating 'customers who bought X also bought Y' suggestions.
- Clinical co-morbidity discovery: finding sets of diagnoses, medications, or symptoms that co-occur in patient records.
- Bioinformatics: detecting co-expressed genes or co-occurring genetic variants across samples.
- Web usage mining: uncovering common clickstream patterns and navigation sequences on websites.
- Survey and behavioral research: finding sets of questionnaire items or behaviors that co-occur across respondents.
How it works
How it works
Each transaction (for example, one shopping basket or one patient record) becomes a row, and each possible item becomes a column holding 1 if the item is present and 0 otherwise. The resulting matrix is typically wide and sparse. Quantitative variables must be discretised into categories before this step, and the choice of categories affects which rules can be found.
The method enumerates item combinations whose support, the share of transactions containing the whole set, meets the user-chosen minimum support. The Apriori principle, that every subset of a frequent itemset must also be frequent, lets the search discard large parts of the candidate space without counting them, which is what makes enumeration feasible on large catalogues.
Formula
\text{support}(X) = \frac{|\{t \in T : X \subseteq t\}|}{|T|} \geq \text{min\_sup}Each frequent itemset is split into every pair of disjoint, non-empty sets X and Y, giving candidate rules X ⇒ Y. The number of splits grows rapidly with itemset size, so most candidates must be removed by the next filtering step.
Formula
X \Rightarrow Y, \quad X \cap Y = \emptyset
Each candidate is scored by its confidence, the proportion of transactions containing Y among those containing X. Rules below the minimum confidence are discarded. Confidence alone does not account for how common Y is overall, so retained rules still need the lift check in the next step.
Formula
\text{confidence}(X \Rightarrow Y) = \frac{\text{support}(X \cup Y)}{\text{support}(X)} \geq \text{min\_conf}Retained rules are ranked by lift, the ratio of observed joint support to the support expected under independence. Lift greater than 1 signals positive association; lift near 1 indicates co-occurrence no greater than chance; lift below 1 indicates negative association. Sorting by lift brings the non-trivial rules to the top. Other interestingness measures, such as leverage and conviction, are also used and are computed from the same support counts.
Formula
\text{lift}(X \Rightarrow Y) = \frac{\text{support}(X \cup Y)}{\text{support}(X) \cdot \text{support}(Y)}Common pitfalls
- Setting minimum support too low, which admits many rules supported by only a handful of transactions that are unlikely to generalise.
- Ranking by confidence alone: a rule whose consequent is very common will show high confidence without any real association, and lift reveals this.
- Reading a rule as causal. Items that co-occur in baskets may share a driver, such as a promotion or a season, rather than one prompting the other.
- Applying the method to continuous measurements without a justified discretisation, so that the rules reflect arbitrary bin edges.
- Reporting only the highlighted rules from thousands generated. Selecting after many comparisons inflates apparent strength, so the full candidate set should inform judgement about the findings.
Frequently asked questions
How do I choose the minimum support and confidence thresholds?
There is no universal setting. Begin by inspecting how often individual items occur, then set minimum support low enough to retain patterns of interest but high enough that itemsets appear in a meaningful number of transactions. Minimum confidence is usually chosen with domain knowledge, and lift-based ranking should guide the final selection.
What is the difference between confidence and lift, and which should I prioritize?
Confidence measures how often Y follows X among transactions containing X, but it ignores the base rate of Y. Lift corrects for this by dividing confidence by the marginal support of Y. A rule with high confidence but lift near 1 adds little information beyond knowing Y is common. Prioritize lift when filtering for genuinely non-trivial associations.
Can association rules be used for prediction?
They are primarily descriptive and exploratory rather than predictive. While it is possible to use rules with a fixed consequent (a single target item) for classification — a technique called associative classification — standard association rule mining does not optimize a predictive loss function and should not replace supervised models when a labeled outcome is available.
My dataset has continuous variables. Can I still use association rules?
Only after discretization. Continuous variables must be binned into categorical intervals (e.g., age groups, quintiles) before encoding as binary items. The choice of bin boundaries substantially affects which rules emerge, so discretization decisions should be theoretically motivated and reported transparently.
How do association rules differ from correlation analysis?
Correlation (e.g., Pearson's r) measures the linear relationship between two continuous variables. Association rules discover co-occurrence patterns among sets of binary items — any combination size — in transactional data. The metrics (support, confidence, lift) are frequency-based rather than moment-based, and the output is a set of human-readable IF–THEN rules rather than a single numeric coefficient.
Related methods
Sources
Agrawal, R., Imielinski, T., & Swami, A. (1993). Mining association rules between sets of items in large databases. Proceedings of the 1993 ACM SIGMOD International Conference on Management of Data, 207–216.
Open DOI referenceTan, P.-N., Steinbach, M., Karpatne, A., & Kumar, V. (2018). Introduction to Data Mining (2nd ed., Ch. 5). Pearson.
ISBN: 978-0-13-312890-12018_Book_DataScienceAndPredictiveAnalyt, Ch. 12 "Apriori Association Rules Learning", p. 448