All projects

Case study 10 / Data & ML

Demand forecasting with explainable root causes

Production forecasting pipelines that pick the best model for every SKU and explain why the numbers moved, about 15% more accurate (wMAPE) than the previous baseline.

Role
AI Engineer: modelling, pipelines, dashboard
Timeline
EVA Group · 2025 – present
Stack
Python · Ridge regression · LightGBM · ETS/Croston · PostgreSQL · FastAPI · Chart.js

01Problem

Demand planning needs a forecast for every product across brands, customers and channels. Those series behave very differently: some are steady, some seasonal, some sparse and intermittent, so one model for everything is wrong somewhere. Planners also need to know why a forecast changed, not just the new number.

02Solution & architecture

  • Panel build: sales history is mapped to SKUs and built into a panel per brand, customer and channel, read from and written back to PostgreSQL.
  • Per-SKU model selection: Prophet-style Ridge regression and LightGBM are fitted and each SKU keeps the model with the lowest wMAPE; ETS and Croston act as fallbacks for short or intermittent series.
  • Root causes: every run stores forecasts with root-cause metrics, and an LLM turns them into a plain-language explanation of what drove the change.
  • Dashboard: a FastAPI dashboard with Chart.js shows forecasts, accuracy and explanations to the planning team.
Forecasting pipeline: PostgreSQL forecast data, SKU mapping and panel build, model selection between Ridge + LightGBM with ETS/Croston fallbacks, forecast and root-cause metrics stored back in PostgreSQL, an LLM explanation step, and a FastAPI dashboard with Chart.js
Data → per-SKU model choice → forecasts and root causes → explanation → dashboard.

03Results

  • ~15%

    lower wMAPE than the previous forecasting baseline

  • 3levels

    forecasts per brand, customer and channel

  • Per SKU

    best model chosen by wMAPE, with ETS/Croston fallbacks

04What I'd improve next

  • Experiment tracking: log every run, model choice and wMAPE in MLflow so accuracy changes can be traced to data or model changes.
  • Drift alerts: flag SKUs whose error jumps between runs so planners review them before the numbers are used.

Enterprise project. The ~15% wMAPE improvement is real; the sales and demand data shown in screenshots and demos is randomized because the real data is confidential.