M5 Supply Chain Forecasting & Inventory Optimization
A one-year Industrial Engineering capstone that benchmarks 10+ classical, machine-learning, and deep-learning forecasting models on the Kaggle M5 (Walmart) dataset, then translates accuracy into real inventory savings through a probabilistic (Q, r) simulation and a live Next.js decision-support dashboard. The champion LightGBM model cut simulated inventory costs by 19.5% versus the naive baseline.
Overview
This is a one-year Industrial Engineering capstone project (IE 4197/4198, Marmara University) titled "A Comparative Analysis of Classical and Deep Learning Forecasting for Supply Chain Inventory Optimization."
The project benchmarks classical, machine-learning, and deep-learning forecasting methods on the Kaggle M5 Forecasting Accuracy dataset (Walmart hierarchical retail sales) and quantifies their real financial impact through a probabilistic (Q, r) inventory optimization simulation. Results are operationalized in a live Next.js Decision Support System (DSS).
The core thesis: statistical accuracy alone is not enough — a model must be evaluated on the bottom-line cost of the inventory it drives. Standard LSTMs, despite reasonable RMSE, inflate holding costs because of the "Sparsity Penalty" on intermittent retail demand; DeepAR solves this with a Negative Binomial likelihood.
Key Features
- Benchmarks 10+ models across three tiers: classical (Naive, SMA, WMA, SES, Holt Linear, Holt-Winters, ETS), ML (LightGBM, XGBoost, Prophet, ARIMA/AutoARIMA), and deep learning (LSTM, DeepAR).
- Multi-store validation across CA_1, CA_2, CA_3 stores.
- WRMSSE (official M5 accuracy metric) and Safety Stock derived from forecast-error variance:
SS = z · RMSE · √L. - Recursive, day-by-day inference that recomputes lag/rolling features to prevent data leakage.
- Probabilistic (Q, r) inventory simulation translating forecast error into holding vs. stockout cost.
- Interactive Decision Support System: SKU selector, service-level / holding-cost / stockout-cost sliders, Newsvendor Critical Ratio auto-optimizer, SHAP feature-importance and sensitivity analysis.
- Explainable AI via SHAP feature importance.
Results
| Model | RMSE | WRMSSE | Safety Stock | Total Cost | Savings vs Naive |
|---|---|---|---|---|---|
| Naive | 2.86 | 1.000 | 4.71 | $640,703 | Baseline |
| LightGBM | 1.96 | 0.833 | 3.22 | $473,276 | +19.5% |
| DeepAR | 2.15 | 0.750 | 3.54 | $520,000 | +61.6%* |
| LSTM | 3.58 | 0.981 | 5.89 | $1,475,249 | -108.5% |
*DeepAR reaches +61.6% under an extreme Critical Ratio scenario (low holding / high stockout cost).
Champion: LightGBM — the best balance of accuracy and financial impact (~$125k, 19.5% cost reduction vs. the naive baseline).
Tech Stack
- Backend / data science: Python 3.10, Polars (ETL), LightGBM, LSTM (PyTorch), DeepAR (GluonTS), statsmodels, Prophet, XGBoost, scikit-learn.
- Frontend: Next.js 16 (App Router), React 19, Recharts, Tailwind CSS v4, lucide-react.
- Testing: pytest + pytest-cov (backend, 94% coverage), Vitest + React Testing Library (unit), Playwright (E2E, 93% coverage).
- Deployment: Vercel (frontend), hybrid Python/Node monorepo.
Development Notes
- Hybrid monorepo:
backend/(Python pipeline) +frontend/(Next.js DSS) +docs/(final report, presentation, defense materials). - Large data, model weights (
*.pt,*.pkl), and generated results are excluded from Git via.gitignore; the frontend consumes pre-exported JSON (frontend/public/data/). - Testing follows a hybrid structure: colocated Vitest tests for components, centralized pytest suite for the backend, and Playwright E2E for all five app pages.
- Team: Hakan İspir (AI & Software Lead), Boran Turan (Optimization & Reporting Lead), Ali Kahya (IE Analyst). Supervisor: Prof. Dr. Serol Bulkan.