Skip to content
ML Academy

Time series and forecasting · insight-0237

Fit normalisation statistics at each cutoff, never on the full time series

Evidence type
documented fact
Difficulty
easy
Roles
Data scientist, ML engineer
Industries
cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    A notebook standardises the whole series with its mean and standard deviation, then runs a rolling-origin backtest.

  2. Action

    Put scaling, imputation and any target transformation inside the per-cutoff pipeline so each origin fits them on its own training window only.

  3. Reason

    Preprocessing fitted on data that includes the test period leaks test information; for time series the leak is information from the future.

  4. Boundary

    Neural forecasters, ML forecasts with scaled inputs, PCA on sensor panels.

Symptom or risk

Every training window has seen the future mean and spread, so level shifts after the cutoff are partly anticipated and the backtest is optimistic.

Exceptions

Fixed physical transformations with no fitted parameters (unit conversion, log) carry no leak.

Trade-offs

Refitting preprocessing per cutoff costs compute; cache by cutoff.

Pitfalls

Reusing a scaler fitted in a separate exploratory notebook.

Lessons and concepts

Claims and their sources