Skip to main content

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
Our Figure 1 Paper Figure 1

Figure 2 (Unnormalized Score)

Our reproduction Paper figure
Our Figure 2 Paper Figure 2

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adaptive_conformal_inference-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adaptive_conformal_inference-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file adaptive_conformal_inference-0.1.0.tar.gz.

File metadata

File hashes

Hashes for adaptive_conformal_inference-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68759a71594aedc390a734d0426d463ace0aa83dacacda1a91ebe01d34c8dc68
MD5 c310238c0f01061c987fc78b20a0e838
BLAKE2b-256 951b14f1667e3bb24ec55edbbf735b74f493b64c23d389f5a938577f9d709d3c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adaptive_conformal_inference-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for adaptive_conformal_inference-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df71ce3e9655f84f220a3a118ac4d8654a3834bc7aa635967dc419e8149cbda3
MD5 7557346d5fa48efa5f7979d87f723198
BLAKE2b-256 e0f4242bac5df7505cf21a9e893237f0e0fd94e7745d7f297b5e40bd4bedb9c7

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page