Market Basket Analysis

Table of Contents

Market Basket Analysis helps retailers and analytics teams uncover which products customers buy together, so they can drive cross-sell, optimize layouts, and lift average order value.

If you have ever seen “frequently bought together” on Amazon, picked up batteries placed right next to remote controls, or received a coupon for shampoo a week after buying conditioner, you have already seen Market Basket Analysis at work. It is one of the oldest and most reliable techniques in retail analytics, and it has quietly become a core tool in e-commerce, BFSI cross-sell, and CPG category management.

This guide covers what Market Basket Analysis is, how it works, the metrics behind it, the algorithms that power it, and the practical steps to run one for your business.

What Is Market Basket Analysis?

Market Basket Analysis is a data mining technique that examines customer transactions to identify products frequently purchased together, helping businesses understand buying patterns and create rules that drive cross-sell, bundling, and store-layout decisions.

The “basket” in the name comes from a literal grocery basket. Every time a customer checks out, the items in their basket form a record of products bought together. Run that across millions of baskets and patterns appear: customers who buy pasta usually buy tomato sauce, customers who buy a smartphone often add a case and a screen protector, customers who buy diapers tend to buy wipes.

Market Basket Analysis turns those patterns into association rules of the form “if a customer buys A, they are likely to buy B.” Retailers and analytics teams then use those rules to recommend products, design bundles, plan store layouts, and target promotions. Although it started in physical retail, the same approach now runs across e-commerce sites, banking cross-sell programs, telecom plan upgrades, and even healthcare prescription patterns.

Why Market Basket Analysis Matters for Retail

Market Basket Analysis is a data mining technique that identifies patterns in consumer transactions and reveals which items are frequently bought together, helping retailers and e-commerce brands raise average order value, refine bundling, sharpen store and website layouts, and forecast inventory more accurately.

For retail and e-commerce, the value shows up in four areas.

Higher average order value – When the website or the store gently nudges customers toward a complementary item, baskets get bigger. Even a small uplift across millions of orders moves the top line.

Better product bundling – Bundles built on what customers actually buy together outperform bundles based on instinct. Market Basket Analysis points to the combinations that have a track record of working.

Smarter store and website layout – Placing associated products near each other in a store, or surfacing them on a product page, reduces friction and helps customers find what they came in for plus a little more.

Stronger inventory and demand forecasting – Knowing which products drive demand for others lets category managers stock complementary items together, plan promotions in pairs, and reduce stockouts on the supporting SKU when the lead SKU sells well.

How Does Market Basket Analysis Work?

Market Basket Analysis works by collecting transaction data, finding sets of items that appear together often, calculating the strength of each pattern using support, confidence, and lift, and turning the strongest patterns into business rules.

The process moves through four stages.

  1. Collect transaction data: Each transaction is a list of items bought together. The dataset is usually one row per transaction with the items as columns or as a list, sourced from POS systems, e-commerce orders, or loyalty data.
  2. Find frequent itemsets: An algorithm scans the transactions and identifies combinations of items that appear together more often than a chosen minimum threshold (called minimum support). This is where Apriori, FP-Growth, or Eclat comes in.
  3. Generate association rules: From frequent itemsets, the algorithm builds rules in the form “if A, then B.” Each rule is scored using support, confidence, and lift to measure how reliable and useful it is.
  4. Act on the rules: Strong rules feed into recommendations on product pages, bundle promotions, cross-sell offers at checkout, planogram changes in stores, and targeted marketing campaigns.

The output of Market Basket Analysis is a set of rules about products that any team in the business can read, debate, and apply.

Key Metrics in Market Basket Analysis: Support, Confidence, Lift

The three core metrics in Market Basket Analysis are support (how often the items appear together), confidence (how often the rule holds), and lift (how much more likely the items are to appear together than by chance).

Every association rule is scored against these three numbers. The easiest way to see how they work is with a small example.

Setup. A grocery store runs 100 transactions. 10 customers buy milk, 8 customers buy butter, and 6 customers buy both.

Support

Support is the share of all transactions that contain a given itemset.

Support( Milk and Butter) = 6 / 100 = 6%

So 6% of all baskets include both items. Support filters out rare combinations: a rule that holds in only 0.001% of transactions may be statistically interesting but not commercially useful.

Confidence

Confidence measures how often the rule “if A, then B” is true when A is in the basket.

Confidence (Milk → Butter) = 6 / 10 = 60%

So 60% of customers who buy milk also buy butter. High confidence means the rule is reliable, but on its own it can be misleading. If butter were already in 80% of all baskets, a 60% confidence on the rule would actually be weaker than it looks.

