Introduction To Conformal Prediction With Python

A Short Guide For Quantifying The Uncertainty Of Machine Learning Models

Introduction To Conformal Prediction With Python cover image

Introduction To Conformal Prediction With Python is the quickest way to learn an easy-to-use and very general technique for uncertainty quantification.

“This concise book is accessible, lucid, and full of helpful code snippets. It explains the mathematical ideas with clarity and provides the reader with practical examples that illustrate the essence of conformal prediction, a powerful idea for uncertainty quantification.”

– Junaid Butt, Research Software Engineer, IBM Research

Where To Buy


A prerequisite for trust in machine learning is uncertainty quantification. Without it, an accurate prediction and a wild guess look the same.

Yet many machine learning models come without uncertainty quantification. And while there are many approaches to uncertainty – from Bayesian posteriors to bootstrapping – we have no guarantees that these approaches will perform well on new data.

At first glance conformal prediction seems like yet another contender. But conformal prediction can work in combination with any other uncertainty approach and has many advantages that make it stand out:

  • Guaranteed coverage: Prediction regions generated by conformal prediction come with coverage guarantees of the true outcome
  • Easy to use: Conformal prediction approaches can be implemented from scratch with just a few lines of code
  • Model-agnostic: Conformal prediction works with any machine learning model
  • Distribution-free: Conformal prediction makes no distributional assumptions
  • No retraining required: Conformal prediction can be used without retraining the model
  • Broad application: conformal prediction works for classification, regression, time series forecasting, and many other tasks

Sound good? Then this is the right book for you to learn about this versatile, easy-to-use yet powerful tool for taming the uncertainty of your models.

Who This Book Is For

This book is for data scientists, statisticians, machine learners and all other modelers who want to learn how to quantify uncertainty with conformal prediction. Even if you already use uncertainty quantification in one way or another, conformal prediction is a valuable addition to your toolbox.


  • You should know the basics of machine learning
  • Practical experience with modeling is helpful
  • If you want to follow the code examples, you should know the basics of Python or at least another programming language
  • This includes knowing how to install Python and Python libraries

The book is not an academic introduction to the topic, but a very practical one. So instead of lots of theory and math, there will be intuitive explanations and hands-on examples.

Table Of Contents

  1. Introduction to Conformal Prediction
  2. Getting Started with Conformal Prediction in Python
  3. Intuition Behind Conformal Prediction
  4. Classification
  5. Regression and Quantile Regression
  6. A Glimpse Beyond Classification and Regression
  7. Design Your Own Conformal Predictor
  8. Q & A