Skip to main content

expectation banner

expectation

Sequential hypothesis testing with e-values and e-processes. Optional Rust acceleration for massively parallel testing (300K+ simultaneous tests at ~24 ns/test).

v0.6.0 — the public API may still evolve before 1.0.

What this does

E-values replace p-values with a framework where you can monitor data continuously, stop whenever you want, and still have valid inference. No sample size calculations, no correction for peeking.

The library covers:

  • Sequential testing — mean, proportion, quantile, variance tests with anytime-valid guarantees
  • Parallel engine — Rust + rayon backend for 300K+ simultaneous tests (brain voxels, genomics, A/B tests at scale)
  • Multiple testing — e-Bonferroni (FWER), e-BH (FDR), e-Holm (FWER) for cross-test error control
  • Confidence sequences — time-uniform confidence intervals that are valid at every sample size
  • Calibration — convert between p-values and e-values

Install

git clone https://github.com/jakorostami/expectation.git
cd expectation
pip install -e .

For the Rust parallel engine:

pip install maturin
maturin develop --release

Usage

Single sequential test

from expectation.seqtest import SequentialTesting

test = SequentialTesting(test_type="mean", null_value=0, alternative="greater")

result = test.update([0.5, 1.2, 0.8])
print(f"e-value: {result.e_value:.2f}, reject: {result.reject_null}")

result = test.update([1.5, 1.1])
print(f"cumulative e-process: {result.e_process.cumulative_value:.2f}")

Massively parallel testing (Rust)

import numpy as np
from expectation.par_seqtest import ParallelSequentialTest, ParallelTestConfig

config = ParallelTestConfig(
    n_tests=300_000,
    alpha=0.05,
    alternative="greater",
    combiner="empirically_adaptive",
)
engine = ParallelSequentialTest(config=config, null_values=0.0, variance=1.0)

for t in range(100):
    obs = np.random.randn(300_000)
    obs[:1000] += 0.5  # signal in first 1000
    result = engine.step(obs)

# Cross-test error control
bh = engine.e_bh()          # FDR control
bonf = engine.e_bonferroni() # FWER control

# Per-test state
log_ep = engine.log_e_processes()   # log e-process values
pvals = engine.p_values()           # calibrated p-values
stops = engine.stopping_times()     # when each test rejected

References

  • Ramdas, Wang (2025). Hypothesis testing with e-values
  • Howard, Ramdas, McAuliffe, Sekhon (2022). Time-uniform, nonparametric, nonasymptotic confidence sequences
  • Waudby-Smith, Ramdas (2024). Estimating means of bounded random variables by betting
  • Vovk, Wang (2021). E-values: calibration, combination, and applications

Citation

BibTeX

@software{rostami2024expectation,
  author = {Rostami, Jako},
  title = {expectation: Sequential testing with e-values and e-processes},
  year = {2024},
  url = {https://github.com/jakorostami/expectation},
  version = {0.6.0}
}

APA

Rostami, J. (2024). expectation: Python library for sequential testing and e-processes (Version 0.6.0) [Computer software]. https://github.com/jakorostami/expectation

Metadata

Release files for expectation 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for expectation 0.6.0
File Size Uploaded
expectation-0.6.0.tar.gz 4.8 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for expectation 0.6.0
File Interpreter ABI Platform
expectation-0.6.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
expectation-0.6.0-cp310-abi3-manylinux_2_34_x86_64.whl CPython 3.10 abi3 Linux glibc 2.34+ x86-64 Details
expectation-0.6.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.10 abi3 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details

Total release size: 6.3 MB

Release files / expectation-0.6.0.tar.gz

Download URL expectation-0.6.0.tar.gz
Size 4.8 MB
Tags Source
SHA-256 checksum
How to use checksums
2db4707c59864474422fd81d2475e828cb915e73d4092df19d286ba14880017d
BLAKE2b-256 checksum
How to use checksums
1aa6fd4872918ea06a1118cddc6571acaab08af056a76bcdaf33c57b25cf7ddd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / expectation-0.6.0-cp310-abi3-win_amd64.whl

Download URL expectation-0.6.0-cp310-abi3-win_amd64.whl
Size 357.8 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
aefb519d9a3f9d4a6828ae8a13348a0176cdb1b78ad5dfea929136e512019d16
BLAKE2b-256 checksum
How to use checksums
4df499401ef48857063591a9fddeea1b333e7d7b1c6bf3686dc3c8ec1eec19ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / expectation-0.6.0-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL expectation-0.6.0-cp310-abi3-manylinux_2_34_x86_64.whl
Size 441.1 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
a2bfd4552d6eba6ed1e42df32fbd028f3667030d775b3d61d1c8e2d71eccb3e3
BLAKE2b-256 checksum
How to use checksums
8be2ebbf5efca30a4566a1d645e669830a62bfdd5d72627b251f534e3289aab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / expectation-0.6.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL expectation-0.6.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 699.3 kB
Tags CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
868741feea9a4df361c0934b6fe4a79f2a06c1c15cbc93dd3434e74670f12b69
BLAKE2b-256 checksum
How to use checksums
41bdfef0a831aa6d0a77bc8c1877c8a0e28b0af28b86f01eccc0eca08d5c94f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.1

4 release files

This release

0.6.0 This release

4 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page