Skip to main content
QUICK REVIEW

[Paper Review] Calibration of Neural Networks using Splines

Kartik Gupta, Amir Rahimi|arXiv (Cornell University)|Jun 23, 2020
Adversarial Robustness in Machine Learning30 references4 citations
TL;DR

This paper proposes a binning-free calibration method for neural networks using spline-fitted cumulative distribution functions derived from the Kolmogorov-Smirnov (KS) test. By approximating empirical cumulative distributions with differentiable splines on a held-out calibration set, the method learns a direct, non-learned recalibration function that maps raw network outputs to well-calibrated probabilities, consistently achieving <1% KS error across multiple datasets and architectures, outperforming state-of-the-art post-hoc calibration techniques.

ABSTRACT

Calibrating neural networks is of utmost importance when employing them in safety-critical applications where the downstream decision making depends on the predicted probabilities. Measuring calibration error amounts to comparing two empirical distributions. In this work, we introduce a binning-free calibration measure inspired by the classical Kolmogorov-Smirnov (KS) statistical test in which the main idea is to compare the respective cumulative probability distributions. From this, by approximating the empirical cumulative distribution using a differentiable function via splines, we obtain a recalibration function, which maps the network outputs to actual (calibrated) class assignment probabilities. The spine-fitting is performed using a held-out calibration set and the obtained recalibration function is evaluated on an unseen test set. We tested our method against existing calibration approaches on various image classification datasets and our spline-based recalibration approach consistently outperforms existing methods on KS error as well as other commonly used calibration measures. Our Code is available at https://github.com/kartikgupta-at-anu/spline-calibration.

Motivation & Objective

  • To address the limitations of histogram-based calibration metrics like Expected Calibration Error (ECE), which depend on arbitrary binning schemes.
  • To develop a binning-free, visualization-friendly calibration metric inspired by the Kolmogorov-Smirnov (KS) test for measuring classwise or top-r prediction calibration.
  • To design a non-learned, differentiable recalibration function using spline fitting on a held-out calibration set to map raw network outputs to well-calibrated probabilities.
  • To evaluate the method on diverse image classification datasets and architectures, demonstrating consistent superiority over existing post-hoc calibration techniques.
  • To preserve original model accuracy while significantly reducing calibration error across top-1 and top-2 predictions.

Proposed method

  • Proposes a binning-free calibration metric based on the KS test by comparing empirical cumulative distribution functions of predicted and true class probabilities.
  • Uses natural cubic splines to approximate the empirical cumulative distribution function of network outputs, enabling differentiable and smooth recalibration.
  • Fits the spline on a held-out calibration set to learn a recalibration function that maps raw logits to calibrated probabilities without updating model parameters.
  • Applies the learned recalibration function to unseen test data to evaluate calibration performance using KS error and other standard metrics.
  • Employs a fixed number of six knots for spline fitting across all experiments, ensuring consistent and stable calibration.
  • Evaluates the method using pretrained network logits from public repositories, maintaining original model accuracy during calibration.

Experimental results

Research questions

  • RQ1Can a binning-free calibration metric based on the KS test provide a more robust and consistent measure of neural network calibration than histogram-based metrics like ECE?
  • RQ2Can spline-fitting of empirical cumulative distributions yield a differentiable, non-learned recalibration function that improves calibration without retraining?
  • RQ3How does the proposed spline-based recalibration method compare to state-of-the-art post-hoc calibration techniques like temperature scaling and Dirichlet calibration across diverse datasets and architectures?
  • RQ4Does the method maintain high classification accuracy while achieving near-perfect calibration, particularly on large-scale datasets like ImageNet?
  • RQ5Can the method effectively calibrate not only top-1 but also top-2 and top-3 predictions, ensuring robustness across multiple prediction ranks?

Key findings

  • The proposed spline-based recalibration method achieves less than 1% KS error across all evaluated datasets and models, with the exception of one case where it reaches 0.7%.
  • The method consistently outperforms temperature scaling, vector scaling, matrix scaling with ODIR, and Dirichlet calibration in terms of KS error, especially on large-scale ImageNet.
  • In 9 out of 13 experiments, the method achieves lower KS error than temperature scaling, the closest competitor, with differences of less than 0.3% in marginal cases.
  • For top-2 prediction calibration, the method maintains calibration error below 1% across all experiments, setting a new state-of-the-art on ImageNet.
  • The method preserves the original model's classification accuracy in all tested cases, as it does not fine-tune or update network parameters.
  • The KS-based calibration metric provides effective visualizations similar to reliability diagrams and eliminates the dependency on binning schemes inherent in ECE.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.