Ramgopal Prajapat:

Learnings and Views

Applications of Market Basket Analysis in Retail or Ecommerce

By: Ram on Oct 28, 2022

There is a long list of Machine Learning applications in Retail or Ecommerce. One of the common applications is using Market Basket Analysis (MBA) for cross-sell and in-store product placements. In this blog, we will discuss provide you non-technical description of Market Basket Analysis and its applications in Ecommerce and Retail.

  • What is Market Basket Analysis?
  • How is it applied in Retails/Ecommerce?
  • What is value of Market Basket Analysis?


Market Basket Analysis: Overview

Market Basket Analysis (Association Analysis) is a mathematical modelling technique that helps in identifying the list of products are typically bought together.

For any of the ecommerce or retails company, there are millions of transactions and significant % of the orders will have multiple products purchased together by the customers.

There can be thousands of product combinations and some of the frequent selling products will be more prominent; hence appropriate KPIs will be key to prioritize these combinations.

The process of finding out the combinations and their importance is arrived at using Market Basket Analysis and the underlying algorithm. One of the algorithms is called Apriori algorithm.


Case Study:  Market Basket Analysis

For an ecommerce company, around 70k distinct products are sold and over 350k orders were placed during this time. 80% of these orders had only 1 product purchases and remaining 20% of the orders had multiple product purchases.


Description automatically generated with low confidence


It is imperative for business to learn from the customers who are shopping multiple products in an order and reduce % of the customers who are purchasing only one product per order.  There is a direct impact on business by cross-selling products to the customers and increasing average order value (AOV).

Additionally, if we track the customers who buys multiple products on an order, they are highly engaged in the future as well, increasing overall engagement from these customers.

“Customers who shops multiple products on an order have 20% higher average spend in the next 12 months”


Chart, bar chart

Description automatically generated

Market Basket Analysis can help in identifying the products that can be recommended to effectively convert single product shoppers to multiple product shoppers.

Apriori algorithm scan all the transactions and identify combinations of all the products purchased together by the customer.


Description automatically generated

Once these product combinations (2, 3 or more products) are identified, we need to prioritize and some of the high-level thinking for selecting these combinations or rules (association rules) are:

  • Do we have enough evidence or purchases to consider? And technically this is referred as support.  For us to use any rule, there must be enough % of transactions with these combinations.  Higher the value, higher is support for that rule.

If product is A, then support for the product A is Sup(A) = Probability of product A Purchase= P (A)

  • Is this combination occurring by chance or is there association between these products?  If a rule or product combinations is “Bread” -> “Butter” (when someone buys Bread, they are also interested to buy butter together), how strongly does someone buy both compared to just buying only “Bread”.  This is measured by a metric called confidence.


Confidence (Product A -> Product B) is the ratio of Product Purchase A and B together and Probability of Product A Purchase


Confidence (A -> B) = P (A ∩ B)/P (A)


  • Another important consideration is to select the rule is whether the rule came up just by coincidence or there is incremental evidence for the rule. This is captured by Lift.


Lift (A -> B) = Confidence (A -> B)/Sup (B) = P (A ∩ B)/P (A)*P(B)

   All of f these metrics will be computed and given as Apriori Algorithm output.

Market Basket Applications for Ecommerce

When we visit any ecommerce website such as Amazon or Big Basket, it shows “Items/Products Bought Together”, these are typically powered by Market Basket Analysis.

For example, if you visit BigBasket  and follow similar steps to explore yourself

Market Basket Applications for Retail

Tesco, or Walmart have been using Market Basket Analysis from decades. They use Association rules for in-store product placements and product bundling. Bear and Diaper example from Walmart is common scenario discussed across.

Leave a comment