← Lessons

quiz vs the machine

Gold1410

Machine Learning

Walk Forward Validation

Evaluating forecasts by repeatedly training on the past and testing on the next slice.

4 min read · core · beat Gold to climb

Walk Forward Validation

Ordinary cross validation shuffles data, which is invalid for time series because it lets a model train on the future. Walk forward validation keeps time order intact.

The procedure

  • Train on an initial block of early data.
  • Forecast the next slice and score it against the truth.
  • Extend the training window to include that slice, then forecast the next one.
  • Repeat marching forward through the series.

This mimics how a model is used in production, where you always predict the unseen next period from the known past.

Expanding and sliding

  • An expanding window grows the training set at each step, using all history.
  • A sliding window keeps a fixed length, dropping the oldest data so the model focuses on recent behavior.

Why it matters

Walk forward validation gives an honest estimate of forecast error and exposes how performance changes over time. It costs more compute because the model is refit at each step, but it prevents the optimistic bias of shuffled splits.

Key idea

Walk forward validation trains on the past and tests on the next slice repeatedly, giving an honest time aware estimate of forecast error.

Check yourself

Answer to earn rating on the learn ladder.

1. Why is shuffled cross validation invalid for time series?

2. What is the difference between expanding and sliding windows?