Back to models
Forecaster

BATS

Categorical in XInsamplePred intPred int insample

BATS forecaster for time series with multiple seasonality.

Wrapping implementation in [1] of method proposed in [2]. See [3] for blogpost by a creator of [1] giving brief explanation of the BATS model. See [4] for discussion on multiple seasonalities and discussion of how BATS compares with some other approaches.

BATS is acronym for:

  • Box-Cox transformation

  • ARMA errors

  • Trend

  • Seasonal components

BATS was designed to forecast time series with multiple seasonal periods. For example, daily data may have a weekly pattern as well as an annual pattern. Or hourly data can have three seasonal periods: a daily pattern, a weekly pattern, and an annual pattern.

In BATS, a Box-Cox transformation is applied to the original time series, and then this is modelled as a linear combination of an exponentially smoothed trend, a seasonal component and an ARMA component. BATS conducts some hyper-parameter tuning (e.g. which of these components to keep and which to discard) using AIC.

Quickstart

python
from sktime.forecasting.bats import BATS

estimator = BATS(use_box_cox=None, box_cox_bounds=(0, 1), use_trend=None, use_damped_trend=None, sp=None, use_arma_errors=True, show_warnings=True, n_jobs=None, multiprocessing_start_method='spawn', context=None)

Parameters(10)

use_box_cox: bool or None, optional (default=None)
If Box-Cox transformation of original series should be applied. When None both cases shall be considered and better is selected by AIC.
box_cox_bounds: tuple, shape=(2,), optional (default=(0, 1))
Minimal and maximal Box-Cox parameter values.
use_trend: bool or None, optional (default=None)
Indicates whether to include a trend or not. When None both cases shall be considered and better is selected by AIC.
use_damped_trend: bool or None, optional (default=None)
Indicates whether to include a damping parameter in the trend or not. Applies only when trend is used. When None both cases shall be considered and better is selected by AIC.
sp: Iterable or array-like of floats, optional (default=None)
Abbreviation of “seasonal periods”. The length of each of the periods (amount of observations in each period). Accepts int and float values here. When None or empty array, non-seasonal model shall be fitted.
use_arma_errors: bool, optional (default=True)
When True BATS will try to improve the model by modelling residuals with ARMA. Best model will be selected by AIC. If False, ARMA residuals modeling will not be considered.
show_warnings: bool, optional (default=True)
If warnings should be shown or not. Also see Model.warnings variable that contains all model related warnings.
n_jobs: int, optional (default=None)
How many jobs to run in parallel when fitting BATS model. When not provided BATS shall try to utilize all available cpu cores.
multiprocessing_start_method: str, optional (default=’spawn’)

How threads should be started. See also:

https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

context: abstract.ContextInterface, optional (default=None)
For advanced users only. Provide this to override default behaviors

Examples

>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.bats import BATS
>>> y = load_airline ()
>>> forecaster = BATS (
... use_box_cox = False,
... use_trend = False,
... use_damped_trend = False,
... sp = 12,
... use_arma_errors = False,
... n_jobs = 1)
>>> forecaster. fit (y) BATS(
... )
>>> y_pred = forecaster. predict (fh = [1, 2, 3 ])

References

[2]

De Livera, A.M., Hyndman, R.J., & Snyder, R. D. (2011), Forecasting time series with complex seasonal patterns using exponential smoothing, Journal of the American Statistical Association, 106(496), 1513-1527. DOI: https://doi.org/10.1198/jasa.2011.tm09771

[4]

R.J. Hyndman, G. Athanasopoulos. Forecasting: Principles and Practice. https://otexts.com/fpp2/complexseasonality.html