All lessons in Machine Learning Engineering: Reliable Predictive Models

Forecasting with Rolling Origins

Build horizon-aware backtests with gaps, delayed features, and seasonal baselines.

35 minutes · Members lesson · preview

What you will learn

  • Lay out a rolling-origin backtest with an explicit label-delay gap and forecast horizon for a stated refit schedule.
  • Build lag features whose window ends before each dispatch time so that no label unknown at prediction time leaks into the row.
  • Compare a late-delivery model against a seasonal naive baseline across ordered folds and summarise the result without overstating certainty.

The parcel workbook generates independent synthetic rows with no clock, so its shuffled development split is a fair rehearsal for that data. A real dispatch desk is different. Parcels arrive in order, the outcome of a dispatch is only known days later, and the late rate drifts with weather, staffing and the weekly rhythm. This optional lesson treats the carrier as a forecasting problem and shows how to rehearse the real deployment: fit on the past, predict a block of the near future, move the origin forward, repeat. Everything here is a design extension with hand-computed fixtures; the base workbook has no timestamps or depots.

Choose another lesson