ForecastingHorizonSplitter
Splitter that creates a single train/test split based on a forecasting horizon.
Handles both relative and absolute forecasting horizons.
For a single series and a forecasting horizon correponsing to absolute time points \((h_1, h_2, \ldots, h_H)\), splits into training and test set as follows:
training set: all time points strictly before \(h_1\)
test set: all time points \((h_1, h_2, \ldots, h_H)\)
For relative forecasting horizons, the last time point in the training set is assumed to be identical with \(h_H\), i.e., the last time point in the series to split.
More precisely, if \(t_1, t_2, \ldots, t_N\) are the time points in the series, and \(h_1, h_2, \ldots, h_H\) are the relative forecasting horizons, i.e., time offsets, then training and test sets are defined as follows:
training set: all time points \(t_i\) such that \(t_i \lneq t_N - h_H\)
test set: if \(t_j\) is the last time point in the training set, then the test set consists of the time points \((t_j + h_1, t_j + h_2, \ldots, t_j + h_H)\).
Users should note that, for non-contiguous forecasting horizons, the union of training and test sets will not cover the entire time series.
For zero or negative relative forecasting horizons, the training set will contain time points that are later than some time points in the test set, leading to leakage - users should ensure this is intentional when requested.
Schnellstart
from sktime.split.fh import ForecastingHorizonSplitter
estimator = ForecastingHorizonSplitter(fh)Parameter(1)
- fhForecastingHorizon or compatible input
- Forecasting horizon that defines the test set. Must be all out-of-sample if relative.