Skip to content

srsimsima81-cloud/Retail-Sales-Forecasting-Inventory-Optimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“Š Retail Sales Forecasting & Inventory Optimization System

๐Ÿง  Project Overview

This project is an end-to-end Machine Learning-based Retail Analytics System that performs:

  • ๐Ÿ“ˆ Sales Forecasting using historical retail data
  • ๐Ÿ“ฆ Inventory Optimization using demand predictions
  • ๐Ÿ”ฎ Future Sales Forecasting (7-day prediction)
  • ๐Ÿ“Š Interactive Dashboard using Streamlit

It simulates a real-world retail environment like Amazon, Walmart, D-Mart, Flipkart, etc., where businesses must predict demand and manage inventory efficiently.


๐ŸŽฏ Problem Statement

Retail businesses face major challenges:

  • Stockouts โ†’ loss of sales
  • Overstock โ†’ increased storage cost
  • Unpredictable demand
  • Poor inventory planning

This project solves these issues using data-driven forecasting and optimization techniques.


๐Ÿ’ผ Business Value

This system helps businesses:

  • Reduce stockouts ๐Ÿ“‰
  • Avoid overstocking ๐Ÿ“ฆ
  • Improve supply chain efficiency ๐Ÿšš
  • Make data-driven inventory decisions ๐Ÿ“Š
  • Predict future demand ๐Ÿ”ฎ

๐Ÿ—๏ธ Project Architecture

Raw Data (sales.csv)
        โ†“
Data Preprocessing
        โ†“
Feature Engineering (day, month, weekday, product encoding)
        โ†“
Machine Learning Model (Random Forest Regressor)
        โ†“
Sales Prediction
        โ†“
Inventory Optimization (Safety Stock + Reorder Point)
        โ†“
Future Forecasting (7 days)
        โ†“
Streamlit Dashboard

๐Ÿงฐ Tech Stack

  • Programming Language: Python ๐Ÿ

  • Libraries Used:

    • pandas
    • numpy
    • scikit-learn
    • matplotlib
    • seaborn
    • streamlit
    • joblib
    • datetime

๐Ÿ“ Folder Structure

Retail-Sales-Forecasting-Inventory-Optimization/
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ raw/            # Original dataset (sales.csv)
โ”‚   โ””โ”€โ”€ processed/      # Cleaned dataset
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ eda.ipynb       # Exploratory Data Analysis
โ”‚   โ””โ”€โ”€ modeling.ipynb  # Model training & testing
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ data_preprocessing.py
โ”‚   โ”œโ”€โ”€ feature_engineering.py
โ”‚   โ”œโ”€โ”€ forecasting.py
โ”‚   โ”œโ”€โ”€ inventory.py
โ”‚   โ””โ”€โ”€ visualization.py
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ model.pkl       # Trained ML model
โ”‚
โ”œโ”€โ”€ outputs/
โ”‚   โ”œโ”€โ”€ forecasts.csv
โ”‚   โ”œโ”€โ”€ inventory_plan.csv
โ”‚   โ””โ”€โ”€ future_forecast.csv
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ””โ”€โ”€ app.py          # Streamlit dashboard
โ”‚
โ”œโ”€โ”€ reports/
โ”‚   โ””โ”€โ”€ report.txt
โ”‚
โ”œโ”€โ”€ main.py             # Main pipeline
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

โš™๏ธ Installation & Setup

1๏ธโƒฃ Clone the repository

git clone https://github.com/your-username/Retail-Sales-Forecasting-Inventory-Optimization.git
cd Retail-Sales-Forecasting-Inventory-Optimization

2๏ธโƒฃ Create virtual environment

python -m venv venv

3๏ธโƒฃ Activate environment

  • Windows:
venv\Scripts\activate
  • Mac/Linux:
source venv/bin/activate

4๏ธโƒฃ Install dependencies

pip install -r requirements.txt

๐Ÿš€ How to Run the Project

Step 1: Run main pipeline

python main.py

This will:

  • Clean data
  • Train model
  • Generate predictions
  • Calculate inventory metrics
  • Create future forecast

Step 2: Run dashboard

streamlit run app/app.py

๐Ÿ“Š Key Features

๐Ÿ“ˆ Sales Forecasting

Predicts sales using:

  • Day
  • Month
  • Weekday
  • Product ID

๐Ÿ“ฆ Inventory Optimization

Calculates:

  • Average Demand
  • Safety Stock
  • Reorder Point

Formula:

Reorder Point = (Average Demand ร— Lead Time) + Safety Stock

๐Ÿ”ฎ Future Forecasting

  • Predicts next 7 days sales
  • Helps in demand planning

๐Ÿ“Š Dashboard Features

  • Product selection
  • Sales vs Predicted graph
  • Future forecast graph
  • Inventory recommendations

๐Ÿ“ธ Sample Outputs

Include screenshots in /images folder:

  • Sales trend graph
  • Prediction graph
  • Future forecast graph
  • Dashboard UI

๐Ÿ“Œ Results

  • Model successfully predicts retail sales trends
  • Future forecasting implemented for next 7 days
  • Inventory optimization reduces stock risks
  • Interactive dashboard provides real-time insights

๐Ÿš€ Future Improvements

  • Multi-store forecasting
  • Price elasticity modeling
  • Weather-based demand prediction
  • Real-time data integration
  • Advanced ML models (XGBoost, Prophet)
  • Automated inventory ordering system

๐Ÿ“š Learning Outcomes

This project demonstrates:

  • End-to-end ML pipeline development
  • Feature engineering for time-series data
  • Business-focused machine learning
  • Inventory optimization techniques
  • Streamlit dashboard development
  • Real-world retail analytics simulation

๐Ÿ‘จโ€๐Ÿ’ป Author

Student Project โ€“ Data Science Portfolio

  • Domain: Retail Analytics + Machine Learning
  • Type: End-to-End Industry Simulation Project

โญ If you like this project

Give a โญ on the repository and feel free to improve it further!

About

Retail Sales Forecasting & Inventory Optimization System using Machine Learning to predict demand, reduce stockouts, and improve inventory decisions with a Streamlit dashboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors