Skip to content
← Walk-forward lesson
INTERACTIVE / VALIDATION DESIGN

See exactly
where the test begins.

Plan chronological training and test windows before fitting a model. Compare expanding and rolling histories, add a gap and reserve a final holdout.

Ordered row counts only · Runs in your browser · No data upload, model fitting or backtest

Plan the windows

The next fold advances by one test-window length. Only complete test windows are included. Maximum 100 folds.

TrainingGapTestFinal holdout

Every bar uses the same full-dataset scale. The exact ranges are listed below.

On-screen ranges: one-based, inclusive. CSV: zero-based, end-exclusive, for Python-style slicing.

FoldTraining rowsGap rowsTest rows
Get Python + worksheets ↓

How the schedule works

The first test begins after the initial training rows and the gap. Subsequent tests are adjacent and do not overlap. Training ends the specified number of gap rows before each test. An expanding window starts at the first row; a rolling window retains the initial training length.

A final holdout reserves the last N rows. An incomplete development tail is left unused. Earlier test rows can become later training rows once their information is available.

Read the worked example ↗

What the planner cannot decide

It does not inspect timestamps, labels or feature availability. A row gap does not automatically prevent overlapping labels or leakage. Training and test rows need not represent equal durations when observations are irregular.

These boundaries do not select parameters, reserve an inner validation set, carry trading positions between folds or establish independent performance samples. Design those steps explicitly.

Compare with scikit-learn’s splitter documentation ↗