BaggingForecaster
Forecast a time series by aggregating forecasts from its bootstraps.
Bagged “Bootstrap Aggregating” Forecasts are obtained by forecasting bootstrapped time series and then aggregating the resulting forecasts. For the point forecast, the different forecasts are aggregated using the mean function [1]. Prediction intervals and quantiles are calculated for each time point in the forecasting horizon by calculating the sampled forecast quantiles.
Bergmeir et al. (2016) [2] show that, on average, bagging ETS forecasts gives better forecasts than just applying ETS directly. The default bootstrapping transformer and forecaster are selected as in [2].
Schnellstart
from sktime.forecasting.compose import BaggingForecaster
estimator = BaggingForecaster(bootstrap_transformer: BaseTransformer=None, forecaster: BaseForecaster=None, sp: int=2, random_state: int | RandomState=None)Parameter(4)
- bootstrap_transformersktime transformer BaseTransformer descendant instance
- (default = sktime.transformations.bootstrap.STLBootstrapTransformer) Bootstrapping Transformer that takes a series (with tag scitype:transform-input=Series) as input and returns a panel (with tag scitype:transform-input=Panel) of bootstrapped time series if not specified sktime.transformations.bootstrap.STLBootstrapTransformer is used.
- forecastersktime forecaster, BaseForecaster descendant instance, optional
- (default = sktime.forecating.ets.AutoETS) If not specified, sktime.forecating.ets.AutoETS is used.
- sp: int (default=2)
- Seasonal period for default Forecaster and Transformer. Must be 2 or greater. Ignored for the bootstrap_transformer and forecaster if they are specified.
- random_state: int or np.random.RandomState (default=None)
- The random state of the estimator, used to control the random number generator
Beispiele
>>> from sktime.transformations.bootstrap import STLBootstrapTransformer
>>> from sktime.forecasting.naive import NaiveForecaster
>>> from sktime.forecasting.compose import BaggingForecaster
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> forecaster = BaggingForecaster (
... STLBootstrapTransformer (sp = 12), NaiveForecaster (sp = 12)
... )
>>> forecaster. fit (y) BaggingForecaster(
... )
>>> y_hat = forecaster. predict ([1, 2, 3 ])Referenzen
Hyndman, R.J., & Athanasopoulos, G. (2021) Forecasting: principles and practice, 3rd edition, OTexts: Melbourne, Australia. OTexts.com/fpp3, Chapter 12.5. Accessed on February 13th 2022.
Bergmeir, C., Hyndman, R. J., & Benítez, J. M. (2016). Bagging exponential smoothing methods using STL decomposition and Box-Cox transformation. International Journal of Forecasting, 32(2), 303-312