Results (tsbootstrap.results)
Structured result objects returned by the public API.
A BootstrapResult is a sequence of BootstrapSample, carries a
BootstrapRunMetadata provenance record, and exposes vectorised views
(values(), indices()) plus out-of-bag / in-bag primitives for downstream
conformal-prediction use.
- class tsbootstrap.results.BootstrapRunMetadata(method: str, method_params: dict[str, object], n_bootstraps: int, n_obs: int, n_series: int, random_state_kind: str, seed_entropy: int | ~collections.abc.Sequence[int] | None, backend: str | None = None, versions: dict[str, str] = <factory>, references: tuple[str, ...] = (), warnings: tuple[str, ...] = (), failed: bool = False, failure_reason: str | None = None)[source]
Bases:
objectProvenance for a bootstrap run; everything needed to reproduce or cite it.
- class tsbootstrap.results.BootstrapSample(values: ~numpy.ndarray[tuple[int, ...], ~numpy.dtype[~numpy.float64]], sample_id: int, indices: ~numpy.ndarray[tuple[int, ...], ~numpy.dtype[~numpy.int64]] | None = None, metadata: dict[str, object] = <factory>)[source]
Bases:
objectOne bootstrap replicate.
- values
The resampled/regenerated series, shape
(n,)or(n, d).- Type:
ndarray
- sample_id
Replicate index
i(also identifies the RNG stream that produced it).- Type:
int
- indices
Original-observation indices used, shape
(n,), when the method resamples observations (block/IID).Nonefor recursive methods, which have no observation-index provenance.- Type:
ndarray or None
- metadata
Optional per-sample detail (e.g. block starts/lengths).
- Type:
dict
- class tsbootstrap.results.BootstrapResult(samples: Iterable[BootstrapSample], metadata: BootstrapRunMetadata)[source]
Bases:
Sequence[BootstrapSample]An ordered, materialised collection of bootstrap samples plus metadata.
- iter_samples() Iterator[BootstrapSample][source]
Iterate over the individual
BootstrapSampleobjects.
- values() ndarray[tuple[int, ...], dtype[float64]][source]
Stack the samples into one array, shape
(n_bootstraps, n[, d]).
- indices() ndarray[tuple[int, ...], dtype[int64]] | None[source]
Stacked observation indices, or
Noneif any sample lacks them (recursive).
- class tsbootstrap.results.ReducedResult(statistics: ndarray[tuple[int, ...], dtype[float64]] | None, metadata: BootstrapRunMetadata)[source]
Bases:
objectPer-replicate statistics from
bootstrap_reduce(), plus provenance.statisticshas shape(n_bootstraps, |theta|), the value of the per-replicate statistic for every replicate, or isNonewhen the run failed preparation. Peak memory isO(B * |theta|), never theO(B * n * d)of the materialised paths, so very largen_bootstrapsstays in RAM.- property failed: bool
Whether preparation failed (e.g. a non-stationary fit under
stability_policy='skip').