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