make_reduction(estimator, strategy='recursive', window_length=10, scitype='infer', transformers=None, pooling='local', windows_identical=True)[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.

estimatoran estimator instance

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

strategystr, default=”recursive”

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

window_lengthint, default=10

Window length used in sliding window transformation.

scitypestr, default=”infer”

Legacy argument for downwards compatibility, should not be used. make_reduction will automatically infer the correct type of estimator. This internal inference can be force-overridden by the scitype argument. Must be one of “infer”, “tabular-regressor” or “time-series-regressor”. If the scitype cannot be inferred, this is a bug and should be reported.

transformers: list of transformers (default = None)

A suitable list of transformers that allows for using an en-bloc approach with make_reduction. This means that instead of using the raw past observations of y across the window length, suitable features will be generated directly from the past raw observations. Currently only supports WindowSummarizer (or a list of WindowSummarizers) to generate features e.g. the mean of the past 7 observations. Currently only works for RecursiveTimeSeriesRegressionForecaster.

pooling: str {“local”, “global”}, optional

Specifies whether separate models will be fit at the level of each instance (local) of if you wish to fit a single model to all instances (“global”). Currently only works for RecursiveTimeSeriesRegressionForecaster.

windows_identical: bool, (default = True)

Direct forecasting only. Specifies whether all direct models use the same X windows from y (True: Number of windows = total observations + 1 - window_length - maximum forecasting horizon) or a different number of X windows depending on the forecasting horizon (False: Number of windows = total observations + 1 - window_length - forecasting horizon). See pictionary below for more information.

Please see below a graphical representation of the make_reduction logic using the
following symbols:

y = forecast target. x = past values of y that are used as features (X) to forecast y * = observations, past or future, neither part of window nor forecast.

Assume we have the following training data (14 observations): |----------------------------| | * * * * * * * * * * * * * *| |----------------------------|

And want to forecast with window_length = 9 and fh = [2, 4].

By construction, a recursive reducer always targets the first data point after the window, irrespective of the forecasting horizons requested. In the example the following 5 windows are created: |--------------------------- | | x x x x x x x x x y * * * *| | * x x x x x x x x x y * * *| | * * x x x x x x x x x y * *| | * * * x x x x x x x x x y *| | * * * * x x x x x x x x x y| |----------------------------|

Direct Reducers will create multiple models, one for each forecasting horizon. With the argument windows_identical = True (default) the windows used to train the model are defined by the maximum forecasting horizon. Only two complete windows can be defined in this example: fh = 4 (maxium of fh = [2, 4]) |--------------------------- | | x x x x x x x x x * * * y *| | * x x x x x x x x x * * * y| |----------------------------| All other forecasting horizon will also use those two windows. fh = 2 |--------------------------- | | x x x x x x x x x * y * * *| | * x x x x x x x x x * y * *| |----------------------------| With windows_identical = False we drop the requirement to use the same windows for each of the direct models, so more windows can be created for horizons other than the maximum forecasting horizon: fh = 2 |--------------------------- | | x x x x x x x x x * y * * *| | * x x x x x x x x x * y * *| | * * x x x x x x x x x * y *| | * * * x x x x x x x x x * y| |----------------------------| fh = 4 |--------------------------- | | x x x x x x x x x * * * y *| | * x x x x x x x x x * * * y| |----------------------------|

Use windows_identical = True if you want to compare the forecasting performance across different horizons, since all models trained will use the same windows. Use windows_identical = False if you want to have the highest forecasting accuracy for each forecasting horizon.

estimatoran Estimator instance

A reduction forecaster



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


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