A chronological train and validation split can still reuse the same raw robot measurements. The issue arises when the split acts on rows of overlapping feature windows. A training row near the boundary may start before the cut while using observations, or even a prediction label, from after it. The split can look clean in a table of window start times. It needs a second check that follows the original observation identifiers used by every row.
Trace the feature samples and the label
The synthetic fixture below ran with NumPy 2.5.2. It uses 16 consecutive raw sample IDs. Each training record takes four positions of history and assigns the immediately following sample as its label. The example uses IDs as values so a reader can inspect reuse directly. In a real system, the features could use measured motor current or encoder error, while the label could be a future quantity derived from the same acquisition. This fixture does not train a model or claim a particular effect on prediction accuracy.
import numpy as np
from numpy.lib.stride_tricks import sliding_window_view
raw_id = np.arange(16)
cut = 8
width = 4
records = sliding_window_view(raw_id, width + 1)
features = records[:, :width]
labels = records[:, width]
chronological_rows = features[:, 0] < cut
shared = np.intersect1d(records[chronological_rows],
records[~chronological_rows])
assert shared.tolist() == [8, 9, 10, 11]
train = labels < cut
validation = features[:, 0] >= cut
crossing = ~(train | validation)
assert records[train, 0].tolist() == [0, 1, 2, 3]
assert records[validation, 0].tolist() == [8, 9, 10, 11]
assert records[crossing, 0].tolist() == [4, 5, 6, 7]
assert np.intersect1d(records[train], records[validation]).size == 0
assert np.array_equal(records[train], sliding_window_view(raw_id[:cut], 5))
assert np.array_equal(records[validation], sliding_window_view(raw_id[cut:], 5))
Setting the cut at raw sample 8 and splitting on window start produces eight candidate training rows and four validation rows. The last candidate training row starts at raw sample 7, uses features from samples 7 through 10, and takes its label from sample 11. The first validation record begins at 8. The two partitions therefore share four raw IDs. Chronological row order was preserved, but the validation data had already contributed to training examples.
For a holdout with no shared raw observations, the code keeps a training record only when its label is before 8. It keeps a validation record only when its features start at or after 8. Records starting at 4 through 7 cross the boundary and are left out. The remaining records agree with constructing windows separately on the two parts of the raw sequence. This test includes the prediction label in the overlap check, which is important even when the feature arrays themselves appear distinct.
Define the information that each row uses
For a simple fixed-width next-step problem, the earliest feature ID and latest label ID give the full interval. A production feature may also depend on trailing filters, lagged sensors, a resampler, or a signal aligned from a different clock. A label may summarize a future interval instead of a single observation. Include the complete span of those dependencies. If the spans are recorded for each row, a validation tool can test the split without reimplementing the full feature computation.
Scikit-learn's TimeSeriesSplit supports a gap between training and test rows. The gap counts units of the array passed to the splitter. If that array is already a table of windows, those units are windows, which may have a different stride and coverage from raw samples. A gap expressed as a fixed row count also has different implications after dropping records with missing measurements. Inspect the raw-time intervals or sample IDs used by the resulting partitions before treating the gap as sufficient. With irregular sampling, decide whether the validation periods need comparable wall-clock durations and compute them from timestamps.
Match the holdout to deployment
A strict disjoint holdout, like the example here, is useful when the goal is to test performance on truly separate observations. A deployment may instead legitimately use an earlier run's available history to initialize a forecast. In that case write down which past data would be accessible at the forecast time. Keep parameters estimated from training data separate from information available only in the holdout. For example, fitting a normalizer on the full acquisition before splitting can introduce a separate source of leakage even when no windows cross the boundary.
For robots whose behavior is correlated within a route, shift, or machine, also consider whether the holdout needs to separate whole operating groups. Consecutive records can be disjoint at the raw-sample level yet come from the same repeating motion. A split by time measures performance on a later period of the same process. A split that reserves other machines or routes can answer a different deployment question. Report which one was used and keep evaluation examples tied to their original run IDs.
A small test that logs the first and last feature observation, the label's time span, and the split assignment can catch boundary errors early. Include the last admitted training row, the first validation row, and at least one row that should be rejected. This gives a reviewer a direct way to see that the model is evaluated with the information it would actually have at prediction time.
Sources
NumPy, sliding_window_view
https://numpy.org/doc/stable/reference/generated/numpy.lib.stride_tricks.sliding_window_view.html
scikit-learn, TimeSeriesSplit
https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html