sktime.forecasting.compose

class sktime.forecasting.compose.DirectRegressionForecaster(regressor, window_length=10, step_length=1)[source]

Bases: sktime.forecasting.compose._reduce.ReducedTabularRegressorMixin, sktime.forecasting.compose._reduce._DirectReducer

Forecasting based on reduction to tabular regression with a direct reduction strategy. For the direct reduction strategy, a separate forecaster is fitted for each step ahead of the forecasting horizon

Parameters
  • regressor (sklearn estimator object) – Define the regression model type.

  • window_length (int, optional (default=10)) – The length of the sliding window used to transform the series into a tabular matrix

  • step_length (int, optional (default=1)) – The number of time steps taken at each step of the sliding window used to transform the series into a tabular matrix.

class sktime.forecasting.compose.DirectTimeSeriesRegressionForecaster(regressor, window_length=10, step_length=1)[source]

Bases: sktime.forecasting.compose._reduce.ReducedTimeSeriesRegressorMixin, sktime.forecasting.compose._reduce._DirectReducer

Forecasting based on reduction to time series regression with a direct reduction strategy. For the direct reduction strategy, a separate forecaster is fitted for each step ahead of the forecasting horizon

Parameters
  • regressor (sktime estimator object) – Define the type of time series regression model.

  • window_length (int, optional (default=10)) – The length of the sliding window used to transform the series into a tabular matrix

  • step_length (int, optional (default=1)) – The number of time steps taken at each step of the sliding window used to transform the series into a tabular matrix.

class sktime.forecasting.compose.EnsembleForecaster(forecasters, n_jobs=None)[source]

Bases: sktime.forecasting.base._sktime._OptionalForecastingHorizonMixin, sktime.forecasting.base._meta._HeterogenousEnsembleForecaster

Ensemble of forecasters

Parameters
  • forecasters (list of (str, estimator) tuples) –

  • n_jobs (int or None, optional (default=None)) – The number of jobs to run in parallel for fit. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors.

fit(y, X=None, fh=None)[source]

Fit to training data.

Parameters
  • y (pd.Series) – Target time series to which to fit the forecaster.

  • fh (int, list or np.array, optional (default=None)) – The forecasters horizon with the steps ahead to to predict.

  • X (pd.DataFrame, optional (default=None)) – Exogenous variables are ignored

Returns

self

Return type

returns an instance of self.

update(y, X=None, update_params=True)[source]

Update fitted parameters

Parameters
  • y (pd.Series) –

  • X (pd.DataFrame) –

  • update_params (bool, optional (default=True)) –

Returns

self

Return type

an instance of self

class sktime.forecasting.compose.MultioutputRegressionForecaster(regressor, window_length=10, step_length=1)[source]

Bases: sktime.forecasting.compose._reduce.ReducedTabularRegressorMixin, sktime.forecasting.compose._reduce._MultioutputReducer

Forecasting based on reduction to tabular regression with a multioutput reduction strategy. For the multioutput reduction strategy, a single forecaster is fitted simultaneously to all the future steps in the forecasting horizon

Parameters
  • regressor (sklearn estimator object) – Define the regression model type.

  • window_length (int, optional (default=10)) – The length of the sliding window used to transform the series into a tabular matrix

  • step_length (int, optional (default=1)) – The number of time steps taken at each step of the sliding window used to transform the series into a tabular matrix.

class sktime.forecasting.compose.RecursiveRegressionForecaster(regressor, window_length=10, step_length=1)[source]

Bases: sktime.forecasting.compose._reduce.ReducedTabularRegressorMixin, sktime.forecasting.compose._reduce._RecursiveReducer

Forecasting based on reduction to tabular regression with a recursive reduction strategy. For the recursive reduction strategy, a single estimator is fit for a one-step-ahead forecasting horizon and then called iteratively to predict multiple steps ahead.

Parameters
  • regressor (sklearn estimator object) – Define the regression model type.

  • window_length (int, optional (default=10)) – The length of the sliding window used to transform the series into a tabular matrix

  • step_length (int, optional (default=1)) – The number of time steps taken at each step of the sliding window used to transform the series into a tabular matrix.

