Demand Forecasting & Inventory Optimization Pipeline for Kenyan Retail
# Kenya Demand Forecasting & Inventory Optimization
## Project Overview
An end-to-end data science pipeline that forecasts retail demand and optimizes inventory for Kenyan businesses. This project simulates real-world retail data, builds machine learning models, and provides actionable purchase recommendations.
## Business Problem
Kenyan retailers face significant challenges:
- **Stockouts** - Lost sales when popular items run out
- **Overstocking** - Tied-up capital in excess inventory
- **Manual Planning** - Time-consuming Excel-based forecasting
- **Unknown Demand** - No visibility into future sales patterns
## Solution
This pipeline provides:
- **2-Year Demand Forecast** (2027-2028)
- **Optimal Inventory Levels** - Minimize holding costs
- **Weekly Purchase Recommendations** - When and how much to order
- **95% Service Level** - Balance between stockouts and overstocking
## Technical Architecture
### Data Generation
- Simulated Kenyan retail data (2023-2025)
- Realistic patterns: weekends, holidays, month-end payday effects
- Kenyan regions and product categories
### ETL Pipeline
- Data cleaning and transformation
- Feature engineering (time features, lags, rolling statistics)
- Data aggregation for forecasting
### Machine Learning
- **Model**: LightGBM (Gradient Boosting)
- **Features**: 24+ time-based and lag features
- **Horizon**: 2 years (730 days)
- **Performance**: High accuracy with business-relevant metrics
### Inventory Optimization
- **Safety Stock**: Buffer against demand uncertainty
- **Reorder Point**: When to place new orders
- **EOQ**: Economic Order Quantity
- **Purchase Orders**: Weekly actionable recommendations
## Key Results
### Demand Forecast
| Metric | 2027 | 2028 |
|--------|------|------|
| Total Sales | KSh 80.35M | KSh 80.36M |
| Daily Average | KSh 220,150 | KSh 219,558 |
| Best Month | January (KSh 6.97M) | January (KSh 6.81M) |
| Worst Month | February (KSh 6.20M) | February (KSh 6.17M) |
### Inventory Optimization
| Met …