Uncertainty Toolbox: an Open-Source Library for Assessing, Visualizing, and Improving Uncertainty Quantification

Youngseog Chung, Ian Char, Han Guo, Jeff Schneider, Willie NeiswangerarXiv 2021

Introduction

As machine learning models are increasingly deployed in safety-critical domains such as autonomous driving and healthcare, the ability to quantify uncertainty accurately becomes paramount. Knowing when a model is likely to fail is as critical as the prediction itself. However, the field of Uncertainty Quantification (UQ) currently suffers from fragmentation. Researchers employ a variety of disjointed metrics—ranging from Negative Log-Likelihood (NLL) to proper scoring rules like the Continuous Ranked Probability Score (CRPS)—making cross-study comparisons difficult. Furthermore, while tools for classification UQ exist, the regression setting has lacked a centralized, user-friendly toolkit.

The Uncertainty Toolbox

To address these challenges, we introduce the Uncertainty Toolbox, an open-source Python library designed to standardize the assessment, visualization, and improvement of UQ in regression tasks. The toolbox is built upon four core pillars:

  1. Evaluation Metrics: A comprehensive suite including average calibration, adversarial group calibration, sharpness, and proper scoring rules (NLL, CRPS, check score, and interval score).
  2. Recalibration: Tools such as isotonic regression to post-process model outputs and improve average calibration.
  3. Visualizations: Ready-to-use plotting utilities for inspecting predicted distributions, calibration curves, and prediction accuracy.
  4. Pedagogy: A glossary of UQ terms and a curated list of seminal papers to lower the barrier to entry for researchers.
Comprehensive visualization of UQ metrics and model behavior across different loss functions, including predictions, intervals, and calibration curves.

Case Study: Probabilistic Neural Networks

We demonstrate the utility of the toolbox through a case study on Probabilistic Neural Networks (PNNs) trained on a synthetic 1D regression dataset with heteroscedastic Gaussian noise. The dataset follows the function $y = \sin(x/2) + x \cos(0.8x)$, with noise scales varying across four quadrants of the input space.

Key Insights

Our analysis reveals several critical aspects of UQ performance:

  • The Multi-Metric Necessity: No single metric provides a complete picture of model reliability. A model might excel in NLL but fail on adversarial group calibration.
  • Sharpness-Calibration Tradeoff: There is an inherent tension between producing narrow (sharp) intervals and maintaining calibration. For instance, CRPS-trained models often produced intervals that were overly narrow compared to the ground truth.
  • Adversarial Group Calibration: While average calibration can be misleading by masking local failures, adversarial group calibration provides a more robust assessment by checking subsets of the data.
Adversarial group calibration error across different group sizes, highlighting the robustness of various scoring rules against local miscalibration.

Results and Discussion

The choice of loss function significantly impacts UQ metrics. CRPS and Check Score training often yielded better predictive accuracy (lower RMSE/MAE) than standard NLL training. However, NLL tended to produce wider, more "under-confident" intervals. Adversarial group calibration further demonstrated that NLL, while appearing well-calibrated on average, was less robust than CRPS or Interval-based models when evaluated on smaller data subsets.

While currently focused on regression, the Uncertainty Toolbox provides a foundational framework for standardizing UQ. Future work will expand these utilities to classification and high-dimensional real-world datasets, where visual inspection is less feasible and robust scalar metrics are essential for model safety.

Summary updated

BibTeX
@misc{chung2021uncertainty,
  author = {Youngseog Chung and Ian Char and Han Guo and Jeff Schneider and Willie Neiswanger},
  title = {{Uncertainty Toolbox: an Open-Source Library for Assessing, Visualizing, and Improving Uncertainty Quantification}},
  year = {2021},
  eprint = {2109.10254},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.10254},
}
Figure