Splitter
ExpandingCutoffSplitter
Expanding cutoff splitter for time series data.
Quickstart
python
from sktime.split.expandingcutoff import ExpandingCutoffSplitter
estimator = ExpandingCutoffSplitter(cutoff, fh, step_length)Parameters(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.
Examples
>>> 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]))]