Deep Probability Estimation

1 INTRODUCTION . We consider the problem of building models that answer questions such as : Will it rain ? Will a patient survive ? Will a car collide with another vehicle ? Due to the inherently-uncertain nature of these real-world phenomena , this requires performing probability estimation , i.e . estimating the probability of each possible outcome of the phenomenon of interest . Models for probability prediction must be trained on observed outcomes ( e.g . whether it rained , a patient died , or a collision occurred ) , because the ground-truth probabilities are unknown . The problem is therefore analogous to binary classification , with the important difference that the objective is to estimate probabilities rather than predicting specific outcomes . In probability estimation , two identical inputs ( e.g . histopathology images from cancer patients ) can potentially result in two different outcomes ( death vs. survival ) . In contrast , in classification the class label is usually completely determined by the data ( a picture either shows a cat or it does not ) . The goal of this work is to investigate probability estimation from high-dimensional data using deep neural networks . Deep networks trained for classification often generate probabilities , which quantify the uncertainty of the estimate ( i.e . how likely the network is to classify correctly ) . This quantification has been observed to be inaccurate , and several methods have been developed to improve it ( Platt , 1999 ; Guo et al. , 2017 ; Szegedy et al. , 2016 ; Zhang et al. , 2020 ; Thulasidasan et al. , 2020 ; Mukhoti et al. , 2020 ; Thagaard et al. , 2020 ) , including Bayesian neural networks ( Gal & Ghahramani , 2016 ; Wang et al. , 2016 ; Shekhovtsov & Flach , 2019 ; Postels et al. , 2019 ) . However , these works restrict their attention almost exclusively to classification in datasets ( e.g . CIFAR10/100 Krizhevsky ( 2009 ) , or ImageNet ( Deng et al. , 2009 ) ) where the label is not uncertain , and therefore the uncertainty is completely tied to the model : it quantifies the confidence of the model in its own prediction , not the probability of an event of interest . Probability estimation from high-dimensional data is crucial in medical prognostics ( Wulczyn et al. , 2020 ) , weather prediction ( Agrawal et al. , 2019 ) , and autonomous driving ( Kim et al. , 2019 ) . In order to advance deep-learning methodology for probability estimation it is crucial to build appropriate benchmark datasets . Here we build a synthetic dataset and gather three real-world datasets , which we use to systematically evaluate existing methodology . In addition , we propose a novel approach , which outperforms current state-of-the-art methods . Our contributions are the following : • We introduce a new synthetic dataset for probability estimation where a population of people may have a certain disease connected to age . The task is to predict the probability that they contract the disease from a picture of their face . The data are generated based on the UTKFaces dataset ( Zhang et al. , 2017a ) , which contains age information . The dataset contains multiple versions of the synthetic labels , which are generated according to different distributions designed to mimic realworld probability-prediction datasets . The dataset serves two objectives . First , it allows us to evaluate existing methodology . Second , it enables us to evaluate different metrics in a controlled scenario where we have access to ground-truth probabilities . • We have used publicly available data to build probability-estimation benchmark datasets for three real-world applications : ( 1 ) precipitation forecasting from radar images , ( 2 ) prediction of cancerpatient survival from histopathology images , and ( 3 ) prediction of vehicle collisions from dashcam videos . We use these datasets to systematically evaluate existing approaches , which have been previously tested mainly on classification datasets . • We propose Calibrated Probability Estimation ( CaPE ) , a novel technique which modifies the training process so that output probabilities are consistent with empirical probabilities computed from the data . CaPE outperforms existing approaches on most metrics on synthetic and real-world data . 2 PROBLEM FORMULATION : PROBABILITY ESTIMATION . The goal of probability estimation is to evaluate the likelihood of a certain event of interest , based on observed data . The available training data consists of n examples xi , 1 ≤ i ≤ n , each associated with a corresponding outcome yi . In our applications of interest , the input data are high dimensional : each xi corresponds to an image or a video . The corresponding label yi is either 0 or 1 depending on whether or not the event in question occurred . For example , in the cancer-survival application xi is a histopathology image of a patient , and yi equals 1 if the patient survived for 5 years after xi was collected . The data have inherent uncertainty : yi , the patient ’ s survival , does not depend deterministically on the histopathology image ( due e.g . to comorbidities and other health factors ) . Instead , we assume that yi equals 1 with a certain probability pi associated with xi , , as illustrated in Figure 1 , because the input data provides key information about the patient ’ s survival chances . At inference , a probability-estimation model aims to generate an estimate p̂ of the underlying probability p , associated with a new input data point x ( e.g . the probability of survival for over 5 years for new patients based on their histopathology data ) . To summarize , this is not a classification problem , because the labels are not completely predictable . Instead , the goal is to predict the probability of the outcome , which is critical in choosing a course of treatment for the patient . 3 EVALUATION METRICS . Probability estimation shares similar target labels and network outputs with binary classification . However , classification accuracy is not an appropriate metric for evaluating probability-estimation models due to the inherent uncertainty of the outcomes . This is illustrated by the example in Figure 2a where a perfect probability estimate would result in a classification accuracy of just 75 % .1 Metrics when ground-truth probabilities are available . For synthetic datasets , we have access to the ground truth probability labels and can use them to evaluate performance . Two reasonable metrics are the mean squared error or ` 2 distance MSEp , and the Kullback–Leibler divergence KLp between the estimated and ground-truth probabilities : MSEp = 1 N N∑ i=1 ( p̂i − pi ) 2 , and KLp = 1 N N∑ i=1 ( p̂i log ( p̂i pi ) + ( 1− p̂i ) log ( 1− p̂i 1− pi ) ) . ( 1 ) N is the number of data , and pi , p̂i are the ground-truth and predicted probabilities respectively . Calibration metrics . In real-world data , ground-truth probabilities are not available . In order to evaluate the probabilities estimated by a model , we need to compare them to the observed probabilities . To this end , we aggregate the examples for which the model output equals a certain value ( e.g . 0.5 ) , and verify what fraction of them have outcomes equal to 1 . If the fraction is close to the model output , then the model is said to be well calibrated . Definition 3.1 . A model f is well calibrated if P ( y = 1 | f ( x ) ∈ I ( q ) ) = q , ∀ 0 ≤ q ≤ 1 , ( 2 ) where y is the observed outcome , f ( x ) is the probability predicted by model f for input x , and I ( q ) is a small interval around q . Model calibration can be evaluated using the expected calibration error ( ECE ) ( Guo et al. , 2017 ) ( note however that the definition Guo et al . ( 2017 ) is specific to classification ) . Given a probabilityestimation model f and a dataset of input data xi and associated outcomes yi , 1 ≤ i ≤ N , we partition the examples into B bins , I1I2 , · · · , IB , according to the probabilities assigned to the examples by the model . Let Q1 , . . . , QB−1 the B-quantiles of the set { f ( x1 ) , . . . , f ( xN ) } , we have Ib : = [ Qb−1 , Qb ] ∩ { f ( xi ) } Ni=1 ( setting Q0 = 0 ) . For each bin , we compute the mean predicted and empirical probabilities , p ( b ) emp = E ( y | f ( x ) ∈ Ib ) = 1 |Ib| ∑ i∈Index ( Ib ) yi , ( 3 ) q ( b ) = 1 |Ib| ∑ i∈Index ( Ib ) f ( xi ) , ( 4 ) 1A perfect model ( in terms of probability estimation ) , assigns 0.25 to the blue class and 0.75 to the red class . To maximize classification accuracy , we predict when the model outputs 0.75 ( red examples ) and 0 when it outputs 0.25 ( blue examples ) . However , 25 % of red examples have an outcome of 0 , and 25 % of blue examples have an outcome of 1 . As a result , the model would only have 75 % accuracy . where Index ( Ib ) = { i | f ( xi ) ∈ Ib } . The pairs ( q ( b ) , p ( b ) emp ) can be plotted as a reliability diagram , shown in the second row of Figure 4 and in Figure 6 . ECE is then defined as ECE = 1 B B∑ b=1 ∣∣∣p ( b ) emp − q ( b ) ∣∣∣ . ( 5 ) Other metrics for calibration include the maximum calibration error ( MCE ) defined as MCE = max b=1 , ... , B ∣∣∣p ( b ) emp − q ( b ) ∣∣∣ , and the Kolmogorov-Smirnov error ( KS-error ) ( Gupta et al. , 2021 ) , a metric based on the cumulative distribution function , which is described in more detail in Appendix B. Brier score . Crucially , a model without any discriminative power can be perfectly calibrated ( see Figure 2b ) . The Brier score is a metric designed to evaluate both calibration and discriminative ability . It is the mean squared error between the predicted probability and the observed outcomes : Brier = 1 N N∑ i=1 ( p̂i − yi ) 2 . ( 6 ) This score can be decomposed into two terms associated to calibration and discrimination ability , as shown in Appendix C. Using the synthetic data in Section 6.1 , where the ground-truth probabilities are known , we show that Brier score is indeed a reliable proxy for gold-standard MSE metric based on ground-truth probabilities MSEp , in contrast to calibration metrics such as ECE , MCE or KSerror , and to classification metrics such as AUC ( see Figure 3 and Appendix D ) . 4 PROPOSED METHOD : CALIBRATED PROBABILITY ESTIMATION ( CAPE ) . Prediction models based on deep learning are typically trained by minimizing the cross entropy between the model output and the training labels ( Goodfellow et al. , 2016 ) . This cost function is a proper scoring rule , which means that it evaluates probability estimates in a consistent manner and is therefore guaranteed to be well calibrated in an infinite-data regime ( Buja et al. , 2005 ) , as illustrated by Figure 4 ( first column ) . Unfortunately , in practice prediction models are trained on finite data . This is crucial in the case of deep neural networks , because these models are highly overparametrized and therefore prone to overfitting ( Goodfellow et al. , 2016 ) . In classification , networks have been shown to be capable of fitting arbitrary random labels ( Zhang et al. , 2017a ) . In probability estimation , we observe that neural networks indeed eventually overfit the observed outcomes completely . Moreover , the estimated probabilities collapse to 0 or 1 ( Figure 4 , second column ) , a phenomenon that has also been reported in classification ( Mukhoti et al. , 2020 ) . However , calibration is preserved during the first stages of training ( Figure 4 , third column ) . This is reminiscent of the early-learning phenomenon observed for classification from partially corrupted labels ( Yao et al. , 2020 ; Xia et al. , 2020 ) , where neural networks learn from the correct labels before eventually overfitting the false ones ( Liu et al. , 2020 ) . Here , we propose to exploit the training dynamics of cross-entropy minimization through a method that we name Calibrated Probability Estimation ( CaPE ) . Our starting point is a model obtained via early stopping using validation data on the cross-entropy loss . CaPE is designed to further improve the discrimination ability of the model , while ensuring that it remains well calibrated . This is achieved by alternatively minimizing the following two loss functions : Discrimination loss : Cross entropy between the model output and the observed binary outcomes , LD = − N∑ i=1 [ yi log ( f ( xi ) ) + ( 1− yi ) log ( 1− f ( xi ) ) ] . Calibration loss : Cross entropy between the output probability of the model and the empirical probability of the outcomes conditioned on the model output : LC = − N∑ i=1 [ piemp log ( f ( xi ) ) + ( 1− piemp ) log ( 1− f ( xi ) ) ] , where piemp is an estimate of the conditional probability P [ y = 1|f ( x ) ∈ I ( f ( xi ) ) ] where I ( f ( xi ) ) is a small interval centered at f ( xi ) . As explained in Section 3 if f ( xi ) is close to this value , then the model is well calibrated . We consider two approaches for estimating piemp . ( 1 ) CaPE ( bin ) where we divide the training set into bins , select the bin bi containing f ( xi ) and set piemp = p ( bi ) emp in equation 3 . ( 2 ) CaPE ( kernel ) where piemp is estimated through a moving average with a kernel function ( see Appendix E for more details ) . Both methods are efficiently computed by sorting the predictions p̂i . The calibration loss requires a reasonable estimation of the empirical probabilities p ( i ) emp , which can be obtained from the model after early learning . Therefore using the calibration loss from the beginning is counterproductive , as demonstrated in Section J. Algorithm 1 Pseudocode for CaPE Require : f . early stopped model Require : m . freq . of training with LC Require : { xi , yi } Ni=1 . training set Require : K ( p , q ) : = exp [ − ( p− q ) 2 /σ2 ] . Gaussian kernel for t = 1 to num epochs do if t mod m = 0 then p̂i ← f ( xi ) , ∀i Update piemp , ∀i , with BIN or KERNEL L ← LC . compute discrimination loss else L ← LD . compute calibration loss end if f ← backprop with L . train with loss end for function BIN ( B ) . B-number of bins I1 , · · · IB ← partitions by quantile of { p̂j } Nj=1 Find b such that p̂i ∈ Ib Index ( Ib ) ← { j|p̂j ∈ Ib } . get indices in bin b piemp ← 1|Ib| ∑ i∈Index ( Ib ) yi . empirical mean of bin b end function function KERNEL ( r , K ) . r-window size ; kernel Nr ( i ) ← r-nearest neighbor of p̂i ( output probability space ) Z ← ∑ p̂j∈Nr ( i ) K ( p̂i , p̂j ) . normalization factor piemp ← ∑ p̂j∈Nr ( i ) K ( p̂i , p̂j ) yj/Z . kernel smooth end function CaPE is summarized in Algorithm 1 . Figures 4 and 5 show that incorporating the calibration-loss minimization step indeed preserves calibration as training proceeds ( this is not necessarily expected because CaPE minimizes a calibration loss on the training data ) , and prevents the model from overfitting the observed outputs . This is beneficial also for the discriminative ability of the model , because it enables it to further reduce the cross-entropy loss without overfitting , as shown in Figure 5 . The experiments with synthetic and real-world data reported in Section 6 suggest that this approach results in accurate probability estimates across a variety of realistic scenarios .

Summary: The authors propose a method to ensure calibration of probability outputs during training. They do so by adding an explicit penalty to push the output probability values towards an empirical estimate of the actual probability for the current inferred probability. They compare the method to a number of baseline approaches, showing the benefits on both synthetic and real-world data sets.