Skip to content

Commit

Permalink
[DEP] deprecated bootstrap to legacy (#1818)
Browse files Browse the repository at this point in the history
* deprecate bootstrap

* typo

* remove example

* remove Theta
  • Loading branch information
TonyBagnall authored Aug 1, 2024
1 parent 145fa56 commit 0e82c6d
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 246 deletions.
18 changes: 2 additions & 16 deletions aeon/forecasting/compose/_bagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
from aeon.forecasting.base import BaseForecaster
from aeon.forecasting.ets import AutoETS
from aeon.testing.mock_estimators import MockForecaster
from aeon.transformations.base import BaseTransformer
from aeon.transformations.bootstrap import (
from aeon.transformations._legacy._mbb import (
MovingBlockBootstrapTransformer,
STLBootstrapTransformer,
)
from aeon.transformations.base import BaseTransformer
from aeon.utils.index_functions import update_data


Expand Down Expand Up @@ -69,20 +69,6 @@ class BaggingForecaster(BaseForecaster):
.. [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
Examples
--------
>>> from aeon.transformations.bootstrap import STLBootstrapTransformer
>>> from aeon.forecasting.naive import NaiveForecaster
>>> from aeon.forecasting.compose import BaggingForecaster
>>> from aeon.datasets import load_airline
>>> y = load_airline()
>>> forecaster = BaggingForecaster(
... STLBootstrapTransformer(sp=12), NaiveForecaster(sp=12)
... ) # doctest: +SKIP
>>> forecaster.fit(y) # doctest: +SKIP
BaggingForecaster(...)
>>> y_hat = forecaster.predict([1,2,3]) # doctest: +SKIP
"""

_tags = {
Expand Down
2 changes: 1 addition & 1 deletion aeon/forecasting/compose/tests/test_bagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from aeon.forecasting.compose._bagging import _calculate_data_quantiles
from aeon.forecasting.naive import NaiveForecaster
from aeon.transformations._legacy._boxcox import _LogTransformer
from aeon.transformations.bootstrap import STLBootstrapTransformer
from aeon.transformations._legacy._mbb import STLBootstrapTransformer
from aeon.utils.validation._dependencies import _check_soft_dependencies

y = load_airline()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@

import numpy as np
import pandas as pd
from deprecated.sphinx import deprecated
from sklearn.utils import check_random_state

from aeon.transformations._legacy._boxcox import _BoxCoxTransformer
from aeon.transformations.base import BaseTransformer


# TODO: remove in v0.11.0
@deprecated(
version="0.10.0",
reason="STLBootstrapTransformer will be removed in version 0.11.0.",
category=FutureWarning,
)
class STLBootstrapTransformer(BaseTransformer):
"""Creates a population of similar time series.
Expand Down Expand Up @@ -143,31 +136,6 @@ class STLBootstrapTransformer(BaseTransformer):
.. [3] Kunsch HR (1989) The jackknife and the bootstrap for general stationary
observations. Annals of Statistics 17(3), 1217-1241
.. [4] https://www.statsmodels.org/dev/generated/statsmodels.tsa.seasonal.STL.html
Examples
--------
>>> from aeon.transformations.bootstrap import STLBootstrapTransformer
>>> from aeon.datasets import load_airline
>>> from aeon.visualisation import plot_series # doctest: +SKIP
>>> y = load_airline() # doctest: +SKIP
>>> transformer = STLBootstrapTransformer(10) # doctest: +SKIP
>>> y_hat = transformer.fit_transform(y) # doctest: +SKIP
>>> series_list = [] # doctest: +SKIP
>>> names = [] # doctest: +SKIP
>>> 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) # doctest: +SKIP
>>> plot_series(*series_list, labels=names) # doctest: +SKIP
(...)
>>> print(y_hat.head()) # doctest: +SKIP
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
"""

_tags = {
Expand Down Expand Up @@ -406,12 +374,6 @@ def get_test_params(cls, parameter_set="default"):
return params


# TODO: remove in v0.11.0
@deprecated(
version="0.10.0",
reason="MovingBlockBootstrapTransformer will be removed in version 0.11.0.",
category=FutureWarning,
)
class MovingBlockBootstrapTransformer(BaseTransformer):
"""Moving Block Bootstrapping method for synthetic time series generation.
Expand Down Expand Up @@ -459,31 +421,6 @@ class MovingBlockBootstrapTransformer(BaseTransformer):
.. [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.
Examples
--------
>>> from aeon.transformations.bootstrap import MovingBlockBootstrapTransformer
>>> from aeon.datasets import load_airline
>>> from aeon.visualisation import plot_series # doctest: +SKIP
>>> 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) # doctest: +SKIP
(...)
>>> print(y_hat.head()) # doctest: +NORMALIZE_WHITESPACE
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
"""

_tags = {
Expand Down
12 changes: 0 additions & 12 deletions aeon/transformations/bootstrap/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion aeon/transformations/bootstrap/tests/__init__.py

This file was deleted.

142 changes: 0 additions & 142 deletions aeon/transformations/bootstrap/tests/test_mbb.py

This file was deleted.

11 changes: 0 additions & 11 deletions docs/api_reference/transformations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -335,17 +335,6 @@ Series-to-Panel transformers

These transformers create a panel from a single series.

Bootstrap transformations
~~~~~~~~~~~~~~~~~~~~~~~~~

.. currentmodule:: aeon.transformations.bootstrap

.. autosummary::
:toctree: auto_generated/
:template: class.rst

STLBootstrapTransformer
MovingBlockBootstrapTransformer

Outlier detection, changepoint detection
----------------------------------------
Expand Down

0 comments on commit 0e82c6d

Please sign in to comment.