Giter VIP home page Giter VIP logo

conformal-predictions-from-scratch's Introduction

Conformal Predictions from Scratch

The aim of this repository is to implement some popular Conformal Prediction methods from scratch using pure NumPy. The correctness is then verified with reference implementations from libraries like MAPIE. All of this is done with illustrative examples and thorough explanation of the code.

Why do we reimplement things from scratch? Because we want to understand the methods from ground up in order to use them with confidence in future projects where stakes may be high. This understanding is also needed for researchers who may think about coming up with novel methods on their own. Therefore, the purpose of this repository is educational.

πŸ•΅οΈβ€β™€οΈ What are Conformal Predictions?

Conformal Predictions have become a very popular way of equipping machine learning models with predictive uncertainty estimates. One reason for this is that they are model-agnostic meaning that previously trained (or even deployed) models can be enhanced with predictive uncertainties post hoc. Another advantage is that Conformal Predictions come with theoretical guarantees on how much of the future data to be predicted will actually fall inside the predictive bands (generally assuming exchangeability of the data). This may seem to good to be true, but makes a lot of sense when understanding how the predictions are "conformalized".

A great list of references and tutorials on the topic can be found here.

πŸ“ The Structure of this Repository

The repository contains one Jupyter notebook per conformal prediction method, i.e., one way to obtain predictive error bands. All notebooks are located in the notebooks folder and new notebooks will be added over time.

πŸ“ˆ Regression

Notebook Title (Method Name) Description Academic Reference Reference Implementation
Split Conformal Prediction Conformal Predictions with fixed prediction bands obtained via (the default) absolute residual scores. Distribution-Free Predictive Inference for Regression (Section 2.2) MAPIE Regressor with AbsoluteConformityScore
Locally Weighted Conformal Prediction Conformal Predictions with variable prediction bands obtained via residual normalised scores. Distribution-Free Predictive Inference for Regression (Section 5.2) MAPIE Regressor with ResidualNormalisedScore
Conformalized Quantile Regression (CQR) Conformal Predictions with variable prediction bands obtained via quantile regression. Conformalized Quantile Regression MAPIE QuantileRegressor
Conformal Prediction Beyond Exchangeability Analysis of Conformal Predictions when the exchangeability assumption is violated. Conformal prediction beyond exchangeability Paper Code ZIP-File

conformal-predictions-from-scratch's People

Contributors

jonaswacker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

conformal-predictions-from-scratch's Issues

cal_prediction_bands In CQR NB undefined

Hi! Thanks for the awesome repo for CP, the NBs even run in Juno on my iPad (MAPIE runs too, but great stuff anyways).

I was experimenting with the NBs and found the following line of code in the CQR-NB keeps failing:
cal_coverage = compute_coverage(y_cal, cal_prediction_bands[:,:,0])

cal_prediction_bands is not defined at this stage.

Not sure, what you were about to accomplish here, surely you can clarify and commit a fix.

Thanks,
JΓΌrgen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.