Skip to content
All projects

Personal project · public or synthetic data

Sales forecasting on M5 (Walmart)

28-day forecasts for 30,490 product × store series, scored with the official competition metric.

Key results

blend 0.8 LightGBM + 0.2 TiDE
0.555
LightGBM alone
0.561
seasonal naive benchmark
0.847
M5 winner, for reference
0.520
Deep learning did not beat gradient boosting here, as in the competition itself; it still helps the blend, because its errors differ.

30,490 series, 28 days ahead

Forecast the next 28 days of daily unit sales for 30,490 product × store series (3 states, 10 stores, 3,049 products) from sales history, a calendar (holidays, events, SNAP days) and weekly prices, scored with the official WRMSSE on the competition’s real evaluation period, which is never used for any choice.

One global model, no leakage

Every sales feature is at least 28 days old, so one global model forecasts the whole horizon without recursion or leakage. LightGBM with a Tweedie objective (suited to intermittent counts), and TiDE, the MLP encoder–decoder of Das et al. (TMLR 2023), implemented in PyTorch. The blend weight is chosen on the validation fold.

The metric code reproduces the published M5 benchmarks exactly (seasonal naive 0.847, naive 1.752), so the numbers are comparable with the competition’s.

Scored on the competition’s real evaluation period

WRMSSE 0.555 for the blend, 0.561 for LightGBM, 0.774 for TiDE, against 0.847 for the seasonal naive benchmark; the M5 winner (5,558 teams) scored 0.520.

Aggregates are accurate and single items are noisy: RMSSE is about 0.2–0.4 for total, state and category sales but about 0.9–1.0 for individual items.

WRMSSE by model: naive, seasonal naive, TiDE, LightGBM and the blend, with the M5 winner as reference.
WRMSSE on the M5 evaluation period.Figure produced by the project code
RMSSE for each of the 12 aggregation levels: low for totals and categories, close to 1 for single items.
Error by aggregation level.Figure produced by the project code

Why not the winner’s score

Deep learning did not beat gradient boosting here, as in the competition itself; TiDE still helps the blend because its errors differ. The gap to the winner comes from many per-store, per-horizon LightGBM models and careful ensembling, where this project uses one model per family.