Published September 19, 2023 | Version v1
Dataset Open

Expectation consistency for calibration of neural networks (code)

  • 1. École Polytechnique Fédérale de Lausanne (EPFL), Statistical Physics of Computation lab., CH-1015 Lausanne, Switzerland
  • 2. Département d'Informatique, École Normale Supérieure - PSL & CNRS, Paris, France
  • 3. École Polytechnique Fédérale de Lausanne (EPFL), Information, Learning and Physics lab., CH-1015 Lausanne, Switzerland

* Contact person

Description

Despite their incredible performance, it is well reported that deep neural networks tend to be overoptimistic about their prediction confidence. Finding effective and efficient calibration methods for neural networks is therefore an important endeavour towards better uncertainty quantification in deep learning. In this manuscript, we introduce a novel calibration technique named expectation consistency (EC), consisting of a post-training rescaling of the last layer weights by enforcing that the average validation confidence coincides with the average proportion of correct labels. First, we show that the EC method achieves similar calibration performance to temperature scaling (TS) across different neural network architectures and data sets, all while requiring similar validation samples and computational resources. However, we argue that EC provides a principled method grounded on a Bayesian optimality principle known as the Nishimori identity. Next, we provide an asymptotic characterization of both TS and EC in a synthetic setting and show that their performance crucially depends on the target function. In particular, we discuss examples where EC significantly outperforms TS. This record provides the code for the paper "Expectation consistency for calibration of neural networks".

Files

File preview

files_description.md

All files

Files (29.8 MiB)

Name Size
md5:4079d9b002c199c128778493f8f98e16
256 Bytes Preview Download
md5:fbcc77f1b6d304e8b48982e4f3bf8d55
29.8 MiB Preview Download

References

Journal reference
L. Clarte, B. Loureiro, F. Krzakala, L. Zdeborova, PMLR 216, 443-453 (2023), doi: 10.48550/arXiv.2303.02644