Lift

Lift compares the actual co-occurrence of A and B against what would be expected if the two were independent.

Probability (Butter) across all baskets = 8 / 100 = 8% Lift(Milk → Butter) = Confidence / Probability (Butter) = 60% / 8% = 7.5

A lift of 7.5 means a customer who buys milk is 7.5 times more likely to buy butter than a random customer is. A lift of 1.0 would mean no association, and a lift below 1.0 would mean the two are bought together less often than chance. This is why merchandisers and analysts pay most attention to lift: it filters out cases where high confidence simply reflects a popular item.

Algorithms Used in Market Basket Analysis

The most common algorithms used in Market Basket Analysis are Apriori for finding frequent itemsets, FP-Growth for faster pattern mining without candidate generation, and Eclat which uses a vertical data format for efficient memory use.

Apriori: The classic Market Basket Analysis algorithm. It works by finding frequent itemsets one size at a time and using the rule that any subset of a frequent itemset must also be frequent to prune unlikely candidates early. Apriori is easy to teach and explain, but it can be slow on very large datasets because it scans the data multiple times.

FP-Growth (Frequent Pattern Growth): Builds a compressed tree structure (the FP-tree) from the data and mines frequent itemsets directly from the tree, skipping the candidate-generation step that slows Apriori down. It usually runs much faster on large transaction datasets and is the default in most modern Market Basket Analysis libraries.

Eclat: Uses a depth-first search and a vertical data format that stores, for each item, the list of transactions in which it appears. This layout makes Eclat memory-efficient and a strong choice when transactions are short or when datasets are too sparse for Apriori to handle well.

For most teams, FP-Growth is the default starting point in production. Apriori is the easiest to teach. Eclat earns its place when memory and dataset shape make it the right fit.

Types of Market Basket Analysis

The three main types of Market Basket Analysis are Descriptive (what items are bought together), Predictive (what items will be bought next), and Differential (how product associations differ across customer groups, regions, or seasons).

Descriptive Market Basket Analysis is the classic version. It looks back at historical transactions and produces association rules that describe what customers actually bought together. Most retail and e-commerce use cases start here.

Predictive Market Basket Analysis goes one step further by forecasting the next likely purchase based on the current basket and prior history. It combines basket patterns with sequence and time data to power features like “you may also need” prompts.

Differential Market Basket Analysis compares association patterns across segments: one store vs another, one region vs another, weekdays vs weekends, loyalty members vs walk-in customers. The differences between groups often reveal more useful insight than the patterns themselves.

Market Basket Analysis vs Affinity Analysis vs Recommendation Systems

Market Basket Analysis finds products bought together in the same transaction, affinity analysis studies broader customer-product relationships, and recommendation systems use models to predict the next item for an individual customer.

Market Basket Analysis focuses on the basket itself, generating association rules between items based on transaction-level co-occurrence.

Affinity Analysis widens the lens to look at how customers and product groups relate over time, often used to design segments and targeted marketing.

Recommendation Systems are personalized models that score and rank items for each individual user, usually built with collaborative filtering, content-based methods, or deep learning.

 

Aspect

Market Basket Analysis

Affinity Analysis

Recommendation Systems

Unit of analysis

A single transaction (basket)

A customer’s full set of behaviors

A customer’s profile and history

Output

Association rules between items

Affinities between customers and products or product groups

Personalized item ranking for each user

Data needed

Transaction-level item lists

Customer-level behavior over time

User-item interactions, often with metadata

Common methods

Apriori, FP-Growth, Eclat

Clustering, RFM, segmentation

Collaborative filtering, content-based filtering, deep learning

Best for

Cross-sell, bundling, store layout

Targeted marketing, segment design

One-to-one personalization on digital surfaces

Output is read by

Merchandisers, category managers

Marketing and CRM teams

Real-time site and app personalization engines

 

In modern retail, all three usually run together. Market Basket Analysis is often the first layer, with affinity analysis and recommendation systems built on top.

Real-World Examples of Market Basket Analysis

Real-world Market Basket Analysis examples include Amazon’s “frequently bought together,” Walmart’s seasonal product placements, supermarket bundle promotions, fashion outfit cross-sells, and BFSI product cross-sell programs.

Amazon “frequently bought together” – The classic e-commerce application. Smartphone product pages surface phone cases and screen protectors, camera pages surface memory cards and lens kits, all driven by basket co-occurrence patterns.

