Back to models
Splitter

SlidingGreedySplitter

Splitter that combines sliding window with greedy splitting.

Quickstart

python
from sktime.split.slidinggreedy import SlidingGreedySplitter

estimator = SlidingGreedySplitter(train_size: int | float, test_size: int | float, folds: int=5, step_length: int | None=None)

Parameters(4)

train_sizeint or float
If int: the number of steps included in the train set of each fold.

Formally, steps are consecutive iloc indices.

test_sizeint or float
If int: the number of steps included in the test set of each fold.

Formally, steps are consecutive iloc indices.

foldsint, default = 5
The number of folds.
step_lengthint, optional

The number of steps advanced for each fold. Defaults to test_size.

Examples

>>> import numpy as np
>>> from sktime.split import SlidingGreedySplitter
>>> ts = np. arange (10)
>>> splitter = SlidingGreedySplitter (train_size = 4, test_size = 2, folds = 2)
>>> list (splitter. split (ts)) [(array([2, 3, 4, 5]), array([6, 7])), (array([4, 5, 6, 7]), array([8, 9])) ]