Repository navigation
v0.2.0
v0.2.0 is a correctness-first rewrite. The public surface is one function, bootstrap(X, *, method=...),
configured with a typed, frozen method spec. The 0.1.x class-based API is gone; this is a breaking release.
Added
- One entry point,
bootstrap, plusbootstrap_reduce. The latter evaluates a per-replicate statistic
inside the generation loop and returns only the reduced results, which bounds peak memory regardless of
replicate count. - Typed method specs (pydantic, frozen,
extra="forbid"):IID; the block familyMovingBlock,
CircularBlock,StationaryBlock,NonOverlappingBlock,TaperedBlock; and the model-based
ResidualBootstrap(with anAR,ARIMA, orVARmodel) andSieveAR. - Automatic block length:
block_length="auto"uses the Politis-White (2004) / Patton-Politis-White
(2009) selector instead of a fixedsqrt(n). - Exogenous regressors for the model-based methods: ARX, VARX, and ARIMAX, held fixed during regeneration.
- Uncertainty quantification (
tsbootstrap.uq):EnbPIEnsemble, a fit/predict object that retains the
bootstrap ensemble and produces in-sample and out-of-sample prediction intervals with a choice of
calibrator (static, sliding-window, ACI, or NexCP); adaptive conformal calibratorsaci_halfwidths
(Gibbs-Candes 2021) andnexcp_quantile(Barber 2023); andforecast_intervalsfor forward AR simulation. - DataFrame input through Narwhals: pass pandas, Polars, or PyArrow frames and series.
- sktime / skbase estimator classes under
tsbootstrap.adapters. - An optional compiled VAR kernel (
pip install "tsbootstrap[accel]", numba), auto-selected when present. - A deterministic per-replicate RNG contract: replicate i is bound to its own stream, so results are
reproducible for a given seed and environment regardless of worker count or chunking. diagnose(x)to suggest methods for a series.- Python 3.13 support (CI matrix and packaging metadata).
Changed
- Recursive residual bootstraps now regenerate replicates from the fitted dynamics and resampled,
centered innovations (replacing the previousfitted + residualsreconstruction). - ARIMA replicates are conditioned on the observed initial state with lfilter-consistent residuals.
Re-injecting a replicate's own residuals now reconstructs the observed series exactly. - Non-stationary model fits are refused, or skipped via
stability_policy, to prevent explosive paths.
Removed (breaking)
- The 0.1.x class API,
TSFit,n_jobs/joblib parallelism, the async layer, the feature-flag system,
and the statistic-preserving method. burn_inandinitialon theARIMAspec: these are now rejected at construction, because ARIMA
conditions on the observed initial state. They remain available onAR,VAR, andSieveAR.
Quality
- Blocking CI gates: mypy (strict-minus) and pyright (strict) at zero errors, ruff lint and format, a
property-based invariant layer, and a per-file coverage floor.