Walmart seasonal cross-merchandising – Walmart uses Market Basket Analysis to design seasonal campaigns, like pairing grills with charcoal and barbecue sauce in summer, or hot chocolate with marshmallows in winter, often placing them physically together in stores.

Supermarket bundle pricing – Grocers use rules like “pasta and tomato sauce” to design “meal deal” bundles that lift average order value while moving slower-selling SKUs alongside fast movers.

Fashion outfit cross-sells – Apparel retailers like Zara and ASOS surface “complete the look” suggestions on product pages, where shirts pair with ties and dresses pair with jackets, all based on basket patterns from past buyers.

BFSI cross-sell programs – A bank notices that customers who open a savings account in a specific income bracket frequently take out a credit card within 60 days. That insight drives proactive cross-sell journeys with much higher response rates than untargeted offers.

Coffee shop add-on patternsA QSR chain finds that customers who order a specific iced coffee in the afternoon often add a particular pastry. The chain reorders the digital menu, repositions the pastry at the counter, and redesigns the combo offer, lifting attach rate on that specific pairing.

Business Benefits of Market Basket Analysis

Market Basket Analysis delivers higher average order value, smarter cross-sell, optimized store layouts, better inventory and supply planning, and more effective personalization.

Higher Average Order Value

Cross-sell and bundle recommendations driven by Market Basket Analysis directly add items to the basket. Even modest uplift on average order value compounds quickly across millions of transactions.

Smarter Cross-Sell and Upsell

Rather than guessing what to offer, teams use rules grounded in actual buying behavior. Recommendations land more often, and customers see relevant suggestions instead of generic ones.

Optimized Store Layouts and Planograms

In physical retail, placing strongly associated products near each other reduces friction for customers and increases impulse purchases. Planogram decisions become evidence-based rather than intuition-led.

Inventory and Supply Chain Planning

Knowing which items drive demand for others helps category managers stock complementary products together and forecast demand at the bundle level rather than the SKU level.

More Effective Personalization

Marketing teams use basket rules to build segments and triggers. A customer who bought a printer last week becomes a natural target for an ink-cartridge offer next month, with timing tuned to typical replenishment cycles.

Limitations and Challenges of Market Basket Analysis

Market Basket Analysis has limits: it can produce too many trivial rules, struggles on sparse or low-frequency data, treats baskets statically without time, and needs careful tuning to keep rules commercially useful.

A few challenges show up in almost every Market Basket Analysis program.

  • Rule explosion: With thousands of SKUs, the number of possible rules quickly runs into millions. Most are statistically valid but commercially useless. Without thoughtful thresholds and business filters, teams drown in output.
  • Sparse data on long-tail SKUs: Niche or low-frequency products rarely meet support thresholds, even when their associations matter for high-margin segments.
  • Static view of dynamic behavior: Classic Market Basket Analysis treats every basket as independent and ignores the order in which items were added or sequences across multiple visits. Sequential and time-aware variants help but add complexity.
  • No causality: A rule says A and B are bought together, not that A causes B to be bought. Acting on a rule without considering context can produce promotions that simply discount baskets that would have happened anyway.
  • Limited by the schema you record: If a retailer logs only product IDs without categories, attributes, or timestamps, the depth of analysis is capped early.

Tools and Platforms for Market Basket Analysis

Common tools for Market Basket Analysis include Python libraries like mlxtend and PyCaret, R’s arules package, SAS, KNIME, and warehouse-native options like Snowflake, Databricks, and BigQuery ML.

The tooling landscape splits roughly four ways:

  • Python libraries: mlxtend, PyCaret, and Efficient-Apriori are the most-used libraries for running Apriori, FP-Growth, and Eclat. They work well alongside pandas for data prep.
  • R packages: the arules and arulesViz packages remain popular in academia and analytics teams that work in R, with strong visualization for rules.
  • Enterprise platforms: SAS, IBM SPSS, and KNIME offer GUI-driven Market Basket Analysis for teams that prefer visual workflows.
  • Warehouse-native: Snowflake, Databricks, and BigQuery ML allow Market Basket Analysis to run directly where the data lives, which avoids moving large transaction datasets and scales well for retailers with billions of basket lines.

The right choice depends on data volume, where the team’s analytics gravity sits, and whether the output needs to be production-served or used for one-off analysis.

How to Perform Market Basket Analysis?

Market Basket Analysis is a data mining technique that involves analyzing the combinations of products customers buy together. It studies real purchases, often from a supermarket or e-commerce store, to identify the patterns of items that customers tend to buy in the same trip.

A practical, repeatable approach looks like this.

