How Association Rules Are Discovered: Concepts, Scale, Measures, and the Apriori Approach
Association rule discovery is a method for identifying meaningful co-occurrence patterns in transaction data. The goal is to find rules that state: when a particular set of items appears in a transaction, another set of items tends to appear as well, with a quantifiable level of confidence. Importantly, these rules should be interpreted as associations, not as evidence of direct causation.
Core Terminology: k-Itemsets
An $k$-itemset is a collection of distinct items selected from the universal set of items, where . Formally, a -itemset is a subset of the universal set.
Empty itemsets are excluded by design, so .
Although an $m$-itemset (containing every item in the universal set) is mathematically valid, it is not practically interesting in typical market-basket settings. If a transaction contains all items, then every item appears regardless of what is already in the basket, which provides no useful insight about conditional co-occurrence.
How Many Itemsets Exist?
Assume the universal set contains unique items.
For a given , the number of possible -itemsets is the binomial coefficient:
Across all valid sizes through , the total number of non-empty itemsets is:
Using the binomial theorem,
so the total number of non-empty itemsets is:
How Many Association Rules Exist?
Since each association rule partitions items into an antecedent and a consequent, the number of possible rules grows even faster than the number of itemsets.
Given that the total number of possible non-empty itemsets is , the total number of possible association rules can be expressed (as reported by Tan, Steinbach, and Kumar, 2006, Introduction to Data Mining) as:
The factorial identity underlies the binomial coefficient .
A numerical perspective makes the growth concrete. Even with items, the number of possible itemsets is , and the number of possible association rules is . This scale explains why brute-force enumeration becomes infeasible.
What an Association Rule Means
An association rule is commonly described as follows:
If a transaction already contains a particular set of item(s), then with a confidence level of , where , another specific set of item(s) may also be part of that transaction.
This statement is intended to capture co-occurrence tendency, not a cause-and-effect relationship. The correct interpretation is that the rule represents a statistical association between two or more items.
Antecedent and Consequent Itemsets
Association rules are conventionally written as:
Here:
- is the Antecedent itemset.
- is the Consequent itemset.
The two itemsets must be disjoint, meaning they share no common items.
There is no restriction on the number of items in either itemset. However, neither nor can be an empty itemset, and neither can be an -itemset.
Concrete Examples of Association Rules
One rule can be expressed as: 80% of shoppers who buy ice cream also purchase ice cream cones.
In this rule, the antecedent is the 1-itemset , and the consequent is the 1-itemset .
Another rule can be expressed as: 60% of students who completed Machine Learning and Data Mining will register for Deep Learning in the next quarter.
In this rule, the antecedent is the 2-itemset , and the consequent is the 1-itemset .
Measuring Association Rules
Association rules are evaluated using multiple metrics, including Support, Confidence, Lift, Leverage, Expected Confidence, and Zhang’s Metric. These measures quantify how frequently itemsets occur, how strongly the consequent is linked to the antecedent, and how surprising or useful the rule is compared to baseline expectations.
Support of an Itemset
Support measures the occurrence likelihood of an itemset .
Let:
- be the total number of transactions,
- be the number of transactions in which itemset appears.
Then , and since empty itemsets are not allowed, .
Support is defined as:
The lowest possible support is , and the highest possible support is . Support is often reported as a percentage.
Support of a Rule
A rule combines the antecedent and the consequent . The support of the rule is defined as the support of the union itemset :
This is the proportion of all transactions in which both and appear together.
Operationally, one can first locate the transactions containing , then count how many of those transactions also contain . The joint occurrence can range from none of the transactions to all of them.
This implies the bound:
Confidence of a Rule
Confidence measures how likely the consequent itemset will appear in a transaction where the antecedent itemset has already appeared.
Confidence is defined as:
Therefore:
Confidence is often used as a proxy for the “credibility” of a rule, in the sense of how consistently the consequent follows the antecedent in the observed data.
Expected Confidence
Expected confidence is the baseline likelihood that the consequent occurs, regardless of . Numerically, expected confidence equals the support of the consequent itemset:
This baseline is essential because the goal of an association rule is to reveal whether observing changes the probability of observing , either upward or downward.
Lift
Lift compares the observed confidence of the rule to the baseline likelihood of . It is defined as the ratio of confidence to expected confidence:
Interpretation follows three standard cases:
- Lift = 1 means the rule is not informative: occurs regardless of whether occurs.
- Lift < 1 means the rule indicates a credible negative association: the presence of reduces the likelihood of .
- Lift > 1 means the rule indicates a credible positive association: the presence of increases the likelihood of .
Theoretical Upper Bound on Lift
To maximize a ratio , one can increase and decrease .
The highest possible lift can be achieved in theory by maximizing to while minimizing to . Under that extreme configuration, the theoretical maximum lift becomes:
In practice, lift rarely approaches .
Leverage
Leverage measures the effectiveness of bundling the antecedent and consequent items by comparing observed joint occurrence with what would be expected under independence:
It can also be expressed using lift:
Interpretation:
- Leverage = 0 means bundling does not affect sales of the consequent.
- Leverage < 0 means bundling decreases sales of the consequent.
- Leverage > 0 means bundling increases sales of the consequent.
Zhang’s Metric
Zhang’s metric extends lift and is mainly used to measure dis-association between the antecedent and consequent.
It is defined as:
Its values lie between and . Positive values indicate association, while negative values indicate disassociation.
Because the numerator equals leverage, Zhang’s metric can be viewed as leverage rescaled to the closed interval .
Why a Smarter Search Algorithm Is Necessary
Brute-force discovery—explicitly listing every possible association rule—is inefficient and infeasible unless is very small. The search space is too large, and memory and runtime constraints become prohibitive.
A smarter approach is needed because:
- It is not realistic to review all items in all rules.
- Rules with higher support and/or confidence typically have greater practical impact.
- Rules with high lift are especially valuable because they produce “surprising” associations relative to baseline expectations.
The Apriori Algorithm: Restricting the Search Space
The Apriori algorithm constrains the search for association rules by:
- Discovering frequent itemsets, and
- Examining only rules that are formed from frequent itemsets.
This approach is typically summarized as two major steps: identifying frequent itemsets and then generating and filtering rules from them.
Step 1: Identify Frequent Itemsets
A frequent itemset is any itemset whose support is greater than or equal to a user-specified minimum support threshold.
The algorithm begins by identifying frequent 1-itemsets (individual items that meet the support threshold). Next, it forms candidate 2-itemsets by adding an additional item to frequent 1-itemsets, and then checks which of those 2-itemsets are frequent. The process continues by increasing itemset length until no more frequent itemsets are found.
Step 2: Generate and Filter Rules from Frequent Itemsets
For each frequent itemset with length , all observable rules that can be formed from are generated.
For each generated rule, an evaluation measure (such as confidence) is computed. Rules are then retained only if their evaluation measure exceeds a user-specified threshold.
Technical References for the Apriori Family of Methods
The foundational work was proposed by Agrawal, Imielinski, and Swami in 1993 in the paper:
- “Mining Association Rules between Sets of Items in Large Databases,” Proceedings of the 1993 ACM SIGMOD Conference, Washington DC, May 1993.
(ACM SIGMOD stands for the Association for Computing Machinery Special Interest Group on Management of Data.)
The Apriori algorithm itself was developed further in the Agrawal and Srikant 1994 paper:
- “Fast Algorithms for Mining Association Rules,” Proceedings of the 20th VLDB Conference, Santiago, Chile, 1994.
(VLDB stands for Very Large Data Bases.)
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
