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.1 — 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

pip install expectation

Prebuilt wheels bundle the Rust parallel engine, so no Rust toolchain is required.

From source (development)

git clone https://github.com/jakorostami/expectation.git
cd expectation
pip install -e ".[dev]"
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.1}
}

APA

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

Metadata

Release files for expectation 0.6.1

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.1
File Size Uploaded
expectation-0.6.1.tar.gz 4.8 MB Details

Built distributions (wheels)

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

Total release size: 6.3 MB

Release files / expectation-0.6.1.tar.gz

Download URL expectation-0.6.1.tar.gz
Size 4.8 MB
Tags Source
SHA-256 checksum
How to use checksums
ee8c7ebc8b8da8ffe29cc0adc44a71040d891237e9c267e7bfc3d3b35454203a
BLAKE2b-256 checksum
How to use checksums
ba40190b51f9d3c88f92c448b32174c73af3b24306e96e12a691e8c9ea93119e
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.1-cp310-abi3-win_amd64.whl

Download URL expectation-0.6.1-cp310-abi3-win_amd64.whl
Size 357.9 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5c5e1de99ccfc7ea2af61307054117637be947042c0cd6f95f0372e12e752a16
BLAKE2b-256 checksum
How to use checksums
a056b2bf1e21406c1aa4ac02198899c91a4142bad43dae867b7a2c5e2f335c98
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.1-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL expectation-0.6.1-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
ea0d3d767dbcc849064de51931d5f1b6f2e3e9dc92eb624eb77c9f85bce7bb76
BLAKE2b-256 checksum
How to use checksums
53cf96ad23e56a3dbf2ba61612cf6f524ca895a6daf7e0c2c7181cdf7fcb72bf
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.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL expectation-0.6.1-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
18578ced5eafb8b87dc5f2957181b5e75860cb94bba24fa464de3d32100171f3
BLAKE2b-256 checksum
How to use checksums
479de2ddaf6a9e06da28e49f3a96ee6063b60d5165adf38485e38593d84e2a0b
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

This release

0.6.1 This release

4 release files

0.6.0

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