Skip to main content

Production-grade uncertainty estimation for Python.

Project description

bootstrapx

Production-grade uncertainty estimation for Python.

CI PyPI Python License: MIT Docs

14 bootstrap methods · Numba JIT · Optional CUDA GPU · Memory-safe batching


Why bootstrapx?

scipy.stats.bootstrap supports only 3 CI methods and has no time-series support. The R boot package is comprehensive but not accessible from Python. bootstrapx bridges this gap with 14 methods, Numba acceleration, and a clean API.

Feature scipy R boot bootstrapx
BCa interval
Studentized (bootstrap-t)
Poisson / Bernoulli weights
Time-series (MBB, CBB, Stationary, Sieve, Tapered, Wild) Partial
Cluster / Stratified Partial
Numba JIT N/A
CUDA GPU
Generator batching (constant memory)

Installation

pip install bootstrapx

# With GPU
pip install "bootstrapx[cuda]"

Quick Start

import numpy as np
from bootstrapx import bootstrap

data = np.random.default_rng(42).normal(5, 2, size=200)

result = bootstrap(data, np.mean)
print(result)
# BootstrapResult(method='bca', theta_hat=4.94, se=0.13, CI=[4.70, 5.19])

Performance

bootstrapx is significantly faster than scipy.stats.bootstrap for large datasets:

N Method Scipy Bootstrapx Speedup
5,000 BCa 0.80s 0.27s 3.0x
50,000 Percentile 7.29s 2.01s 3.6x
100,000 Percentile 54.34s 3.99s 13.6x

Benchmark on Apple M1, Python 3.12. See Benchmarks for details.


Coverage Accuracy

Monte Carlo simulation ($N=1000$, 500 runs) confirms correct statistical coverage:

Distribution BCa Coverage (Nominal 95%)
Normal 94.8%
Skewed (Exponential) 95.0%
Heavy-Tailed (t-dist) 94.0%

Documentation

📖 Full docs: artyerokhin.github.io/bootstrapx


Contributing

git clone https://github.com/artyerokhin/bootstrapx.git
cd bootstrapx
pip install -e ".[dev,docs]"
pytest tests/ -v
mkdocs serve

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bootstrapx_lib-0.1.3.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bootstrapx_lib-0.1.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file bootstrapx_lib-0.1.3.tar.gz.

File metadata

  • Download URL: bootstrapx_lib-0.1.3.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bootstrapx_lib-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d9df59889edc281ceeecdabbf4535ba2b74207877ffd11b557a0484f53761994
MD5 cf429603dd70cead0205af82dd1cd7b8
BLAKE2b-256 c43a0b5d2cfd4424fec5c4c601aca22c0891c6579d391fc5fe2f90a316912847

See more details on using hashes here.

Provenance

The following attestation bundles were made for bootstrapx_lib-0.1.3.tar.gz:

Publisher: publish.yml on artyerokhin/bootstrapx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bootstrapx_lib-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: bootstrapx_lib-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bootstrapx_lib-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 872b0ffd9ac980641bda7458bf2cbd72407295671ace4aaca83332cb3817b341
MD5 5b57267a3a70a3673f05b803d9eb4a38
BLAKE2b-256 b306a8397217b25fcefeaddcb8c613c6fff89353c1cd0f8fc35f9f7e3949ca36

See more details on using hashes here.

Provenance

The following attestation bundles were made for bootstrapx_lib-0.1.3-py3-none-any.whl:

Publisher: publish.yml on artyerokhin/bootstrapx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page