Production-grade uncertainty estimation for Python.
Project description
bootstrapx
Production-grade uncertainty estimation for Python.
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-lib
# With GPU
pip install "bootstrapx-lib[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
- Getting Started
- Methods Guide — math behind each method
- API Reference
- Benchmarks
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bootstrapx_lib-0.2.0.tar.gz.
File metadata
- Download URL: bootstrapx_lib-0.2.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
693551fad4a9a2437c3ebd6d0d0c261d0b7d3cbc449837ade3c570c28c39878b
|
|
| MD5 |
2422332c0f8c65e993ef76a7cdbd5c27
|
|
| BLAKE2b-256 |
04d53a41009727f65c7157b20cae04e5f8a8f237634a5f825fa85b782c1f4753
|
Provenance
The following attestation bundles were made for bootstrapx_lib-0.2.0.tar.gz:
Publisher:
publish.yml on artyerokhin/bootstrapx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bootstrapx_lib-0.2.0.tar.gz -
Subject digest:
693551fad4a9a2437c3ebd6d0d0c261d0b7d3cbc449837ade3c570c28c39878b - Sigstore transparency entry: 1049501797
- Sigstore integration time:
-
Permalink:
artyerokhin/bootstrapx@1c0b2eb031d43f20345a91a1211ebd6fe9836ef6 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/artyerokhin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c0b2eb031d43f20345a91a1211ebd6fe9836ef6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bootstrapx_lib-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bootstrapx_lib-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ae03826b3eb8341b3c2c12b688a81e226ee8196696264956e27d544108683a3
|
|
| MD5 |
26abfec0d53c5dc7014dec432ef9d41c
|
|
| BLAKE2b-256 |
2cccec50f7bec6a77f9ea09305b818c04e2e8a182555c3f5acbaa0cc949b7bdf
|
Provenance
The following attestation bundles were made for bootstrapx_lib-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on artyerokhin/bootstrapx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bootstrapx_lib-0.2.0-py3-none-any.whl -
Subject digest:
4ae03826b3eb8341b3c2c12b688a81e226ee8196696264956e27d544108683a3 - Sigstore transparency entry: 1049501910
- Sigstore integration time:
-
Permalink:
artyerokhin/bootstrapx@1c0b2eb031d43f20345a91a1211ebd6fe9836ef6 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/artyerokhin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c0b2eb031d43f20345a91a1211ebd6fe9836ef6 -
Trigger Event:
push
-
Statement type: