← Lessons

quiz vs the machine

Platinum1820

Machine Learning

Market Basket Analysis

Applying itemset mining to retail baskets to drive real decisions.

4 min read · advanced · beat Platinum to climb

Market Basket Analysis

Market basket analysis applies association rule mining to retail transactions. Each basket is the set of items a customer bought together, and the goal is to learn which products co occur and what to do about it.

From baskets to rules

The pipeline reuses the unsupervised tools from itemset mining.

  • Treat each receipt as a transaction of items.
  • Use apriori or FP growth to find frequent itemsets.
  • Convert them into rules scored by support, confidence, and lift.

A classic example is discovering that bread and butter appear together far more than chance, giving a lift well above one.

Turning patterns into action

The value is in the decisions the rules suggest.

  • Cross selling: recommend Y to customers who bought X.
  • Store layout: place associated items near each other, or far apart to widen the path.
  • Promotions: discount one item to lift sales of its partner.

Pitfalls to avoid

  • A rule may reflect a popular item rather than a real link, so always check lift, not just confidence.
  • Correlation in baskets is not causation, so test promotions rather than assuming the rule will hold.
  • Very low support rules can be noise and should be treated with caution.

Key idea

Market basket analysis mines co occurring products from baskets and turns high lift rules into cross selling, layout, and promotion decisions you should test.

Check yourself

Answer to earn rating on the learn ladder.

1. What is a transaction in market basket analysis?

2. Which is a sound action from a high lift rule?

3. Why check lift rather than only confidence in baskets?