Back to models
Forecaster

AutoEnsembleForecaster

Categorical in XInsamplePred int insampleExogenous

Automatically find best weights for the ensembled forecasters.

Quickstart

python
from sktime.forecasting.compose import AutoEnsembleForecaster

estimator = AutoEnsembleForecaster(forecasters, method='feature-importance', regressor=None, test_size=None, random_state=None, n_jobs=None)

Parameters(6)

forecasterslist of (str, estimator) tuples
Estimators to apply to the input series.
methodstr, optional, default=”feature-importance”

Strategy used to compute weights. Available choices:

  • feature-importance:

    use the feature_importances_ or coef_ from given regressor as optimal weights.

regressorsklearn-like regressor, optional, default=None.
Used to infer optimal weights from coefficients (linear models) or from feature importance scores (decision tree-based models). If None, then a GradientBoostingRegressor(max_depth=5) is used. The regressor can also be a sklearn.Pipeline().
test_sizeint or float, optional, default=None
Used to do an internal temporal_train_test_split(). The test_size data will be the endog data of the regressor and it is the most recent data. The exog data of the regressor are the predictions from the temporarily trained ensemble models. If None, it will be set to 0.25.
random_stateint, RandomState instance or None, default=None
Used to set random_state of the default regressor.
n_jobsint 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.

Examples

>>> from sktime.forecasting.compose import AutoEnsembleForecaster
>>> from sktime.forecasting.naive import NaiveForecaster
>>> from sktime.forecasting.trend import PolynomialTrendForecaster
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> forecasters = [
... ("trend", PolynomialTrendForecaster ()),
... ("naive", NaiveForecaster ()),
... ]
>>> forecaster = AutoEnsembleForecaster (forecasters = forecasters)
>>> forecaster. fit (y = y, fh = [1, 2, 3 ]) AutoEnsembleForecaster(
... )
>>> y_pred = forecaster. predict ()