From Excel to ML: how we learned to forecast ingredient consumption

Vladimir Varfolomeev30 Jun 2022

Problem

Pizzeria managers order ingredients every two weeks or more often, and the manual Excel forecast took hours per order. The Dodo Pizza chain (600+ pizzerias in Russia) lost 1-2% of revenue in one year to "stops", when a product could not be sold because an ingredient ran out. Over-ordering costs too: write-offs of perishables and cash frozen in stock. A median forecast over recent weeks removed the manual work but ignores holidays, campaigns, menu changes and long history.

Example from the article: short series were wrongly sent to boosting, and the ciabatta forecast reached 100K pieces from day 10.

Solution in brief

Keep the median forecast as the baseline and beat it with ML. Prophet worked but needed one model per ingredient and pizzeria, which was too slow. Gradient boosting in ETNA, with one model per cluster of similar ingredients in a pizzeria, was faster and more accurate. Series shorter than two months stay on the median.

Questions this case answers
  • How to forecast demand for hundreds of items across hundreds of locations when series differ in length and one model per series is too slow to retrain nightly
  • How to estimate the money lost to forecast errors when stock-outs hide true demand and over-ordering causes write-offs
  • How to forecast ingredient consumption for hundreds of outlets so that stock-outs and write-offs both fall?
  • How to forecast many short and long time series within a fixed nightly compute window?

Tools and methods

  • Median baseline — median consumption of the last 3 weeks, weekdays and weekends separately.
  • Prophet — first ML iteration, one model per ingredient and pizzeria, custom holiday calendar.
  • ETNA — Tinkoff's framework: lags, rolling statistics, validation, gaps and anomalies.
  • Gradient boosting — CatBoost with features, trained on clusters of similar ingredient series.
  • WAPE and bias — forecast quality, plus a money-based loss metric.
Continue reading — it's free

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