Transcription of On Calibration of Modern Neural Networks
1 On Calibration of Modern Neural NetworksChuan Guo* 1 Geoff Pleiss* 1Yu Sun* 1 Kilian Q. Weinberger1 AbstractConfidence Calibration the problem of predict-ing probability estimates representative of thetrue correctness likelihood is important forclassification models in many applications. Wediscover that Modern Neural Networks , unlikethose from a decade ago, are poorly extensive experiments, we observe thatdepth, width, weight decay, and Batch Normal-ization are important factors influencing calibra-tion. We evaluate the performance of variouspost-processing Calibration methods on state-of-the-art architectures with image and documentclassification datasets. Our analysis and exper-iments not only offer insights into Neural net-work learning , but also provide a simple andstraightforward recipe for practical settings: onmost datasets,temperature scaling a single-parameter variant of Platt Scaling is surpris-ingly effective at calibrating IntroductionRecent advances in deep learning have dramatically im-proved Neural network accuracy (Simonyan & Zisserman,2015; Srivastava et al.)
2 , 2015; He et al., 2016; Huang et al.,2016; 2017). As a result, Neural Networks are now entrustedwith making complex decisions in applications, such as ob-ject detection (Girshick, 2015), speech recognition (Han-nun et al., 2014), and medical diagnosis (Caruana et al.,2015). In these settings, Neural Networks are an essentialcomponent of larger decision making real-world decision making systems, classification net-works must not only be accurate, but also should indicatewhen they are likely to be incorrect. As an example, con-sider a self-driving car that uses a Neural network to detectpedestrians and other obstructions (Bojarski et al., 2016).*Equal contribution, alphabetical to: Chuan Yu of the34thInternational Conference on MachineLearning, Sydney, Australia, PMLR 70, 2017. Copyright 2017by the author(s). of SamplesAvg. confidenceAccuracyLeNet (1998) confidenceAccuracyResNet (2016) histograms (top) and reliability diagrams(bottom) for a 5-layer LeNet (left) and a 110-layer ResNet (right)on CIFAR-100.
3 Refer to the text below for detailed the detection network is not able to confidently predictthe presence or absence of immediate obstructions, the carshould rely more on the output of other sensors for , in automated health care, control should bepassed on to human doctors when the confidence of a dis-ease diagnosis network is low (Jiang et al., 2012). Specif-ically, a network should provide acalibrated confidencemeasure in addition to its prediction. In other words, theprobability associated with the predicted class label shouldreflect its ground truth correctness confidence estimates are also important formodel interpretability. Humans have a natural cognitive in-tuition for probabilities (Cosmides & Tooby, 1996). Goodconfidence estimates provide a valuable extra bit of infor-mation to establish trustworthiness with the user espe-cially for Neural Networks , whose classification decisionsare often difficult to interpret.
4 Further, good probabilityestimates can be used to incorporate Neural Networks intoother probabilistic models. For example, one can improveperformance by combining network outputs with a lan- [ ] 3 Aug 2017guage model in speech recognition (Hannun et al., 2014;Xiong et al., 2016), or with camera information for objectdetection (Kendall & Cipolla, 2016).In 2005, Niculescu-Mizil & Caruana (2005) showed thatneural Networks typically produce well-calibrated proba-bilities on binary classification tasks. While Neural net-works today are undoubtedly more accurate than they werea decade ago, we discover with great surprise thatmod-ern Neural Networks are no longer well-calibrated. Thisis visualized in Figure 1, which compares a 5-layer LeNet(left) (LeCun et al., 1998) with a 110-layer ResNet (right)(He et al., 2016) on the CIFAR-100 dataset. The top rowshows the distribution of prediction confidence ( prob-abilities associated with the predicted label) as average confidence of LeNet closely matches its accu-racy, while the average confidence of the ResNet is substan-tially higher than its accuracy.
5 This is further illustrated inthe bottom row reliability diagrams (DeGroot & Fienberg,1983; Niculescu-Mizil & Caruana, 2005), which show ac-curacy as a function of confidence. We see that LeNet iswell-calibrated, as confidence closely approximates the ex-pected accuracy ( the bars align roughly along the diag-onal). On the other hand, the ResNet s accuracy is better,but does not match its goal is not only to understand why Neural networkshave become miscalibrated, but also to identify what meth-ods can alleviate this problem. In this paper, we demon-strate on several computer vision and NLP tasks that neu-ral Networks produce confidences that do not represent trueprobabilities. Additionally, we offer insight and intuitioninto network training and architectural trends that maycause miscalibration. Finally, we compare various post-processing Calibration methods on state-of-the-art neuralnetworks, and introduce several extensions of our , we find that a single-parameter variant of Plattscaling (Platt et al.)
6 , 1999) which we refer to astemper-ature scaling is often the most effective method at ob-taining calibrated probabilities. Because this method isstraightforward to implement with existing deep learningframeworks, it can be easily adopted in practical DefinitionsThe problem we address in this paper is supervised multi-class classification with Neural Networks . The inputX Xand labelY Y={1,..,K}are random variablesthat follow a ground truth joint distribution (X,Y) = (Y|X) (X). Lethbe a Neural network withh(X) =( Y , P), where Yis a class prediction and Pis its associ-ated confidence, probability of correctness. We wouldlike the confidence estimate Pto be calibrated, which in-tuitively means that Prepresents a true probability. Forexample, given 100 predictions, each with confidence , we expect that80should be correctly classified. Moreformally, we defineperfect calibrationasP( Y=Y| P=p)=p, p [0,1](1)where the probability is over the joint distribution.
7 In allpractical settings, achieving perfect Calibration is impos-sible. Additionally, the probability in (1) cannot be com-puted using finitely many samples since Pis a continuousrandom variable. This motivates the need for empirical ap-proximations that capture the essence of (1).Reliability Diagrams( Figure 1 bottom) are a visualrepresentation of model Calibration (DeGroot & Fienberg,1983; Niculescu-Mizil & Caruana, 2005). These diagramsplot expected sample accuracy as a function of the model is perfectly calibrated if (1) holds thenthe diagram should plot the identity function. Any devia-tion from a perfect diagonal represents estimate the expected accuracy from finite samples, wegroup predictions intoMinterval bins (each of size1/M)and calculate the accuracy of each bin. LetBmbe the setof indices of samples whose prediction confidence falls intothe intervalIm= (m 1M,mM].)
8 The accuracy ofBmisacc(Bm) =1|Bm| i Bm1( yi=yi),where yiandyiare the predicted and true class labels forsamplei. Basic probability tells us thatacc(Bm)is an un-biased and consistent estimator ofP( Y=Y| P Im).We define the average confidence within binBmasconf(Bm) =1|Bm| i Bm pi,where piis the confidence for (Bm)andconf(Bm)approximate the left-hand and right-hand sidesof (1) respectively for binBm. Therefore, a perfectly cal-ibrated model will haveacc(Bm) = conf(Bm)for allm {1,..,M}. Note that reliability diagrams do not dis-play the proportion of samples in a given bin, and thus can-not be used to estimate how many samples are Calibration Error (ECE).While reliabilitydiagrams are useful visual tools, it is more convenient tohave a scalar summary statistic of Calibration . Since statis-tics comparing two distributions cannot be comprehensive,previous works have proposed variants, each with a uniqueemphasis.
9 One notion of miscalibration is the difference inexpectation between confidence and accuracy, P[ P( Y=Y| P=p) p ](2)Expected Calibration Error (Naeini et al., 2015) or ECE approximates (2) by partitioning predictions intoMequally-spaced bins (similar to the reliability diagrams) DepthResNet - CIFAR-100 ErrorECE050100150200250300 Filters per layerVarying WidthResNet-14 - CIFAR-100 ErrorECEW ithoutWithBatch NormalizationUsing NormalizationConvNet - CIFAR-100 ErrorECE10 510 410 310 2 Weight decayVarying Weight DecayResNet-110 - CIFAR-100 ErrorECEF igure effect of network depth (far left), width (middle left), Batch Normalization (middle right), and weight decay (far right) onmiscalibration, as measured by ECE (lower is better).taking a weighted average of the bins accuracy/confidencedifference. More precisely,ECE=M m=1|Bm|n acc(Bm) conf(Bm) ,(3)wherenis the number of samples.
10 The difference betweenaccandconffor a given bin represents the calibrationgap(red bars in reliability diagrams Figure 1). We useECE as the primary empirical metric to measure calibra-tion. See Section S1 for more analysis of this Calibration Error (MCE).In high-risk ap-plications where reliable confidence measures are abso-lutely necessary, we may wish to minimize the worst-casedeviation between confidence and accuracy:maxp [0,1] P( Y=Y| P=p) p .(4)The Maximum Calibration Error (Naeini et al., 2015) orMCE estimates this deviation. Similarly to ECE, this ap-proximation involves binning:MCE= maxm {1,..,M}|acc(Bm) conf(Bm)|.(5)We can visualize MCE and ECE on reliability is the largest Calibration gap (red bars) across all bins,whereas ECE is a weighted average of all gaps. For per-fectly calibrated classifiers, MCE and ECE both equal log likelihoodis a standard measure of a prob-abilistic model s quality (Friedman et al.)