Book Image

Practical Guide to Applied Conformal Prediction in Python

By : Valery Manokhin
4 (1)
Book Image

Practical Guide to Applied Conformal Prediction in Python

4 (1)
By: Valery Manokhin

Overview of this book

In the rapidly evolving landscape of machine learning, the ability to accurately quantify uncertainty is pivotal. The book addresses this need by offering an in-depth exploration of Conformal Prediction, a cutting-edge framework to manage uncertainty in various ML applications. Learn how Conformal Prediction excels in calibrating classification models, produces well-calibrated prediction intervals for regression, and resolves challenges in time series forecasting and imbalanced data. Discover specialised applications of conformal prediction in cutting-edge domains like computer vision and NLP. Each chapter delves into specific aspects, offering hands-on insights and best practices for enhancing prediction reliability. The book concludes with a focus on multi-class classification nuances, providing expert-level proficiency to seamlessly integrate Conformal Prediction into diverse industries. With practical examples in Python using real-world datasets, expert insights, and open-source library applications, you will gain a solid understanding of this modern framework for uncertainty quantification. By the end of this book, you will be able to master Conformal Prediction in Python with a blend of theory and practical application, enabling you to confidently apply this powerful framework to quantify uncertainty in diverse fields.
Table of Contents (19 chapters)
Free Chapter
1
Part 1: Introduction
4
Part 2: Conformal Prediction Framework
8
Part 3: Applications of Conformal Prediction
14
Part 4: Advanced Topics

The p-value and its role in conformal prediction

In conformal prediction, p-values are key in constructing prediction regions and intervals with a guaranteed confidence level. However, their purpose is different than in traditional statistical hypothesis testing.

Let’s walk through an example binary classification task to understand how this works. Suppose we want to predict whether a patient has a medical condition based on their symptoms and characteristics:

  1. First, we calculate a nonconformity score that measures how different or “nonconforming” the new patient is compared to previously seen patients. We can define this score in various ways, such as the distance between feature values.
  2. Next, we temporarily assign the patient each possible label – 0 (no condition) and 1 (has condition) – and recalculate the nonconformity score with that assigned label.

If the score is similar to scores for past patients with label 0, then label...