TECHNOLOGY

TimeSeriesSplit gap: row separation and information availability differ

In this article
THE QUICK TAKE

TimeSeriesSplit gap excludes a number of observations; proving that each feature was available at prediction time requires a separate timestamp contract.

The splitter operates on an ordered sequence

TimeSeriesSplit constructs training and test indices for time-ordered data. Its successive training sets normally expand unless constrained by the configured maximum training size. This models a different evaluation setting from random folds that can train on later observations and evaluate earlier ones.

Prepare the ordering before splitting. A sequence sorted by ingestion batch may differ from the event timeline the model is supposed to predict. Keep the timestamp definition with the dataset rather than assuming the physical row order already has the desired temporal meaning.

Gap counts observations, not calendar time

The documented gap parameter excludes observations from the end of a training set before its test set. It does not interpret an arbitrary timestamp column as a duration. The API also notes equal spacing when comparable fold durations are required.

For an irregular stream of support events, the same row gap can represent very different elapsed periods. If the intended exclusion is a time interval, construct or validate that boundary explicitly. A successful split call does not establish that the desired calendar separation was achieved.

Event time and availability need an agreement

A feature can describe an old event yet arrive or be corrected later. Sorting by event time alone does not prove that the feature was available when a prediction would have been made. Preserve the relevant availability or publication information when the evaluation question requires it.

Feast documents point-in-time joins against each entity row’s timestamp, with a lookback bounded by the feature view’s TTL. That contract helps explain historical selection, but the source’s timestamp meaning still matters. A mislabeled timestamp can make a technically valid join represent the wrong historical knowledge state.

Labels can reveal the future too

A target may require waiting for an outcome to become known. Decide which training observations had usable labels at each training cutoff. Leaving a gap in the input indices does not automatically account for every outcome horizon or delayed correction.

Review representative rows around each boundary. Check their event timestamps, feature availability and label availability together. This proposed inspection can expose a hidden future dependency that remains invisible in the arrays of train and test indices.

Report the realized temporal experiment

Record the training cutoff, test interval, excluded interval, timestamp conventions and preprocessing scope for each fold. Keep transformations learned from data within the training boundary. If unequal sampling changes fold durations, state that when comparing scores.

TimeSeriesSplit provides an indexing mechanism. Temporal validity comes from connecting those indices to the actual availability of information, not from the splitter’s name alone. These checks define a reproducible evaluation design without claiming a new predictive result.

Primary references

scikit-learn TimeSeriesSplit.

Feast point-in-time joins.

scikit-learn cross-validation guide.

Related explanations: Independent split design; Timestamped provenance.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles