Demand Forcasting
π Demand Forecasting Project
π Project Overview
Demand forecasting is crucial for businesses to optimize inventory, reduce costs, and maximize profits. This project leverages machine learning to predict future sales based on historical data, helping businesses make data-driven decisions.
1οΈβ£ Dataset Information
The dataset contains sales-related attributes, including:
- Item ID β Unique identifier for the item
- Store ID β Unique identifier for the store
- Price β Item price
- Week β Week of the sale
- Sales β Total units sold
2οΈβ£ Exploratory Data Analysis (EDA)
EDA was performed to uncover patterns and relationships:
β
Sales trends over time
β
Correlation between price and sales
β
Seasonality patterns in sales data
3οΈβ£ Feature Engineering
To improve model performance, additional features were created:
- Day, Month, and Year β Extracted from the week column
- dif_bt β Difference between
base_price
andtotal_price
- rd_base β
dif_bt
divided bybase_price
- rd_total β
dif_bt
divided bytotal_price
4οΈβ£ Model Selection
Several models were tested for demand forecasting:
- XGBoost Regression
- Random Forest
- LightGBM β (Chosen Model)
- Gradient Boost
πΉ LightGBM was selected for its superior efficiency and predictive accuracy.
5οΈβ£ Why LightGBM?
βοΈ Fast training speed and low memory usage
βοΈ Handles large datasets efficiently
βοΈ Outperforms other models in predictive accuracy
6οΈβ£ Test Data Prediction
The trained LightGBM model achieved:
Metric | Score |
---|---|
Mean Absolute Error (MAE) | 24.757 |
RΒ² Score | 0.8126 |
π Predictions align well with actual sales trends, confirming model effectiveness.
π Future Improvements
π Enhancing demand forecasting for better business insights!
β
Adding External Data β Incorporate weather, holidays, and promotions for better predictions
β
Deep Learning Models β Experiment with LSTMs or Transformers for sequential forecasting
β
Hyperparameter Optimization β Tune LightGBM with Bayesian Search for improved accuracy
β
Explainability β Use SHAP values to interpret the modelβs decisions
β
Real-Time Forecasting β Implement an API to update predictions dynamically
π GitHub Repository
π’ This project is a step towards smarter demand forecasting, enabling better sales strategies and inventory management! π