GapCrossValidator

class tscv.GapCrossValidator(gap_before=0, gap_after=0)[source]

Base class for all gap cross-validators

Implementations must define one of the following 4 methods: _iter_train_indices, _iter_train_masks, _iter_test_indices, _iter_test_masks.

abstract get_n_splits(X=None, y=None, groups=None)[source]

Returns the number of splitting iterations in the cross-validator

split(X, y=None, groups=None)[source]

Generate indices to split data into training and test set.

Parameters
Xarray-like, shape (n_samples, n_features)

Training data, where n_samples is the number of samples and n_features is the number of features.

yarray-like, of length n_samples

The target variable for supervised learning problems.

groupsarray-like, with shape (n_samples,), optional

Group labels for the samples used while splitting the dataset into train/test set.

Yields
trainndarray

The training set indices for that split.

testndarray

The testing set indices for that split.