AutoSI
Automatic selective inference for algorithms written as ordinary NumPy-like code.
Selective inference (SI) provides statistically valid p-values for hypotheses selected by applying an algorithm to the data. Until now, developing an SI procedure for a new algorithm required an expert to derive its selection event by hand. AutoSI removes this barrier: write the selection algorithm with AutoSI's tracked array operations, run it once on the observed data, and call asi.inference — the selection event is derived automatically, and selection events of any polynomial degree (any algorithm expressible through rational functions of the data) are supported.
Installation
pip install autosi
Quick example
Select the feature most correlated with the response, then test its regression coefficient with a selective p-value:
import numpy as np
import autosi as asi
rng = np.random.default_rng(0)
n, p = 100, 10
X_np = rng.normal(size=(n, p))
y_np = rng.normal(size=n)
X = asi.array(X_np)
y = asi.array(y_np)
def marginal_screening(y):
corr = X.T @ y # correlation with each feature
best = asi.argmax(asi.abs(corr)) # pick the most correlated one
x_M = X.T[best]
return x_M / (x_M @ x_M) # contrast of its coefficient
eta = marginal_screening(y)
result = asi.inference(eta=eta, prob_vec=y, var=1.0,
algorithm=marginal_screening)
print(result.p_value)
The same three steps (wrap the data, write the algorithm with asi operations, call asi.inference) handle far more complex procedures — including an iterative lasso and a lasso tuned by cross-validated R², whose selection event involves polynomial inequalities of degree twelve and is beyond every existing exact SI method.
How it works
asi.inference re-runs the algorithm along the one-dimensional line of datasets that the SI reduction confines the response to. Every tracked operation (comparisons, abs, max, argmax, sort, ...) records the interval of the line parameter on which its outcome is unchanged. Sweeping the line and collecting the intervals whose selection matches the observed one yields the truncation region, from which an exactly valid selective p-value follows via the truncated normal distribution.
Requirements
Python >= 3.11. All dependencies (sicore, NumPy, SciPy) are installed automatically with pip install autosi.
License
MIT
Metadata
Release files for autosi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autosi-0.1.0.tar.gz | 30.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autosi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.2 kB
Release files / autosi-0.1.0.tar.gz
| Download URL | autosi-0.1.0.tar.gz |
|---|---|
| Size | 30.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6080a2a65556af6130d834f4de1894923bbfa39dac6ca9e5737bfc6d94dc0435
|
|
BLAKE2b-256 checksum How to use checksums |
ed9d7d9ba82a129d5bd8276f1af4e2df49d4ebc16da9e2f6d63994d0430b4d0f
|
| 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 Aug 5, 2026.
Transparency logRelease files / autosi-0.1.0-py3-none-any.whl
| Download URL | autosi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da3591c1fdcf744cf214bee9330d481609a1a9b28c3834fd8cdd0629c78552b2
|
|
BLAKE2b-256 checksum How to use checksums |
989e9f8378b7993d0f18666d7428580b669278a8925c550d1bc9dba432d7aebb
|
| 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 Aug 5, 2026.
Transparency log