Zurück zu den Modellen
Splitter

ExpandingCutoffSplitter

Expanding cutoff splitter for time series data.

This splitter combines elements of ExpandingWindowSplitter and CutoffSplitter to create training and testing sets. Unlike ExpandingWindowSplitter which begins with a fixed initial window, this splitter uses a specific cutoff point as the starting window for the training set. The training set then expands incrementally in each split until it reaches the end of the series.

The test set is defined by a forecast horizon relative to the last point in the training set, containing as many subsequent indices as specified by the fh parameter.

The valid types of y-index and cutoff pairings are datelike-datelike, datelike-int, and int-int. When a datelike index is combined with an int cutoff, the cutoff functions as an iloc indexer. When an int index is paired with a positive int cutoff, the cutoff serves as a loc indexer. If the int cutoff is negative, it functions as an iloc indexer.

For example for cutoff = 10, step_length = 1 and fh = [1, 2, 3, 4, 5, 6] here is a representation of the folds:

```

c

|---------------------|—-fh—-|------| | * * * * * * * * * * x x x x x x - - - | | * * * * * * * * * * * x x x x x x - - | | * * * * * * * * * * * * x x x x x x - | | * * * * * * * * * * * * * x x x x x x |

```

c = cutoff date or index.

* = training fold.

x = test fold.

Schnellstart

python
from sktime.split.expandingcutoff import ExpandingCutoffSplitter

estimator = ExpandingCutoffSplitter(cutoff, fh, step_length)

Parameter(3)

cutoff (int or pd.Timestamp):
The initial cutoff point in the series, which marks the beginning of the first test set.
fh (int, list, or np.array):
Forecasting horizon, determining the size and indices of the test sets. It can be an integer, a list, or an array.
step_length (int):
The step length to expand the training set size in each split.

Beispiele

>>> import pandas as pd
>>> from sktime.split import ExpandingCutoffSplitter
>>> date_range = pd. date_range (start = '2020-Q1', end = '2021-Q3', freq = 'QS')
>>> y = pd. DataFrame (index = pd. PeriodIndex (date_range, freq = 'Q'))
>>> cutoff = pd. Period ('2021-Q1')
>>> cv = ExpandingCutoffSplitter (cutoff = cutoff, fh = [1, 2 ], step_length = 1)
>>> list (cv. split (y)) [(array([0, 1, 2, 3]), array([4, 5])), (array([0, 1, 2, 3, 4]), array([5, 6]))]