CutoffSplitter
Cutoff window splitter.
Split time series at given cutoff points into a fixed-length training and test set.
Here the user is expected to provide a set of cutoffs (train set endpoints), which using the notation provided in BaseSplitter, can be written as \((k_1,\ldots,k_n)\) for integer based indexing, or \((t(k_1),\ldots,t(k_n))\) for datetime based indexing.
For a cutoff \(k_i\) and a window_length \(w\) the training window is \((k_i-w+1,k_i-w+2,k_i-w+3,\ldots,k_i)\). Training window’s last point is equal to the cutoff.
Test window is defined by forecasting horizons relative to the end of the training window. It will contain as many indices as there are forecasting horizons provided to the fh argument. For a forecasting horizon \((h_1,\ldots,h_H)\), the test window will consist of the indices \((k_n+h_1,\ldots, k_n+h_H)\).
The number of splits returned by .get_n_splits is then trivially equal to \(n\).
The sorted array of cutoffs returned by .get_cutoffs is then equal to \((t(k_1),\ldots,t(k_n))\) with \(k_i<k_{i+1}\).
Schnellstart
from sktime.split.cutoff import CutoffSplitter
estimator = CutoffSplitter(cutoffs: list | ndarray | Index, fh=1, window_length: int | float | Timedelta | timedelta | timedelta64 | DateOffset=10)Parameter(3)
- cutoffslist or np.ndarray or pd.Index
Cutoff points, positive and integer- or datetime-index like. Type should match the type of
fhinput.- fhint, timedelta, list or np.ndarray of ints or timedeltas
Type should match the type of
cutoffsinput.- window_lengthint or timedelta or pd.DateOffset
Beispiele
>>> import numpy as np
>>> from sktime.split import CutoffSplitter
>>> ts = np. arange (10)
>>> splitter = CutoffSplitter (fh = [2, 4 ], cutoffs = np. array ([3, 5 ]), window_length = 3)
>>> list (splitter. split (ts)) [(array([1, 2, 3]), array([5, 7])), (array([3, 4, 5]), array([7, 9]))]