Adaptive Conformal Inference Under Distribution Shift
Project description
adaptive-conformal-inference
Python implementation of Adaptive Conformal Inference (ACI) from:
Isaac Gibbs and Emmanuel J. Candès. Adaptive Conformal Inference Under Distribution Shift. NeurIPS 2021. arXiv:2106.00170
ACI adapts conformal prediction sets to distribution shift by tracking a single parameter that adjusts the quantile level online, provably achieving target coverage over long time intervals.
Installation
pip install adaptive-conformal-inference
For running the example scripts (stock data + plots):
pip install adaptive-conformal-inference[examples]
Quick Start
from aci import ACITracker
# Core: model-agnostic alpha tracker
tracker = ACITracker(alpha=0.1, gamma=0.005)
for t in range(T):
# Your conformal prediction logic here...
err_t = 1.0 if y_true not in prediction_set else 0.0
tracker.update(err_t)
next_alpha = tracker.alpha_t # use this for the next prediction set
Modules
| Module | Description |
|---|---|
aci.tracker.ACITracker |
Core alpha update (Simple and Momentum rules) |
Non-essential forecasting/data pipelines are intentionally kept in examples/:
examples/figure1/(self-contained Figure 1 example files)examples/figure2/(self-contained Figure 2 example files)
Reproducing Paper Figures
# Figure 1: Volatility prediction with normalized score (4 stocks)
python examples/figure1/reproduce.py
# Figure 2: Volatility prediction with unnormalized score (4 stocks)
python examples/figure2/reproduce.py
Reproduced Figures From the Paper
Figure 1 (Normalized Score)
| Our reproduction | Paper figure |
|---|---|
Figure 2 (Unnormalized Score)
| Our reproduction | Paper figure |
|---|---|
Citation
@article{gibbs2021adaptive,
title={Adaptive conformal inference under distribution shift},
author={Gibbs, Isaac and Candes, Emmanuel},
journal={Advances in Neural Information Processing Systems},
volume={34},
pages={1660--1672},
year={2021}
}
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 adaptive_conformal_inference-0.1.0.tar.gz.
File metadata
- Download URL: adaptive_conformal_inference-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68759a71594aedc390a734d0426d463ace0aa83dacacda1a91ebe01d34c8dc68
|
|
| MD5 |
c310238c0f01061c987fc78b20a0e838
|
|
| BLAKE2b-256 |
951b14f1667e3bb24ec55edbbf735b74f493b64c23d389f5a938577f9d709d3c
|
Provenance
The following attestation bundles were made for adaptive_conformal_inference-0.1.0.tar.gz:
Publisher:
python-publish.yml on emrekuruu/adaptive_conformal_inference
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adaptive_conformal_inference-0.1.0.tar.gz -
Subject digest:
68759a71594aedc390a734d0426d463ace0aa83dacacda1a91ebe01d34c8dc68 - Sigstore transparency entry: 931687226
- Sigstore integration time:
-
Permalink:
emrekuruu/adaptive_conformal_inference@dfadced0da422b55f029d9fb911c8b62cf60a7c2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/emrekuruu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@dfadced0da422b55f029d9fb911c8b62cf60a7c2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file adaptive_conformal_inference-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adaptive_conformal_inference-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df71ce3e9655f84f220a3a118ac4d8654a3834bc7aa635967dc419e8149cbda3
|
|
| MD5 |
7557346d5fa48efa5f7979d87f723198
|
|
| BLAKE2b-256 |
e0f4242bac5df7505cf21a9e893237f0e0fd94e7745d7f297b5e40bd4bedb9c7
|
Provenance
The following attestation bundles were made for adaptive_conformal_inference-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on emrekuruu/adaptive_conformal_inference
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adaptive_conformal_inference-0.1.0-py3-none-any.whl -
Subject digest:
df71ce3e9655f84f220a3a118ac4d8654a3834bc7aa635967dc419e8149cbda3 - Sigstore transparency entry: 931687318
- Sigstore integration time:
-
Permalink:
emrekuruu/adaptive_conformal_inference@dfadced0da422b55f029d9fb911c8b62cf60a7c2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/emrekuruu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@dfadced0da422b55f029d9fb911c8b62cf60a7c2 -
Trigger Event:
release
-
Statement type: