sktime / skbase adapters

For the sktime forecasting ecosystem, tsbootstrap.adapters provides thin skbase.BaseObject estimator classes. Each adapter stores its parameters, builds the corresponding MethodSpec, and delegates to tsbootstrap.bootstrap().

These adapters are compatible with sktime’s check_estimator validation and can be passed anywhere the sktime API expects a bootstrap estimator.

Installation

The adapters require skbase (part of the sktime ecosystem):

uv add "tsbootstrap[sktime]"     # or: pip install "tsbootstrap[sktime]"

Using an adapter

from tsbootstrap.adapters import MovingBlockBootstrap
import numpy as np

x = np.random.default_rng(0).standard_normal(200)

est = MovingBlockBootstrap(block_length=10, n_bootstraps=100, random_state=0)

for sample in est.bootstrap(x):
    ...   # sample is an ndarray of shape (n,)

# With observation indices
for values, indices in est.bootstrap(x, return_indices=True):
    print(values.shape, indices)

All adapters accept n_bootstraps and random_state in their constructor. The bootstrap(X, y=None, return_indices=False) method yields samples.

Available adapters

Block method adapters

Class

Underlying spec

Key parameter(s)

IIDBootstrap

IID

MovingBlockBootstrap

MovingBlock

block_length

CircularBlockBootstrap

CircularBlock

block_length

StationaryBlockBootstrap

StationaryBlock

avg_block_length

NonOverlappingBlockBootstrap

NonOverlappingBlock

block_length

TaperedBlockBootstrap

TaperedBlock

window, block_length, alpha

Model method adapters

Class

Underlying spec

Key parameter(s)

ARResidualBootstrap

ResidualBootstrap(model=AR(...))

order

ARIMAResidualBootstrap

ResidualBootstrap(model=ARIMA(...))

order

VARResidualBootstrap

ResidualBootstrap(model=VAR(...))

order

SieveBootstrap

SieveAR

min_lag, max_lag, criterion

Validating with sktime

from sktime.utils import check_estimator
from tsbootstrap.adapters import MovingBlockBootstrap

check_estimator(MovingBlockBootstrap)

Relationship to the functional API

The adapters are strictly wrappers; there is no additional logic. Users who do not need sktime compatibility should use tsbootstrap.bootstrap() directly - it returns a richer BootstrapResult (with provenance metadata and OOB primitives) rather than a bare iterator of arrays.