Skip to content

Out-of-Sample & Walk-Forward Testing

The cleanest defence against overfitting is to hold some data back. Build and tune the rule on an in-sample period, then test it once on out-of-sample data it has never seen. Walk-forward testing repeats the idea: tune on years 1-3 and test on year 4; slide forward, tune on years 2-4 and test on year 5; and so on, stitching the test years together. If the stitched out-of-sample results hold up, the edge is more believable. The catch: the moment you peek at the test data and re-tune, it stops being out-of-sample.

Key points

  • Split the history: tune on the first part, judge only on the part you hid
  • Walk-forward: roll the tuning window forward and collect only the out-of-sample results
  • If you look at the test result and then adjust the rule, the hold-out is used up — you need new data

Related lessons

This lesson ends with a 5-question quiz.

The Learn map