Back to models
Transformer

MovingBlockBootstrapTransformer

Moving Block Bootstrapping method for synthetic time series generation.

The Moving Block Bootstrapping (MBB) method introduced in [1] is can be used to create synthetic time series that mimic the autocorelation patterns of an observed stationary series. This method is frequently combined with other transformations e.g. BoxCox and STL to produce synthetic time series similar to the observed time series [2], [3].

The returned panel will be a multiindex dataframe (pd.DataFrame) with the series_id and time_index as the index and a single column of the time series value. The values for series_id are “actual” for the original series and “synthetic_n” (where n is an integer) for the generated series. See the Examples section for example output.

Quickstart

python
from sktime.transformations.bootstrap import MovingBlockBootstrapTransformer

estimator = MovingBlockBootstrapTransformer(n_series: int=10, block_length: int=10, sampling_replacement: bool=False, return_actual: bool=True, random_state: int | RandomState=None, return_indices=False)

Tags

Capabilities

  • Unequal-length series
  • Multivariate: Not supported
  • Inverse transform: Not supported
  • Missing values: Not supported
  • Removes missing values: Not supported
  • Equalizes series length: Not supported

Properties

Input typescitype:transform-input
Series
Output typescitype:transform-output
Panel
Label typescitype:transform-labels
None
Fit is emptyfit_is_empty
Yes
Keeps the time indextransform-returns-same-time-index
No
Requires Xrequires_X
Yes
Requires yrequires_y
No
X and y need the same indexX-y-must-have-same-index
No

Parameters(6)

n_seriesint, optional, default=10
The number of bootstrapped time series that will be generated
block_lengthint, optional, default = min(2*sp, len(X) - sp)
The length of the block in the MBB method, by default None. If not provided, the following heuristic is used, the block length will the minimum between 2*sp and len(X) - sp.
sampling_replacementbool, optional, default=False
Whether the MBB sample is with or without replacement
return_actualbool, optional, default=True
If True the output will contain the actual time series. The actual time series will be labelled as “actual”.
random_stateint, np.random.RandomState or None, by default None
Controls the randomness of the estimator
return_indicesbool, optional, default=False.
If True, the output will contain the resampled indices as extra column.

Examples

>>> from sktime.transformations.bootstrap import MovingBlockBootstrapTransformer
>>> from sktime.datasets import load_airline
>>> from sktime.utils.plotting import plot_series
>>> y = load_airline ()
>>> transformer = MovingBlockBootstrapTransformer (10)
>>> y_hat = transformer. fit_transform (y)
>>> series_list = []
>>> names = []
>>> for group, series in y_hat. groupby (level = [0 ], as_index = False):
... series. index = series. index. droplevel (0)
... series_list. append (series)
... names. append (group)
>>> plot_series (* series_list, labels = names) (
... )
>>> print (y_hat. head ()) Number of airline passengers series_id time_index actual 1949-01 112.0 1949-02 118.0 1949-03 132.0 1949-04 129.0 1949-05 121.0

References

[1]

Kunsch HR (1989) The jackknife and the bootstrap for general stationary observations. Annals of Statistics 17(3), 1217-1241

[2]

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

[3]

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. Accessed on February 13th 2022.