The main aim of this project is to make sure each shop receives the right amount of stock at the right time. It focuses on avoiding situations where a shop runs out of products and loses customers, while also preventing sending more stock than the shop can realistically sell. In simple terms, the objective is to maintain a healthy balance—not too much, not too little—so that shops can operate smoothly, meet customer demand, and avoid unnecessary costs or wastage.
This project is developed using the following technologies:
- Python
- Pandas
- NumPy
- Scikit-learn
- LightGBM
- XGBoost
- Matplotlib & Seaborn
- Jupyter Notebook
To get a local copy up and running follow these steps.
Before you begin, ensure you have the following installed:
- Python 3.10 or higher
- Jupyter Notebook / JupyterLab
- pip (Python package installer)
To install Jupyter Notebook:
pip install notebookTo verify Python version:
python --versionFollow these steps to run the project on your machine:
- Clone the repository
git clone https://github.com/khushiipatel/FinalProjectML.git
- Navigate into the project
cd repo_name - Open Jupyter Notebook
jupyter notebook
- Open the project file
Inside Jupyter, open:
Project.ipynb
- Run all cells
- The dataset is taken from the Google Cloud public Marketplace in Big Query.
- Sales Data: Daily sales transactions
- Fields: sales_date, dealer_code, product, qty, total_price
- Stock Data: Daily inventory snapshots
- Fields: benchmark_date, ec_id, product_name, inventory_qty
- Scale: Multiple stores × multiple products × daily timestamps
- Preprocessing: Merged datasets, handled missing values, created time-series structure.
This visualization helps identify which model most accurately predicts daily demand across all products for each of the 7 days, enabling better decision‑making for inventory and resource planning.

For detailed model experiments, evaluation metrics, and performance comparisons, please refer to the Documentation
- LightGBM;
- Support Vector Regression (SVR);
- Complementary Models: XGBoost & Random Forest;
- Ensemble Strategy
| Model | RMSE | MAE | WMAPE |
|---|---|---|---|
| LightGBM | 0.9573 | 0.3531 | 1.09% |
| XGBoost | 1.0774 | 0.4227 | 1.30% |
| Random Forest | 2.3733 | 1.2565 | 3.86% |
| SVM(RBF) | 12.0908 | 6.1007 | 18.76% |
| ESEMBLE | 1.0383 | 0.4559 | 1.40% |
LightGBM achieved the best overall performance with the lowest RMSE and WMAPE.
This demand forecasting system helps businesses make better inventory decisions:
- Reduce missed sales from stockouts by identifying which products are likely to run out and need restocking soon.
- Minimize waste from overstock by detecting products with excess inventory before they become obsolete.
- Optimize inventory costs by planning purchasing cycles to keep just enough stock without tying up too much capital.
- Improve customer satisfaction by ensuring popular products are always available when customers want to buy them.
H. Malik, "A beginner's approach to time-series with working example: Demand forecasting │ Time series example with Kaggle," Medium, Jun. 11, 2024. [Online]. Available: https://medium.com/@humzahmalik/a-beginners-approach-to-time-series-with-working-example-c6bff9c24928
This project was completed as part of academic coursework for CS613: Machine Learning.




