A chronological split is necessary but not sufficient
Equity observations arrive in time, and a research process should not learn from outcomes that occur after its decision. Randomly shuffling stock-date rows can put near-identical market conditions and overlapping future returns on both sides of a split. A chronological design respects ordering, but it still leaks if training labels extend into the evaluation period.
The scikit-learn TimeSeriesSplit documentation describes ordered train-test splits and a gap parameter. It is a software reference, not an automatic solution to financial label overlap. Its gap counts samples, which may not correspond to trading sessions in a multi-stock panel. A research implementation must translate its actual timestamps and outcome intervals into explicit eligibility rules.
Work with each label's information interval
Assume a fictional signal at session s predicts returns over sessions s+1 through s+20. A model is frozen after session 100 and first evaluated on decisions at session 101. The label for a decision at session 80 ends at 100 and can be known at the freeze. A decision at session 90 has a label ending at 110 and cannot be used then.
Simply assigning all decision dates through 100 to training would include those future outcomes. Remove or defer records whose labels have not matured by the training cutoff. For other cross-validation designs, purge observations whose label intervals overlap evaluation intervals and consider an embargo appropriate to the dependence structure. A fixed row gap chosen without examining horizons does not establish separation.
Keep the panel and preprocessing causal
Group all stocks from the same decision date consistently across folds. Otherwise a model can train on one stock's future response during a market event and be tested on another stock from the same event. Standardization parameters, imputation models, feature selection and hyperparameter choices must also respect the training boundary. A clean final estimator cannot repair preprocessing fitted on future data.
Distinguish legitimate historical warmup from forbidden outcomes. Test-period features can use trailing prices known before their decision, including earlier training-period prices. They cannot use later returns or revised accounting values unavailable then. Record the feature lookback, label end, release timestamp and decision timestamp separately so an automated audit can evaluate each dependency rather than guessing from a row date.
Freeze decisions before interpreting the final period
Use inner development periods for choosing model settings and a genuinely later period for the declared evaluation. If the final period influences new features, cost assumptions or exit selection, it becomes development evidence and must be labelled accordingly. Repeatedly renaming the latest slice out-of-sample does not create untouched information. Keep a record of when results were first inspected.
Report fold dates, purged counts, usable observations and the reason each record was removed. Overlapping horizons also affect uncertainty estimates even after leakage is prevented, so do not count every row as independent evidence. This guide supplies a fictional session schedule, not a tested strategy. Passing these data-flow checks establishes procedural correctness, not predictive skill or an independent economic validation sample.
Inspect the example
| Fictional signal session | Outcome sessions | Label known after session 100? | Training decision |
|---|---|---|---|
| 80 | 81-100 | Yes | Eligible if other inputs qualify |
| 90 | 91-110 | No | Remove from this fit |
| 100 | 101-120 | No | Remove from this fit |
| 101 | 102-121 | No | Later evaluation record |
Sources & reproduction
Primary references support the definitions and method. Numerical examples are illustrative unless a source record is explicitly identified.