Skip to main content

pyconformal

Conformal prediction for Python: prediction intervals and prediction sets with finite-sample coverage guarantees, for any model.

Status: early development (0.0.1). The API will change before 1.0.

Install

pip install pyconformal

Regression: prediction intervals

from sklearn.ensemble import RandomForestRegressor
from pyconformal import SplitConformalRegressor

model = SplitConformalRegressor(RandomForestRegressor(), alpha=0.1)
model.fit(X_train, y_train)        # train the model
model.calibrate(X_cal, y_cal)      # held-out calibration data
intervals = model.predict_interval(X_test)   # shape (n, 2): lower, upper

Classification: prediction sets

from sklearn.linear_model import LogisticRegression
from pyconformal import SplitConformalClassifier

model = SplitConformalClassifier(LogisticRegression(), alpha=0.1)
model.fit(X_train, y_train)
model.calibrate(X_cal, y_cal)
sets = model.predict_set(X_test)   # boolean (n, n_classes), columns = model.classes_

Already have a trained model? Pass prefit=True and skip fit.

The guarantee

If the calibration data and the test point are exchangeable (for example, i.i.d.), the interval or set contains the true value with probability at least 1 - alpha. The guarantee is marginal (on average over test points), not conditional on each input. It holds for any model and any data distribution.

The calibration data must not be used to train the model. If the calibration set is too small for the chosen alpha (fewer than 1/alpha - 1 points), the intervals are infinite, which is the only way to keep the guarantee.

Licence

MIT. Copyright (c) 2026 Valery Manokhin.

Metadata

Release files for pyconformal 0.0.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 pyconformal 0.0.1
File Size Uploaded Provenance Actions
pyconformal-0.0.1.tar.gz 6.0 kB Without provenance Details for pyconformal-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyconformal 0.0.1
File Interpreter ABI Platform Actions
pyconformal-0.0.1-py3-none-any.whl Python 3 none any Details for pyconformal-0.0.1-py3-none-any.whl

Total release size: 12.9 kB

Release files / pyconformal-0.0.1.tar.gz

Download URL pyconformal-0.0.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
004c15dcfb4721e174d4d0194a7073fd8760e4b71defb7998f57a2f995f50d73
BLAKE2b-256 checksum
How to use checksums
7244fc35d00b3e5ea63dd280aa77420c434e00daeae7ff3e3b10b1c0b4cb4bc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / pyconformal-0.0.1-py3-none-any.whl

Download URL pyconformal-0.0.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4db2c53ce68ecc43778fff2867b0dce81cb12335c311651e70a87afc9f381cfc
BLAKE2b-256 checksum
How to use checksums
f043539518ddc6414ea36d93424f8112e71b5a76d75b8e9b96d1e674d32e3da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for pyconformal 0.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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