References:
- Book Introduction to Machine Learning, Second Edition, Ethem Alpaydim, Page 4
- C. to, “method for discovering interesting relations between variables in databases,” Wikipedia.org, Apr. 05, 2004. https://en.wikipedia.org/wiki/Association_rule_learning (accessed Feb. 20, 2026).
Learning Associations
Association Rule Learning is a rule-based method used to discover interesting relations or “hidden patterns” between variables in large databases. It is primarily an unsupervised learning technique because it doesn’t require pre-labeled data; it simply looks for items that frequently occur together.
The most famous application is Market Basket Analysis, which retailers use to understand customer purchasing behavior.
The Anatomy of a Rule
An association rule is typically expressed in the form of an “If-Then” statement:
{Antecedent}⟹{Consequent}
For example: {Bread,Butter}⟹{Milk}
(If a customer buys bread and butter, they are also likely to buy milk.)

Measuring “Interestingness”
Not every pattern found in data is useful. To determine which rules are worth keeping, we use three primary mathematical metrics:
1. Support
This measures how frequently an item set appears in the entire dataset. It helps us filter out rare combinations that might just be coincidences.
$Support(A⟹B)= \frac{\text{Transactions containing both A and B}}{\text{Total Transactions}}$
2. Confidence
This measures how often the “Then” (Consequent) occurs given that the “If” (Antecedent) has already occurred. It represents the reliability of the rule.
$Confidence(A⟹B)=\frac{Support(A∪B)}{Support(A)}$
3. Lift
This is the most critical metric. It measures the strength of the association by comparing the confidence of the rule to the expected frequency of the items occurring by chance.
- Lift > 1: Positive correlation (A and B are likely to be bought together).
- Lift = 1: No association (A and B are independent).
- Lift < 1: Negative correlation (Buying A makes it less likely the customer buys B).

Code Sample:
Link: https://github.com/computingnotes/MachineLearningFundamentals/blob/main/Association_Rule.ipynb
– https://rasbt.github.io/mlxtend/
– https://rasbt.github.io/mlxtend/user_guide/frequent_patterns/apriori/

Association Rule Explorer
| Rule | Support | Conf | Lift |
|---|
Association Rules Lab
Rule: {Bread} → {Milk}
Simulate a Transaction:
Support
Confidence
Lift
Log: (Total: 0)