SKU-level retail demand forecasting with LightGBM — leakage-safe feature engineering, rolling-origin backtesting and honest baselines, packaged as a tested, runnable Python library. Every number on this page comes from the repo's seeded benchmark.
Most forecasting demos train once, score once, and report a suspiciously good number. Production forecasting lives or dies on three things this project treats as first-class: leakage-safe features (every lag is shifted by at least the forecast horizon), rolling-origin evaluation (retrain at every cutoff, exactly how forecasts are consumed), and baselines that fight back (seasonal-naive and a 28-day moving average are scored on every fold).
The bundled simulator generates two years of daily SKU × store sales with weekly and annual seasonality, price elasticity, promo uplift, weather sensitivity and negative-binomial noise — with known ground truth, so the pipeline's correctness is assertable in CI rather than eyeballed.
Charts below render the actual output of demand-sense --skus 40 --stores 5 --folds 4 --horizon 7 — a 4-fold rolling-origin backtest over 146,200 rows (seeded, deterministic).
Total daily units across all 200 SKU × store series, 25–31 Dec 2025 (the last backtest fold). LightGBM tracks the holiday-week swing the naive baseline overshoots.
Mean weighted absolute percentage error across all 4 folds.
LightGBM gain-based feature importance, share of total.
generate_sales() with any panel of date, sku_id, store_id, price, promo, temp_c, units.