Provides train/test indices to split time-ordered data, where other
cross-validation methods are inappropriate, as they would lead to training
on future data and evaluating on past data.
To ensure comparable metrics across folds, samples must be equally spaced.
Once this condition is met, each test set covers the same time duration,
while the train set size accumulates data from previous splits.
This cross-validation object is a variation of KFold.
In the k-th split, it returns the first k folds as the train set and the
(k+1)-th fold as the test set.
Note that, unlike standard cross-validation methods, successive
training sets are supersets of those that come before them.
Used to limit the size of the test set. Defaults to
n_samples//(n_splits+1), which is the maximum allowed value
with gap=0.
gap : int, default=0
Number of samples to exclude from the end of each train set before
the test set.
Notes
The training set has size i*n_samples//(n_splits+1)+n_samples%(n_splits+1) in the i th split,
with a test set of size n_samples//(n_splits+1) by default,
where n_samples is the number of samples. Note that this
formula is only valid when test_size and max_train_size are
left to their default values.