Rainbow Supermarket · POC 2025

SKU-Level
Demand Intelligence

A global LightGBM model forecasting daily sales quantity for 20,000+ SKUs across five product categories, trained on 2+ years of transaction history with 8 promotion features.

Explore Forecasts → Evaluate Accuracy
20,412
Eligible SKUs
5
Categories
46
Day Horizon
22
Features

Forecasting Models

Five models ranging from classical statistical methods to deep learning, each with distinct mathematical foundations. All share the same 22-feature input set and use recursive multi-step forecasting over the 46-day horizon.

LightGBM Global · All SKUs

Gradient boosted decision trees. At each round a new tree fits the gradient of the loss, iteratively correcting prior mistakes. Leaf-wise (best-first) growth and GOSS sampling keep training fast.

ŷi = Σk=1500 η · fk(xi)   (η = 0.05)
Gain = ½[GL²/(HL+λ) + GR²/(HR+λ) − (GL+GR)²/(HL+HR+λ)] − γ
w* = −G / (H + λ)
500 trees depth 6 31 leaves GOSS sampling
LSTM Global · 500-SKU sample

Long Short-Term Memory network. Three learned gates control what the cell forgets, writes, and reads at each time step, enabling it to capture long-range seasonal dependencies across a 28-day input window.

ft = σ(Wf·[ht-1, xt] + bf)  forget
it = σ(Wi·[ht-1, xt] + bi)  input
ct = ft⊙ct-1 + it⊙tanh(Wc·[ht-1, xt] + bc)
ht = σ(Wo·[ht-1,xt]+bo) ⊙ tanh(ct)
2 layers 64 hidden seq = 28 days Huber loss
Prophet Per-SKU · on demand

Additive decomposition model (Meta). Separates the signal into a piecewise linear trend with automatic changepoints, a Fourier-series weekly seasonality, and optional holiday effects.

y(t) = g(t) + s(t) + h(t) + εt
g(t): piecewise linear trend + changepoints
s(t) = Σn[ancos(2πnt/P) + bnsin(2πnt/P)]
P = 7 days (weekly period)
additive mode weekly seasonality per-SKU cache
Holt-Winters Per-SKU · on demand

Triple exponential smoothing. Three exponentially weighted equations track level, trend, and seasonality separately. Optimised smoothing parameters α, β, γ are fit per SKU.

lt = α(yt/st-m) + (1−α)(lt-1+bt-1)
bt = β(lt−lt-1) + (1−β)bt-1
st = γ(yt/lt) + (1−γ)st-m
ŷt+h = (lt + h·bt) · st−m+h
period m = 7 αβγ optimised 3-level fallback
Ensemble Combines all models

Simple averaging of selected model outputs. When individual models make uncorrelated errors, the ensemble variance shrinks as 1/K, producing a more stable and robust forecast.

ŷens = 1K Σk=1K ŷk
Var(ŷens) ≈ 1K · σ²
(holds when model errors are uncorrelated)
simple mean K = selected models variance ∝ 1/K

22 Shared Input Features (all models)

Lag · 7
lag_1 lag_2 lag_3
lag_7 lag_14 lag_21 lag_28
Rolling · 3
roll7   roll14   roll28
(shift-1, no leakage)
Calendar · 3
day_of_week
day_of_month   month
Promotion · 8 + id
is_promo   discount_depth
is_bundle   is_threshold
is_warehouse   is_online
days_since_promo   roll_promo_7   sku_id
🤖

LLM Auto-Feature Engineering

TBD

The current 22-feature set is hand-crafted from domain knowledge. The next phase integrates a large language model as an automatic feature engineering agent: given a natural-language description of the forecasting task and the available data schema, the LLM proposes, evaluates, and selects the most predictive feature combinations — without manual specification.

① Propose

LLM reads the data schema and task description, then generates a ranked candidate feature list — lag windows, interaction terms, external signals — in natural language.

② Evaluate

Each candidate feature is automatically constructed and scored via cross-validated SHAP importance or permutation importance on a held-out fold.

③ Select

The LLM synthesises the evaluation results and outputs the final feature set, with a plain-English rationale for each inclusion or exclusion decision.

Walk-Forward CV Results — LightGBM vs Baselines (3 folds · 28-day horizon)

Test-set MAE
22.28
LightGBM · cost units
vs Naïve baseline
−21.9%
MAE improvement
Short-SKU CV MAE
16.11
112–179 day history
Long-SKU CV MAE
23.47
≥ 180 day history
ℹ️ MAE metrics are from the cost-of-sales model (v2 notebook). The POC evaluation uses the FA metric on sales quantity computed weekly. Upload actual sales in the Evaluate section to compute your FA score.

📐 POC Accuracy Metric — FA Formula

FA  =  1 − |F − A| / ((F + A) × 2)

F = weekly forecast total per SKU  ·  A = weekly actual total per SKU

If F or A < 0 → set to 0
If F = A = 0 → FA = 100%
FA is clipped to [0%, 100%]

Weighted aggregation (3 steps):

1. Aggregate daily predictions and actuals to weekly totals per SKU (weeks: Jul 1–7, 8–14, 15–21, 22–28 …)
2. Each SKU's weight = actual sales in prior 4 weeks ending the day before the evaluation week starts
3. Weighted average FA → category level (8802–8807) → overall
Weighted FA = Σ(FAi × wi) / Σwi

wi = SKUi actual sales in prior 4 weeks

Prediction Explorer

Select a model, SKU and date range — run live predictions via the local Python server, or browse pre-computed results in static mode.

Checking local server…
Start uvicorn api_server:app --port 8000 for live multi-model predictions

1 Load Forecast Data (static mode — or connect local server above)

or

Accuracy Evaluator

Upload your actual sales file. The FA metric is computed in-browser using the exact POC formula — no data leaves your machine.

⚠️ Load forecast data in the Prediction Explorer first.