Small, well-tested utilities for online controlled experiments: sample size, CUPED, sequential testing, delta-method variance.
Project description
experiment-toolkit
Small, well-tested utilities for online controlled experiments.
What's inside
| Module | Purpose |
|---|---|
sample_size |
Required per-arm sample size for a given MDE, and the inverse |
cuped |
Deng et al. (2013) CUPED variance reduction |
ratio |
Delta-method variance for ratio metrics (revenue/session, etc.) |
sequential |
mSPRT always-valid p-values for peeking-robust experiments |
Every function is tested, typed, and has a reference to the paper it implements.
Install
pip install experiment-toolkit
Or from source:
pip install git+https://github.com/wavde/experiment-toolkit.git
Quick start
from experiment_toolkit import sample_size_for_mde, apply_cuped, msprt_pvalue
# How many users do I need per arm to detect a 2% lift (sd=1.0)?
n = sample_size_for_mde(mde=0.02, std_dev=1.0, alpha=0.05, power=0.80)
# ~39,000 per arm
# Apply CUPED with a pre-experiment covariate
y_adj = apply_cuped(y, pre_period_y)
# Always-valid p-value — safe to peek
p = msprt_pvalue(delta_hat=0.015, sigma=1.0, n_per_arm=5000, tau=0.05)
CLI
The CLI wraps sample-size and mde. The other modules (cuped, ratio, sequential) are library-only.
experiment-toolkit sample-size --mde 0.02 --sd 1.0
# Required per-arm sample size: 39,244
experiment-toolkit mde --n 10000 --sd 1.0
# Detectable effect (MDE): 0.0396
Development
pip install -e ".[dev]"
pytest
ruff check .
References
- Deng, Xu, Kohavi, Walker (2013) — CUPED
- Deng, Knoblich, Lu (2018) — Delta Method in Metric Analytics
- Johari, Pekelis, Walsh (2015) — Always Valid Inference
- Kohavi, Tang, Xu (2020) — Trustworthy Online Controlled Experiments
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 experiment_toolkit-0.1.0.tar.gz.
File metadata
- Download URL: experiment_toolkit-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f18ee007c91bc2403ad59f99f902d96bc747b4298036aaa24230e136796e6b09
|
|
| MD5 |
2bf9f230672f8134c070379f23e5d440
|
|
| BLAKE2b-256 |
6712c5e414371b0f8cb59bf7b5fa179e321e6d09b03662466ffa5d1a98d930af
|
Provenance
The following attestation bundles were made for experiment_toolkit-0.1.0.tar.gz:
Publisher:
publish.yml on wavde/experiment-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
experiment_toolkit-0.1.0.tar.gz -
Subject digest:
f18ee007c91bc2403ad59f99f902d96bc747b4298036aaa24230e136796e6b09 - Sigstore transparency entry: 1341556278
- Sigstore integration time:
-
Permalink:
wavde/experiment-toolkit@94cb552227be1eb7fe1ce153ead743332f500882 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/wavde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94cb552227be1eb7fe1ce153ead743332f500882 -
Trigger Event:
release
-
Statement type:
File details
Details for the file experiment_toolkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: experiment_toolkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18bc100dbde114337e0a03ccb96c4a758e0aa90403e289af66f4ae353176d7bf
|
|
| MD5 |
e534ffbee2aef850f501f3b2d6bc2f0b
|
|
| BLAKE2b-256 |
5bcb3e4ef0ae9057babb7bcdac9c4ba4faaf09d82a3af588a978b6ebbd9b3530
|
Provenance
The following attestation bundles were made for experiment_toolkit-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on wavde/experiment-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
experiment_toolkit-0.1.0-py3-none-any.whl -
Subject digest:
18bc100dbde114337e0a03ccb96c4a758e0aa90403e289af66f4ae353176d7bf - Sigstore transparency entry: 1341556404
- Sigstore integration time:
-
Permalink:
wavde/experiment-toolkit@94cb552227be1eb7fe1ce153ead743332f500882 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/wavde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@94cb552227be1eb7fe1ce153ead743332f500882 -
Trigger Event:
release
-
Statement type: