Lift Ratio

Confidence alone can be misleading when evaluating an association rule - it doesn't account for how popular the consequent item already is on its own. That's where the Lift Ratio comes in.

The Formula

Lift(A -> B) = Confidence(A -> B) / Support(B)

Lift compares the observed co-occurrence of A and B against what you'd expect if A and B were purchased completely independently of each other.

Interpreting Lift

Lift ValueMeaning
Lift = 1A and B are independent - no real association
Lift > 1A and B occur together more often than expected - positive association
Lift < 1A and B occur together less often than expected - negative association

Why Lift Matters

A rule can have high confidence simply because the consequent item is bought by almost everyone, regardless of the antecedent. Lift corrects for this by measuring the actual strength of the relationship rather than just how often the pattern shows up.

Implementing in Python

from mlxtend.frequent_patterns import apriori, association_rules

frequent_itemsets = apriori(df, min_support=0.2, use_colnames=True)
rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1.0)

print(rules[["antecedents", "consequents", "confidence", "lift"]])
When mining association rules in practice, it's best to filter on both confidence and lift together - confidence tells you how reliable the rule is, while lift tells you whether that reliability is actually meaningful.

Coming Up Next

This wraps up Clustering, Dimensionality Reduction and Market Basket Analysis - rounding out the unsupervised learning portion of the course. Next, the course moves into Deep Learning, starting with the Perceptron, the simplest building block of a neural network.

Ready to Master Data Science?

Join Uncodemy's Data Science Course and build real, job-ready skills with expert mentors.

Explore Course