• Stars
    star
    707
  • Rank 64,036 (Top 2 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight, useful implementation of conformal prediction on real data.

Conformal Prediction

rigorous uncertainty quantification for any machine learning task

This repository is the easiest way to start using conformal prediction (a.k.a. conformal inference) on real data. Each of the notebooks applies conformal prediction to a real prediction problem with a state-of-the-art machine learning model.

No need to download the model or data in order to run conformal

Raw model outputs for several large-scale real-world datasets and a small amount of sample data from each dataset are downloaded automatically by the notebooks. You can develop and test conformal prediction methods entirely in this sandbox, without ever needing to run the original model or download the original data. Open a notebook to see the expected output. You can use these notebooks to experiment with existing methods or as templates to develop your own.

Example notebooks

Notebooks can be run immediately using the provided Google Colab links

Colab links are in the top cell of each notebook

To run these notebooks locally, you just need to have the correct dependencies installed and press run all cells! The notebooks will automatically download all required data and model outputs. You will need 1.5GB of space on your computer in order for the notebook to store the auto-downloaded data. If you want to see how we generated the precomputed model outputs and data subsamples, see the files in generation-scripts. There is one for each dataset. To create a conda environment with the correct dependencies, run conda env create -f environment.yml. If you still get a dependency error, make sure to activate the conformal environment within the Jupyter notebook.

Citation

This repository is meant to accompany our paper, the Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification. In that paper is a detailed explanation of each example and attributions. If you find this repository useful, in addition to the relevant methods and datasets, please cite:

@article{angelopoulos2021gentle,
  title={A gentle introduction to conformal prediction and distribution-free uncertainty quantification},
  author={Angelopoulos, Anastasios N and Bates, Stephen},
  journal={arXiv preprint arXiv:2107.07511},
  year={2021}
}

Videos

If you're interested in learning about conformal prediction in video form, watch our videos below!

A Tutorial on Conformal Prediction

A Tutorial on Conformal Prediction Part 2: Conditional Coverage

A Tutorial on Conformal Prediction Part 3: Beyond Conformal Prediction

More Repositories

1

conformal_classification

Wrapper for a PyTorch classifier which allows it to output prediction sets. The sets are theoretically guaranteed to contain the true class with high probability (via conformal prediction).
Jupyter Notebook
218
star
2

ppi_py

A package for statistically rigorous scientific discovery using machine learning. Implements prediction-powered inference.
Python
193
star
3

rcps

Official codebase for "Distribution-Free, Risk-Controlling Prediction Sets"
Python
84
star
4

conformal-time-series

Conformal prediction for time-series applications.
Jupyter Notebook
81
star
5

prediction-powered-inference

A statistical toolkit for scientific discovery using machine learning
Jupyter Notebook
69
star
6

event_based_gaze_tracking

Dataset release for Event-Based, Near-Eye Gaze Tracking Beyond 10,000 Hz
Python
62
star
7

ltt

Learn then Test: Calibrating Predictive Algorithms to Achieve Risk Control
Jupyter Notebook
60
star
8

conformal-risk

Conformal prediction for controlling monotonic risk functions. Simple accompanying PyTorch code for conformal risk control in computer vision and natural language processing.
Python
55
star
9

im2im-uq

Image-to-image regression with uncertainty quantification in PyTorch. Take any dataset and train a model to regress images to images with rigorous, distribution-free uncertainty quantification.
Python
50
star
10

cfr-covid-19

Implementation of https://arxiv.org/abs/2003.08592
R
17
star
11

private_prediction_sets

Wrap around any model to output differentially private prediction sets with finite sample validity on any dataset.
Python
17
star
12

online-conformal-decaying

Jupyter Notebook
3
star
13

conformal-triage

Jupyter Notebook
2
star