class sktime.forecasting.compose.RecursiveTimeSeriesRegressionForecaster(regressor, window_length=10, step_length=1)[source]

Bases: sktime.forecasting.compose._reduce.ReducedTimeSeriesRegressorMixin, sktime.forecasting.compose._reduce._RecursiveReducer

Forecasting based on reduction to time series regression with a recursive reduction strategy. For the recursive reduction strategy, a single estimator is fit for a one-step-ahead forecasting horizon and then called iteratively to predict multiple steps ahead.

Parameters
  • regressor (sktime estimator object) – Define the type of time series regression model.

  • window_length (int, optional (default=10)) – The length of the sliding window used to transform the series into a tabular matrix

  • step_length (int, optional (default=1)) – The number of time steps taken at each step of the sliding window used to transform the series into a tabular matrix.

sktime.forecasting.compose.ReducedForecaster(regressor, scitype, strategy='recursive', window_length=10, step_length=1)[source]

Forecasting based on reduction

When fitting, a rolling window approach is used to first transform the target series into panel data which is then used to train a regressor. During prediction, the last available data is used as input to the fitted regressors to make forecasts.

Parameters
  • scitype (str) – Can be ‘regressor’ or ‘ts-regressor’

  • strategy (str {"direct", "recursive", "multioutput"}, optional) – Strategy to generate predictions

  • window_length (int, optional (default=10)) –

  • step_length (int, optional (default=1)) –

  • regressor (a regressor of type given by parameter scitype) –

References

..[1] Bontempi, Gianluca & Ben Taieb, Souhaib & Le Borgne, Yann-Aël. ( 2013).

Machine Learning Strategies for Time Series Forecasting.

class sktime.forecasting.compose.StackingForecaster(forecasters, final_regressor, n_jobs=None)[source]

Bases: sktime.forecasting.base._sktime._RequiredForecastingHorizonMixin, sktime.forecasting.base._meta._HeterogenousEnsembleForecaster

fit(y, X=None, fh=None)[source]

Fit to training data.

Parameters
  • y (pd.Series) – Target time series to which to fit the forecaster.

  • fh (int, list or np.array, optional (default=None)) – The forecasters horizon with the steps ahead to to predict.

  • X (pd.DataFrame, optional (default=None)) – Exogenous variables are ignored

Returns

self

Return type

returns an instance of self.

update(y, X=None, update_params=True)[source]

Update fitted parameters

Parameters
  • y (pd.Series) –

  • X (pd.DataFrame) –

  • update_params (bool, optional (default=True)) –

Returns

self

Return type

an instance of self

class sktime.forecasting.compose.TransformedTargetForecaster(steps)[source]

Bases: sktime.forecasting.base._sktime._OptionalForecastingHorizonMixin, sktime.forecasting.base._sktime._SktimeForecaster, sktime.base._meta._HeterogenousMetaEstimator, sktime.transformations.base._SeriesToSeriesTransformer

Meta-estimator for forecasting transformed time series.

fit(y, X=None, fh=None)[source]

Fit to training data.

Parameters
  • y (pd.Series) – Target time series to which to fit the forecaster.

  • fh (int, list or np.array, optional (default=None)) – The forecasters horizon with the steps ahead to to predict.

  • X (pd.DataFrame, optional (default=None)) – Exogenous variables are ignored

Returns

self

Return type

returns an instance of self.

get_params(deep=True)[source]

Get parameters for this estimator. :param deep: If True, will return the parameters for this estimator and

contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

mapping of string to any

inverse_transform(Z, X=None)[source]
property named_steps[source]

Map the steps to a dictionary

set_params(**kwargs)[source]

Set the parameters of this estimator. Valid parameter keys can be listed with get_params(). :returns: :rtype: self

transform(Z, X=None)[source]

Transform data. Returns a transformed version of X.

update(y, X=None, update_params=True)[source]

Update fitted parameters

Parameters
  • y (pd.Series) –

  • X (pd.DataFrame) –

  • update_params (bool, optional (default=True)) –

Returns

self

Return type

an instance of self