Step 1: Define the business question: Decide what decision the analysis should support. Cross-sell on the product page, a new bundle promotion, a store reset, or a category review? The question shapes the data slice and the thresholds.

Step 2: Prepare the transaction data: Pull POS or e-commerce transactions in basket format, where each row is a transaction and each column or list element is an item. Clean returns, voided transactions, and test orders. Decide on the right product granularity (SKU, category, brand) for the question being asked.

Step 3: Set support and confidence thresholds: Choose minimum support and confidence values that match the data volume and the business context. Too high and the analysis surfaces only the obvious. Too low and it produces noise.

Step 4: Run the algorithm: Use Apriori, FP-Growth, or Eclat to find frequent itemsets and generate association rules. Most teams start with FP-Growth on production-scale datasets.

Step 5: Evaluate the rules: Sort rules by lift, then filter out trivial or already-known patterns. Bring in merchandising or category managers to review the top rules and flag those that are commercially actionable.

Step 6: Translate rules into actions: Map the strongest rules to specific moves: a “frequently bought together” widget, a bundle promotion, a planogram change, a marketing trigger, or a cross-sell offer at checkout.

Step 7: Measure the impact: Track average order value, attach rate, and category sales for the products involved. Where possible, validate uplift with an A/B test or incrementality test rather than relying on attributed numbers alone.

Step 8: Refresh regularly: Buying patterns shift with seasons, promotions, and competitor activity. Refresh the analysis quarterly at minimum, and more often for fast-moving categories.

How LatentView Helps with Market Basket Analysis

LatentView Analytics helps companies get more value from their transaction data through Market Basket Analysis. Our teams identify purchasing patterns, surface cross-selling opportunities, and recommend product placements that increase revenue and operational efficiency. We work across retail, e-commerce, BFSI, and CPG, applying AI-powered analytics to uncover the relationships between items that day-to-day reporting tends to miss.

That work feeds directly into product bundling, inventory management, and targeted marketing programs, so basket insight does not stop at a slide. We help operationalize the rules into recommendation engines, planograms, CRM journeys, and category plans, with measurement frameworks that connect each change to revenue impact.

Get in touch to explore how LatentView can support your Market Basket Analysis program.

Frequently Asked Questions

1. What is Market Basket Analysis with an example?

Market Basket Analysis is a technique that finds products customers buy together. A classic example is a supermarket noticing that customers who buy bread very often also buy butter, leading the store to place the two near each other or run a bread-and-butter bundle promotion.

2. What data is needed for Market Basket Analysis?

The minimum requirement is transaction-level data where each record lists the items in a single basket, typically pulled from POS or e-commerce systems. More advanced analysis adds timestamps, store or channel identifiers, customer IDs, prices, and product attributes like category and brand.

3. Which ML technique is commonly used for Market Basket Analysis?

Association rule learning is the most common ML technique used for Market Basket Analysis. It is unsupervised, since there is no target variable, and it produces “if A, then B” rules from transactional data.

4. Which algorithm is best for Market Basket Analysis?

Apriori is the easiest to understand and the standard teaching example. FP-Growth is faster on large datasets and is the default in most production settings. Eclat is a good fit when memory efficiency matters or when transactions are short.

5. What industries use Market Basket Analysis?

Retail and e-commerce are the largest users, but Market Basket Analysis is also widely applied in BFSI for product cross-sell, telecom for plan and add-on bundling, healthcare for prescription pattern analysis, and hospitality for menu and package design.

6. What are support, confidence, and lift in Market Basket Analysis?

Support is the share of all transactions that contain a given itemset. Confidence is the probability that B is bought given that A is in the basket. Lift compares the observed co-occurrence of A and B against what would be expected if the two were independent, with values above 1.0 indicating a real association.

LatentView Analytics has been helping enterprises make data-driven decisions for nearly 20 years. The company brings deep expertise in data engineering, business analytics, GenAI, and predictive modeling to 30+ Fortune 500 clients across tech, retail, financial services, and CPG. A publicly traded company serving the US, India, Canada, Europe, and Singapore, LatentView is recognized in Forrester's Customer Analytics Service Providers Landscape.

SHARE

Take to the Next Step

"*" indicates required fields

consent*

Related Glossary

Pricing analytics helps companies stop leaving money on the table

Predictive lead scoring helps marketing and sales teams rank incoming

Incrementality testing helps marketers measure the real lift of a

A

C

D

Related Links

This guide helps financial services marketing leaders across banking, insurance, fintech, and wealth management build a…

This guide helps CPG marketing leaders build and scale a marketing analytics function that connects every…

Scroll to Top