How to Build a Demand Forecast Without Losing Your Mind

Maria Surtaeva16 Nov 2022

Problem

Samokat's business asked to automate purchasing for all products and all dark stores, old and new. One forecast point is the demand for one product at one dark store on one day: 2 million points with a six-week horizon, more than 87 million forecasts every day. A boosting model trained on raw sales breaks on new products and stores, on sales distorted by stock-outs and markdowns, on trends, and on outliers. The business cares most about the 5-10% most marginal products, which an average error hides.

Example from the article: a sunflower oil series that never sold more than 15 bottles a day suddenly sold more than 150 a day, the kind of surprise nobody is insured against.

Solution in brief

Samokat keeps gradient boosting as the base model and wraps it in modules that fix its weaknesses. The target is cleaned (demand recovered for low availability, markdown sales excluded), new stores borrow forecasts from similar stores found by kNN, and a statistical module biases the finished forecast when errors keep one sign or a trend appears.

Questions this case answers
  • How to forecast demand for a very large number of series when the model must handle new entities, supply shortages and outliers
  • How to correct a tree-based forecast that under-predicts when the underlying demand level is shifting
  • How to forecast demand for millions of product and store combinations when the business wants everything automated?
  • How to forecast sales of new products and for newly opened stores that have no history?

Tools and methods

  • Gradient boosting — base forecast model with many sales-independent features
  • k nearest neighbors on store characteristics — forecast for new dark stores from the most similar ones
  • Demand recovery for availability — target transformation that undoes stock-out censoring
  • Statistical adjustment module with trend detector — bias added to the forecast from the error distribution
Continue reading — it's free

Google or a one-time email code. No password.