Dar Lec 15 Association Rules
Dar Lec 15 Association Rules
• Support:
• Definition: Measures how frequently an itemset
appears in the dataset.
• Formula:
Support=Number of transactions containing both ante
cedent and consequent/Total number of transactions
• Example:
If bread and butter appear together in 40 out of 1,000
transactions:
• {Support} = {40}/{1000} = 0.04 (4% of transactions)}
• Confidence:
• Definition: Measures how often the rule is true when the
antecedent occurs.
• Formula:
Confidence=Number of transactions containing both anteceden
t and consequent/
Number of transactions containing antecedent
• Example:
If 50 transactions contain bread, and 40 of these also contain
butter:
• {Confidence} = {40}{50} = 0.8 {(80% confidence)} This means
80% of the time, customers who buy bread also buy butter.
• Lift:
• Definition: Measures how much more likely the antecedent
and consequent occur together compared to if they were
independent.
• Formula: Lift=Confidence/Support of consequent
• Example:
If butter appears in 100 out of 1,000 transactions:
Support of butter=100/1000=0.1
• Using the previous confidence (0.8): Lift=0.80/0.1=8
• A lift of 8 means that customers buying bread are 8 times
more likely to buy butter compared to random chance.
• Lift > 1: This indicates that the antecedent and consequent
are positively associated—the occurrence of the
antecedent makes the consequent more likely to occur
than by random chance.
• Lift = 1: This indicates no association—the antecedent and
consequent occur together as frequently as they would if
they were independent.
• Lift < 1: This indicates a negative association—the
occurrence of the antecedent makes the consequent less
likely to occur than by random chance.
• Example:
Transaction ID Items Bought
1 Bread, Butter, Milk
2 Bread, Butter
3 Bread, Milk
4 Butter, Milk
5 Bread, Butter, EGGS
Rule:
If {Bread} → {Butter}
Support: Bread and Butter appear together in 3 out of 5
transactions. Support=3/5=0.6 (60%)
Confidence: Bread appears in 4 transactions, and 3 of those
include Butter. Confidence=3/4=0.75 (75%)
Lift: Butter appears in 4 out of 5 transactions.
Lift=0.75/0.8*=0.9375
A lift less than 1 suggests the items are less likely to be associated
than by chance.
*Support of consequent is how frequently Butter appears in the
dataset, regardless of whether Bread is purchased or not. In this case,
if Butter appears in 4 transactions out of 5,
the Support of Butter is:
Support of Butter=4/5=0.8
Metric Meaning Interpretation
The likelihood of the consequent occurring Higher confidence means the rule is more
Confidence
when the antecedent is present. reliable.