Zurück zu den Modellen
Forecaster

EnbPIForecaster

Ensemble Bootstrap Prediction Interval Forecaster.

The forecaster combines sktime forecasters, with tsbootstrap bootstrappers and the EnbPI algorithm [1] implemented in fortuna using the tutorial from this blogpost [2].

The forecaster is similar to the the bagging forecaster and performs internally the following steps.

For training:

  1. Uses a bootstrap transformer to generate bootstrap samples and returning the corresponding indices of the original time series. Note that the bootstrap transformer must be able to return indices of the original time series as and additional column. I.e., the bootstrap_transformer must have the capability:bootstrap_indices tag, and its parameter return_indices must be set to True.

  2. Fit a forecaster on the first n - max(fh) values of each bootstrap sample

  3. Uses each forecaster to predict the last max(fh) values of each bootstrap sample

For Prediction:

  1. Average the predictions of each fitted forecaster using the aggregation function

For Probabilistic Forecasting:

  1. Calculate the point forecast by average the prediction of each fitted forecaster using the aggregation function

  2. Passes the indices of the bootstrapped samples, the predictions from the fit call, the point prediction of the test set, and the desired error rate to the EnbPI algorithm to calculate the prediction intervals. For more information on the EnbPI algorithm, see the references and the documentation of the EnbPI class in aws-fortuna.

Schnellstart

python
from sktime.forecasting.enbpi import EnbPIForecaster

estimator = EnbPIForecaster(forecaster=None, bootstrap_transformer=None, random_state=None, aggregation_function='mean')

Parameter(4)

forecasterestimator
The base forecaster to fit to each bootstrap sample.
bootstrap_transformertsbootstrap.BootstrapTransformer

The transformer to fit to the target series to generate bootstrap samples. This transformer must be able to return the indices of the original time series as an additional column. I.e., the bootstrap_transformer must have the capability:bootstrap_indices tag, and its parameter return_indices must be set to True.

random_stateint, RandomState instance or None, default=None
Random state for reproducibility.
aggregation_functionstr, default=”mean”
The aggregation function to use for combining the predictions of the fitted forecasters. Either “mean” or “median”.

Beispiele

>>> import numpy as np
>>> from tsbootstrap import MovingBlockBootstrap
>>> from sktime.forecasting.enbpi import EnbPIForecaster
>>> from sktime.forecasting.naive import NaiveForecaster
>>> from sktime.datasets import load_airline
>>> from sktime.transformations.difference import Differencer
>>> from sktime.transformations.detrend import Deseasonalizer
>>> from sktime.forecasting.base import ForecastingHorizon
>>> y = load_airline ()
>>> forecaster = Differencer (lags = [1 ]) * Deseasonalizer (sp = 12) * EnbPIForecaster (
... forecaster = NaiveForecaster (sp = 12),
... bootstrap_transformer = MovingBlockBootstrap (n_bootstraps = 10))
>>> fh = ForecastingHorizon (np. arange (1, 13))
>>> forecaster. fit (y, fh = fh) TransformedTargetForecaster(
... )
>>> res = forecaster. predict ()
>>> res_int = forecaster. predict_interval (coverage = [0.5 ])

Referenzen

[1]

Chen Xu & Yao Xie (2021). Conformal Prediction Interval for Dynamic

Time-Series... [R09383241d85a-2] Valeriy Manokhin, PhD, MBA, CQF. Demystifying EnbPI: Mastering Conformal Prediction Forecasting