An end-to-end Machine Learning system designed to forecast retail demand and convert predictions into actionable, automated inventory decisions.
Retail supply chains frequently suffer from two opposing inefficiencies: stockouts (resulting in lost revenue) and overstocking (resulting in capital tied up in holding costs).
This project bridges the gap between predictive analytics and operations research by providing a complete intelligent forecasting and inventory optimization pipeline. It leverages machine learning to predict item-level demand and utilizes Operations Research (OR) formulas to calculate optimal Safety Stock, Reorder Points, and Economic Order Quantities (EOQ).
graph TD;
A[Raw Sales Data] --> B[Data Preprocessing];
B --> C[Feature Engineering];
C --> D[ML Forecasting Model XGBoost];
D --> E[FastAPI Backend];
F[Operations Research Engine] --> E;
E --> G[Streamlit Web Dashboard];
G --> H[Actionable Business Alerts];
- Machine Learning Demand Forecasting Time-Series Engineering: Automated generation of lag features, rolling statistics, and temporal variables.
Robust Modeling: Supervised learning approaches tracking actual vs. predicted sales with high fidelity.
- Exploratory Data Analysis (EDA) Data integrity and underlying patterns were rigorously analyzed prior to modeling, isolating key sales drivers such as seasonality and promotional impacts.
- Inventory Optimization Engine Translates abstract predictions into concrete procurement metrics:
Safety Stock: Buffers against demand volatility.
Reorder Point (ROP): Triggers automated replenishment alerts.
Economic Order Quantity (EOQ): Minimizes total holding and ordering costs.
- Production-Ready Backend API Built on FastAPI, decoupling the machine learning engine from the frontend, allowing for highly scalable integration into existing ERP systems.
- Clone the Repository Bash git clone https://github.com/Vani691/retail-forecasting-inventory-system.git
cd retail-forecasting-inventory-system
-
Environment Setup Bash python -m venv venv source venv/bin/activate # On Windows use
venv\Scripts\activatepip install -r requirements.txt -
Run the Backend API Start the FastAPI server to serve the ML models and optimization logic.
Bash uvicorn api.main:app --reload The Swagger UI documentation will be available at http://127.0.0.1:8000/docs
- Launch the Interactive Dashboard Open a new terminal window and run the Streamlit frontend.
Bash streamlit run app/app.py
Retail-Intelligent-Replenishment-System/
├── api/
│ └── main.py # FastAPI application
├── app/
│ └── app.py # Streamlit dashboard
├── data/
│ ├── raw/ # Simulated historical sales
│ └── processed/ # Cleaned & engineered datasets
├── images/ # UI and EDA screenshots
├── notebooks/
│ └── eda.ipynb # Exploratory data analysis
├── src/
│ ├── data_generator.py # Synthetic data generation
│ ├── feature_engineering.py # Lag & rolling metric creation
│ ├── forecasting.py # Model training pipeline
│ └── inventory.py # OR calculations (EOQ, ROP)
├── requirements.txt
└── README.md
Real-time Streaming Integration: Migrate from batch processing to real-time inference using Apache Kafka.
Multi-Echelon Optimization: Expand the logic to handle warehouse-to-store routing.
Cloud Deployment: Containerize via Docker and deploy on AWS ECS / GCP Cloud Run.
Shravani Mane CSE-AIML Undergraduate | Machine Learning Developer | Building Data Science & ML Systems




