Skip to content

Streamlit Application for ABC Analysis & Product Segmentation

License

Notifications You must be signed in to change notification settings

samirsaci/segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Automate ABC Analysis & Product Segmentation with Streamlit πŸ“ˆ

A statistical methodology to segment your products based on turnover and demand variability using an automated solution with a web application designed with the framework Streamlit

streamlit Application UI

Product segmentation refers to the activity of grouping products that have similar characteristics and serve a similar market. It is usually related to marketing (Sales Categories) or manufacturing (Production Processes). However as a Supply Chaine Engineer your focus is not on the product itself but more on the complexity of managing its flow.

Your want to understand the sales volumes distribution (fast/slow movers) and demand variability to optimize your production, storage and delivery operations to ensure the best service level by considering:

  • The highest contribution to your total volume: ABC Analysis
  • The most unstable demand: Demand Variability

I have designed this Streamlit App to provide a tool to Supply Chain Engineers for Product Segmentation, with a focus on retail products, of their portofolio considering the complexity of the demand and the volumes contribution of each item.

Understand the theory behind πŸ“œ

In this Article, you can find details about the theory used to build this tool.

Access the application πŸ–₯️

Access it here: Product Segmentation for Retail

Step 0: Why should you use it?

This Streamlit Web Application has been designed for Supply Chain Engineers to support them in their Inventory Management. It will help you to automate product segmentation using statistics.

Step 1: What do you want to do?

You have two ways to use this application:

  • πŸ–₯️ Look at the results computed by the model using the pre-loaded dataset: in that case you just need to scroll to see the visuals and the analyses OR
  • πŸ’Ύ Upload your dataset of sales records that includes columns related to:
    • Item master data For example: SKU ID, Category, Sub-Category, Store ID
    • Date of the sales: For example: Day, Week, Month, Year
    • Quantity or value: this measure will be used for the ABC analysis For example: units, cartons, pallets or euros/dollars/your local currency

Step 2: Prepare the analysis

1. πŸ’Ύ Upload your dataset of sales records

Step 1: upload your dataset of sales records

πŸ’‘ Please make sure that you dataset format is csv with a file size lower than 200MB. If you want to increase the size, you'd better copy this repository and deploy the app locally following the instructions below.

2. πŸ“… [Parameters] select the columns for the date (day, week, year) and the values (quantity, $)

Step 2: select the columns for the date (day, week, year) and the values (quantity, $)

πŸ’‘ If you have several columns for the date (day, week, month) and for the values (quantity, amount) you can use only one column per category for each run of calculation.

3. πŸ“‰ [Parameters] select all the columns you want to keep in the analysis

Step 3: select the columns for the date (day, week, year)

πŸ’‘ This step will basically help you to remove the columns that you do not need for your analysis to increase the speed of computation and reduce the usage of ressources.

4. 🏬 [Parameters] select all the related to product master data (SKU ID, FAMILIY, CATEGORY, STORE LOCATION)

Step 4: select all the related to product master data (SKU ID, FAMILIY, CATEGORY, STORE LOCATION)

πŸ’‘ In this step you will show at what granularity you want to do your analysis. For example it can be at:

  • Item, Store level: that means the same item in two stores will represent two SKU
  • Item ID level: that means you group the sales of your item in all stores

5. πŸ›οΈ [Parameters] select one feature you want to use for analysis by family

Step 5: select one feature you want to use for analysis by family

πŸ’‘ This feature will be used to plot the repartition of (A, B, C) product by family

6. πŸ–±οΈ Click on Start Calculation? to launch the analysis

Step 6: Start Calculation

πŸ’‘ This feature will be used to plot the repartition of (A, B, C) product by family

Get insights about your sales records πŸ’‘

Pareto Analysis

Concept Pareto Analysis

INSIGHTS:

  1. How many SKU represent 80% of your total sales?
  2. How much sales represent 20% of your SKUs?

For more information about the theory behind the pareto law and its application in Supply Chain Management: Pareto Principle for Warehouse Layout Optimization

ABC Analysis with Demand Variability

Streamlit App Screenshot: ABC Analysis plot

QUESTIONS: WHAT IS THE PROPORTION OF?

  1. LOW IMPORTANCE SKUS: C references
  2. STABLE DEMAND SKUS: A and B SKUs with a coefficient of variation below 1
  3. HIGH IMPORTANCE SKUS: A and B SKUS with a high coefficient of variation

Your inventory management strategies will be impacted by this split:

  • A minimum effort should be put in LOW IMPORTANCE SKUS
  • Automated rules with a moderate attention for STABLE SKUS
  • Complex replenishment rules and careful attention for HIGH IMPORTANCE SKUS

For more information: Article

Streamlit App Screenshot: ABC SKU split for each family/category

QUESTIONS:

  1. What is the split of SKUS by FAMILY?
  2. What is the split of SKUS by ABC class in each FAMILY?

Normality Test

Streamlit App Screenshot: Normality test

QUESTION:

  • Which SKUs have a sales distribution that follows a normal distribution?

Many inventory rules and safety stock formula can be used only if the sales distribution of your item is following a normal distribution. Thefore, it's better to know the % of your portofolio that can be managed easily.

For more information: Inventory Management for Retail β€” Stochastic Demand

Build the application locally πŸ—οΈ

Build a python local environment (recommanded)

Then install virtualenv using pip3

sudo pip3 install virtualenv 

Now create a virtual environment

virtualenv venv 

Active your virtual environment

source venv/bin/activate

Launch Streamlit πŸš€

Install all dependencies needed using requirements.txt

 pip install -r requirements.txt 

Run the application

streamlit run segmentation.py 

Click on the Network URL in the shell

-> Enjoy!

About me πŸ€“

Senior Supply Chain Engineer with an international experience working on Logistics and Transportation operations.
Have a look at my portfolio: Data Science for Supply Chain Portfolio
For consulting or advising on analytics and sustainable supply chain transformation, feel free to contact me via Logigreen Consulting
Data Science for WarehousingπŸ“¦, Transportation 🚚 and Demand Forecasting πŸ“ˆ

Releases

No releases published

Packages

No packages published

Languages