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.
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.
This system helps businesses:
- Reduce stockouts ๐
- Avoid overstocking ๐ฆ
- Improve supply chain efficiency ๐
- Make data-driven inventory decisions ๐
- Predict future demand ๐ฎ
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
-
Programming Language: Python ๐
-
Libraries Used:
- pandas
- numpy
- scikit-learn
- matplotlib
- seaborn
- streamlit
- joblib
- datetime
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
git clone https://github.com/your-username/Retail-Sales-Forecasting-Inventory-Optimization.git
cd Retail-Sales-Forecasting-Inventory-Optimization
python -m venv venv
- Windows:
venv\Scripts\activate
- Mac/Linux:
source venv/bin/activate
pip install -r requirements.txt
python main.py
This will:
- Clean data
- Train model
- Generate predictions
- Calculate inventory metrics
- Create future forecast
streamlit run app/app.py
Predicts sales using:
- Day
- Month
- Weekday
- Product ID
Calculates:
- Average Demand
- Safety Stock
- Reorder Point
Formula:
Reorder Point = (Average Demand ร Lead Time) + Safety Stock
- Predicts next 7 days sales
- Helps in demand planning
- Product selection
- Sales vs Predicted graph
- Future forecast graph
- Inventory recommendations
Include screenshots in /images folder:
- Sales trend graph
- Prediction graph
- Future forecast graph
- Dashboard UI
- Model successfully predicts retail sales trends
- Future forecasting implemented for next 7 days
- Inventory optimization reduces stock risks
- Interactive dashboard provides real-time insights
- Multi-store forecasting
- Price elasticity modeling
- Weather-based demand prediction
- Real-time data integration
- Advanced ML models (XGBoost, Prophet)
- Automated inventory ordering system
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
Student Project โ Data Science Portfolio
- Domain: Retail Analytics + Machine Learning
- Type: End-to-End Industry Simulation Project
Give a โญ on the repository and feel free to improve it further!