make_reduction#

make_reduction(estimator, strategy='recursive', window_length=10, scitype='infer', transformers=None)[source]#

Make forecaster based on reduction to tabular or time-series regression.

During fitting, a sliding-window approach is used to first transform the time series into tabular or panel data, which is then used to fit a tabular or time-series regression estimator. During prediction, the last available data is used as input to the fitted regression estimator to generate forecasts.

Parameters
estimatoran estimator instance

Either a tabular regressor from scikit-learn or a time series regressor from sktime.

strategystr, optional (default=”recursive”)

The strategy to generate forecasts. Must be one of “direct”, “recursive” or “multioutput”.

window_lengthint, optional (default=10)

Window length used in sliding window transformation.

scitypestr, optional (default=”infer”)

Must be one of “infer”, “tabular-regressor” or “time-series-regressor”. If the scitype cannot be inferred, please specify it explicitly. See scitype.

Returns
estimatoran Estimator instance

A reduction forecaster

References

1

Bontempi, Gianluca & Ben Taieb, Souhaib & Le Borgne, Yann-Aël. (2013). Machine Learning Strategies for Time Series Forecasting.

Examples

>>> from sktime.forecasting.compose import make_reduction
>>> from sktime.datasets import load_airline
>>> from sklearn.ensemble import GradientBoostingRegressor
>>> y = load_airline()
>>> regressor = GradientBoostingRegressor()
>>> forecaster = make_reduction(regressor, window_length=15, strategy="recursive")
>>> forecaster.fit(y)
RecursiveTabularRegressionForecaster(...)
>>> y_pred = forecaster.predict(fh=[1,2,3])