Time series and forecasting · insight-1202
Fit smoothers, interpolation and seasonal adjustment inside each backtest origin, because they look forward
- Evidence type
- documented fact
- Difficulty
- medium
- Roles
- Data scientist, ML engineer
- Industries
- cross-industry
Summary: situation, action, reason, boundary
Situation
A series is cleaned once with STL seasonal adjustment, centred moving averages and linear interpolation of gaps, and then split into train and test.
Action
Put cleaning in the per-origin pipeline. At each cutoff, interpolate only from past values, use one-sided filters, and decompose the training window alone. Compare against the pre-cleaned backtest to size the gap.
Reason
A moving average estimates the value at time t from observations on both sides of t, so any two-sided step applied before the split smuggles the future into the late training rows.
Boundary
Any pipeline with decomposition, centred rolling statistics, interpolation or outlier replacement.
Symptom or risk
A centred filter and interpolation use values on both sides of a point, so training data near the cutoff contain information from the test period.
Exceptions
Cleaning that depends only on past data (a causal filter, fixed business rules) can be applied once.
Trade-offs
Refitting the cleaning at every origin multiplies compute and makes results slightly worse, which is the honest number.
Pitfalls
Using a one-sided rolling mean for features but a two-sided one for the target adjustment.
Lessons and concepts
Claims and their sources
A moving average estimates the trend-cycle at time t by averaging observations on both sides of t, so no estimate is available for the first and last few observations unless a different method is used.