AI-powered retail demand forecasting, spike detection, inventory recommendation, and risk intelligence using XGBoost and the M5 Forecasting Dataset.
RetailPulse is a machine learning project designed to help retailers make proactive inventory and demand planning decisions. The platform combines forecasting, anomaly detection, and inventory intelligence into a unified retail analytics workflow.
Using historical sales, calendar events, and pricing information from the M5 Forecasting dataset, the system predicts future demand, identifies potential demand spikes, and generates inventory recommendations to reduce stockouts and overstock situations.
Retail businesses frequently face challenges such as:
- Unexpected demand surges
- Inventory shortages
- Overstocked products
- Inaccurate demand forecasts
- Poor replenishment planning
RetailPulse addresses these issues through predictive analytics and machine learning.
Predict future product demand using historical sales patterns and engineered time-series features.
Outputs
- Demand forecasts
- Trend analysis
- Forecast accuracy metrics
Identify products likely to experience abnormal increases in demand.
Use Cases
- Festival demand surges
- Promotional campaigns
- Seasonal demand shifts
- Emerging product trends
Generate inventory recommendations based on forecasted demand and risk signals.
Recommendations Include
- Reorder suggestions
- Inventory adjustments
- Safety stock guidance
- Restocking priorities
Assess operational risks using demand behavior and spike probabilities.
Risk Categories
- Low Risk
- Medium Risk
- High Risk
- Critical Risk
This project uses the M5 Forecasting Accuracy Dataset, a large-scale retail forecasting dataset widely used for demand prediction research.
Historical daily product sales across multiple stores.
Temporal features including:
- Dates
- Events
- Holidays
- Seasonal information
Historical selling prices for products.
Load and merge:
- Sales data
- Calendar data
- Price data
Convert sales data into a time-series friendly format.
Generate predictive features including:
- Year
- Month
- Week
- Day
- Day of Week
- Quarter
- Weekend Indicator
- Lag 7
- Lag 28
- Rolling Mean 7
- Rolling Mean 28
- Rolling Standard Deviation
- Current Price
- Price Changes
Analyze:
- Demand trends
- Product performance
- Store performance
- Category behavior
- Seasonality patterns
XGBoost Regressor
Predict future demand levels.
- MAE (Mean Absolute Error)
- RMSE (Root Mean Squared Error)
XGBoost Classifier
Predict whether future demand will exceed expected thresholds.
- Accuracy
- Precision
- Recall
- F1 Score
- ROC-AUC
Inventory recommendations are generated using:
- Forecast demand
- Historical demand
- Demand variability
- Spike probability
Historical Sales Data
│
▼
Data Processing
│
▼
Feature Engineering
│
▼
┌─────────────────┐
│ Demand Forecast │
└─────────────────┘
│
▼
┌─────────────────┐
│ Spike Detection │
└─────────────────┘
│
▼
┌─────────────────┐
│ Risk Analysis │
└─────────────────┘
│
▼
┌─────────────────┐
│ Inventory Recs │
└─────────────────┘
models/forecast_model.pkl
Used for demand forecasting.
models/spike_detection_model.pkl
Used for spike probability estimation.
retailpulse-demand-intelligence/
├── data/
│ ├── calendar.csv
│ ├── sales_train_validation.csv
│ ├── sell_prices.csv
│ └── feature_engineered_sales.csv
│
├── models/
│ ├── forecast_model.pkl
│ └── spike_detection_model.pkl
│
├── notebook/
│ └── RetailPulse_Demand_Intelligence_Platform.ipynb
│
├── requirements.txt
│
└── .gitignore
git clone https://github.com/<your-username>/retailpulse-demand-intelligence.git
cd retailpulse-demand-intelligencepip install -r requirements.txtjupyter notebookOpen:
notebook/RetailPulse_Demand_Intelligence_Platform.ipynb
- Pandas
- NumPy
- Matplotlib
- Seaborn
- XGBoost
- Scikit-Learn
- Pickle
- Jupyter Notebook
RetailPulse can support:
- Demand Planning
- Inventory Optimization
- Supply Chain Monitoring
- Retail Analytics
- Stockout Prevention
- Sales Forecasting
- Risk Management
- Forecast future product demand
- Detect unusual demand spikes
- Recommend inventory actions
- Identify operational risks
- Improve replenishment decisions
- Reduce stockouts and overstock situations
- Deep Learning Forecasting Models
- Multi-store Forecasting
- Real-time Demand Monitoring
- Automated Inventory Optimization
- Explainable AI Insights
- FastAPI Deployment
- Enterprise Dashboard Integration
This project is intended for educational, research, and portfolio purposes.
RetailPulse Demand Intelligence Platform
Forecast Demand • Detect Risks • Optimize Inventory