Product segmentation refers to the activity of grouping products that have similar characteristics and serve a similar market.
In Logistics, attention is mainly focused on sales volume distribution, demand variability and delivery lead time.
Can we automate this analysis with Python?
As a supply chain manager, you want to put efforts into managing products that have:
- The highest contribution to your total turnover: ABC Analysis
- The most unstable demand: Demand Variability
In this article, we will introduce simple statistical tools to combine ABC Analysis and Demand Variability with Python.
Product segmentation with Python
Product Segmentation for Retail
You support the Operational Director of a local Distribution Center (DC) that delivers 10 Hypermarkets.
In her scope, there is the responsibility of
- Preparation and delivery of replenishment orders from stores
- Demand Planning and Inventory Management
What are the operational challenges?
Logistics Operations for Retail
This analysis will be based on the M5 Forecasting dataset of Walmart stores’ sales records.
We suppose that we only have the first-year data (d_1 to d_365):
- 10 stores in 3 states (USA)
- 1,878 unique SKU
- 3 categories and 7 departments (sub-category)
Categories and departments do not impact your ordering, picking, or shipping processes except for the warehouse layout.
What does impact your logistic performance?
Products Rotation
- Very Fast Movers: top 5% (Class A)
- The following 15% of fast movers (Class B)
- The remaining 80% of prolonged movers (Class C)
This classification will impact,
- Warehouse Layout: Reduce Warehouse Space with the Pareto Principle using Python
- Picking Process: Improve Warehouse Productivity using Order Batching with Python
Demand Variability
- Average Sales: µ
- Standard Deviation:
- Coefficient of Variation: CV = σ/µ
You may need more stable customer demand for SKUs with a high CV value, leading to workload peaks, forecasting complexity and stock-outs.
- Filter on the first year of sales for HOBBIES Skus
- Calculate Mean, Standard deviation and CV of sales
- Sorting (Descending) and Cumulative sales calculation for ABC analysis
Methodologies of Product Segmentation
This analysis will be done for the SKU in the HOBBIES category.
How to perform ABC Analysis?
What are the references that are driving most of your sales?
Class A: the top 5%
- Number of SKU: 16
- Turnover (%): 25% Class B: the following 15%
- Number of SKU: 48
- Turnover (%): 31%Class C: the 80% slow movers
- Number of SKU: 253
- Turnover (%): 43%
In this example, the Pareto Law (20% of SKUs making 80% of the turnover) is not observed.
However, 80% of our portfolio still makes less than 50% of the sales.
How stable is your customers’ demand?
Define Demand Stability with the Coefficient of Variation
From the Logistics Manager's point of view, handling a peak of sales is much more challenging than ensuring uniform distribution throughout the year.
To understand which products will present planning and distribution challenges, we will compute the coefficient of variation of each reference's yearly sales distribution.
Class A
Fortunately, most of the A SKU have a quite stable demand; we won't be challenged by the most important SKUs.
Class B
The majority of SKUs are in the stable area; however we still spend effort on ensuring optimal planning for the few references that have a high CV.
Class C
Most of the SKUs have a high value of CV;
For this kind of reference a cause analysis would provide better results than a statistical approach for forecasting.
Code
Can we assume that the sales follow a normal distribution?
Use the Normality Test to check if a distribution is normal
Most of the simple inventory management methods are based on the assumption that the demand follows a normal distribution.
Why?
Sanity Check
We’ll use the Shapiro-Wilk test for normality, which can be implemented using the Scipy library.
The null hypothesis will be (H0: the demand sales follow a normal distribution).
Bad News
For an alpha = 0.05, we can reject the null hypothesis for most of the SKUs. This will impact the complexity of inventory management assumptions.
Do you want to try this algorithm without coding?
ABC Analysis App
A light version of this model has been deployed on a web app: LogiGreen App
This prototype, currently in development, is already available for test.
How to test it?
You can test the model without uploading data by just following the steps below
Step 1: Go to the supply chain optimization page
Step 2: Select 'ABC Analysis' on the side bar
Step 3: Go the 'Analysis' tab
You can select
- A metric for the ABC Analysis (Quantity or Turnover)
- Limits for Class A and Class B items
- Maximum coefficient of variability to remove outliers
- Choice for color mapping based on ABC Class, Focus, Normality Test or Product Family
Step 4: 'Launch the Analysis'
You will find multiple visuals for ABC Analysis, Pareto Chart and a plot of the Turnover = f(Quantity).
Any question?
For any inquiries, please contact us at contact@logi-green.com
This blog post is based on an article originally published on Medium
- Product Segmentation for Retail with Python by Samir Saci