Market basket analysis: a simple way to personalize offers

Market basket analysis is one of the simplest ways to personalize offers for every customer at once. This post explains how it works, walks through a small example with real arithmetic, and shows where it fits among other ways to recommend products.
Where it fits among recommendation methods
Here’s how I generally rank the common ways to recommend products, from least to most complex. Performance usually rises with complexity too.
- Random: show any product.
- Trending: show products with a recent spike in activity.
- Popular: show the most popular products over a longer period.
- Market basket analysis: useful when shoppers buy several products at once.
- Collaborative filtering: powerful when you have a lot of data on what people like you bought.
- Factorization machines: very powerful when you have customer and product details as well as purchase history.
Simple often wins, and market basket analysis is only a little more complex than recommending the most popular products.
How it works
Market basket analysis finds combinations of products that are often bought together. These combinations are called association rules. Picture a grocery store where a shopper buys cereal and bananas. Market basket analysis might suggest milk, because milk often showed up in the same baskets in the past.
Sometimes the combinations are surprising. In a well-known story, an analysis of Osco Drug sales in 1992 found that between 5 and 7 p.m., shoppers bought beer and diapers together. You can read the story in association rule learning. Were tired new parents stocking up for a long night? Maybe it’s a coincidence. Either way, it shows how unexpected rules can come out of everyday data.
The process of finding these rules is called association rule mining. Its results are easy to understand once you know three measures.
A worked example
Imagine a store with 100 customers:
- 15 bought cereal,
- 9 bought milk,
- 7 bought both.
We want to know whether to recommend milk to people who buy cereal. The rule is: bought cereal, so recommend milk.
Support is how often the items appear together across all baskets.
Support = 7 of 100 customers = 7%.
Confidence is the share of cereal buyers who also bought milk.
Confidence = 7 of 15 cereal buyers = 46.7%.
Lift compares that confidence with how often people buy milk anyway.
Lift = 46.7% confidence ÷ 9% of all customers who bought milk = 5.2.
A lift below one means the rule predicts a purchase worse than chance, no matter how high its support and confidence. A lift above one points to a real cross-selling opportunity. With a lift of 5.2 in this example, cereal buyers are about five times as likely as the average customer to buy milk, so we’d definitely recommend milk to anyone with cereal in their cart.
Why shoppers and store owners both like it
This is a very simple example, but it shows the idea. Think of market basket analysis as the “save me a trip” recommender. Have you ever bought a gadget and realized you forgot the batteries? Or bought most of the ingredients for a recipe and had to go back for the one thing you missed? Market basket analysis solves exactly that.
For the store owner, it’s the last recommendation before checkout. It looks at what’s in the cart, suggests what’s missing, and raises the order value while helping the customer avoid a second trip.
If you sell more than one product per order, this is a quick and clear place to start. For the next steps up in personalization, read how popularity can kill personalization. We’ve built customer and product analytics for consumer brands for years, including the analytics platform we run for seven consumer brands.