Unsupervised Temperature Scaling: Robust Post-processing Calibration for Domain Shift
Authors: Azadeh Sadat Mozafari
Hugo Siqueira Gomes
Christian Gagne
Venue:  (2020)
Keywords: calibration
domain shift
uncertainty prediction
deep neural networks
temperature scaling

Abstract: The uncertainty estimation is critical in real-world decision making applications, especially when distributional shift between the training and test data are prevalent. Many calibration methods in the literature have been proposed to improve the predictive uncertainty of DNNs which are generally not well-calibrated. However, none of them is specifically designed to work properly under domain shift condition. In this paper, we propose Unsupervised Temperature Scaling (UTS) as a robust calibration method to domain shift. It exploits test samples to adjust the uncertainty prediction of deep models towards the test distribution.  UTS utilizes a novel loss function, weighted NLL, that allows unsupervised calibration.  We evaluate UTS on a wide range of model-datasets which shows the possibility of calibration without labels and demonstrate the robustness of UTS compared to other methods (e.g., TS, MC-dropout, SVI, ensembles) in shifted domains.  

Under review as a conference paper at ICLR 2020
UNSUPERVISED TEMPERATURE SCALING: ROBUST POST-PROCESSING CALIBRATION FOR Do- MAIN SHIFT
Anonymous authors Paper under double-bling review
ABSTRACT
The uncertainty estimation is critical in real-world decision making applications, especially when distributional shift between the training and test data are preva- lent. Many calibration methods in the literature have been proposed to improve the predictive uncertainty of DNNs which are generally not well-calibrated. However, none of them is specifically designed to work properly under domain shift condi- tion. In this paper, we propose Unsupervised Temperature Scaling (UTS) as ro- bust calibration method domain shift. It exploits unlabeled test samples instead of the training one to adjust the uncertainty prediction of deep models towards the test distribution. UTS utilizes novel loss function, weighted NLL, which allows unsupervised calibration. We evaluate UTS on a wide range of model-datasets to show the possibility of calibration without labels and demonstrate the robustness of UTS compared to other methods (e.g., TS, MC-dropout, SVI, ensembles) in shifted domains.
INTRODUCTION
The predictive distributions provided by Deep Neural Networks (DNNs) have been increasingly used for decision-support systems, for applications ranging from medical diagnoses assistance (Esteva et al. 2017) to self-driving cars (Bojarski er al., 2016). In DNNs, the predictive distributions usually corresponds to the output of softmax layer, which is typically interpreted as the confidence over the different classes. The i.i.d hypothesis made in learning usually assumes that the data distributions over the classes are the same learning and inference time. However, in real-world applications, the distribution of data at inference time (i.e., the test data) may shift and actually be different from the original training distribution corresponding to distribution shift in representation of data which refer that as domain shift. For instance, in image classification problem, domain shift happens when the test images are different in illumination, view point, resolution, background or intensity noise from the training set. However, they are the same classification problem with the same objects occurance rate. Arguably, building DNNs that are robust to the domain shift problem is necessary for its safe deployment in decision-making systems. Dealing with this, predictive uncertainty is the key to obtain meaningful estimation for practitioners to know when prediction accuracy is degrading and allows system to abstain from making decisions due low confidence.
The predicted uncertainty in DNNs usually are not calibrated with tendency to be overconfident. Many probabilistic and post-processing calibration methods have been proposed under i.i.d assump- tions to adjust the certainty of DNNs. In recent studies (Ovadia et al., 2019, Maddox et al. 2019). uncertainty under domain shift condition gets more attention and the common calibration methods have been assessed regarding to the domain shift, although they are not designed to be robust under such condition. In this paper, for the first time, we specifically focused on calibration for the domain shift in image classification. We show post-processing calibration approaches that use Negative Log Likelihood (NLL) as the calibration loss like Temperature Scaling (TS) (Guo et al. 2017) may be- come robust to the domain shift problem if they calibrate the model using the test samples. However, they need labels of the samples to apply calibration. Labeling the test samples even for the small set is not always easy task and need human experts effort which can be accompanied with the label- ing noise and huge time burden. Neuron cells classification taken by electron microscope (Ostroff & Zeng 2015), pathology images (Khosravi et al. 2018) and skin disease classification (Kolkur al.

---

Under review as a conference paper at ICLR 2020
2018) are three examples of applications that have expensive labeling procedure with high risk of labeling noise that need senior experts to label them.
In this work, we propose a new approach called Unsupervised Temperature Scaling (UTS) with similar framework of TS and using unlabeled test samples for calibrating the pre-trained model. This novel idea brings the chance of robust calibration to the domain shift. Possibility of using the test samples to calibrate, makes UTS a proper solution not only for domain shift but also for many practical calibration problems like calibrating off off-the-shelf-model. More specifically, UTS is proposed with following contributions and foreseen impacts:
Unsupervised post-processing calibration: UTS brings new look to NLL loss function which is used as the calibration loss in several post-pnn post-processing methods. UTS approxi- mates a weight function to estimate the per class distribution of data to compute NL... This new way of computing NLL makes it independent of the labels. In addition, computing weighted NLL has the same order of time and memory complexity as the classic NLL, without any additional hyper-parameter to fine-tune.
Robustness to the domain shift: UTS a robust calibration solution to shifted domains. It adjusts the the model uncertainty based on the test and not the training domain. Therefore by change of distribution in the test domain, UTS can follow the distribution shift easily.
Calibration of off-the-shelf models: The pre-trri models for classification tasks are usually only trained to achieve higher accuracy rate without paying attention to the predic- tive uncertainty. In fact, many of them are released without the training data that removes the possibility of retraining them to calibrate, like available Pytorch pre-trained models. UTS brings a chance to use these models for decision-making applications by calibrating them on a test data without need of labeling them.
2 RELATED WORK
Calibration of predictive uncertainty for DNNs are widely investigated in recent literature. Calibra- tion methods can be categorized in two groups: probabilistic or post-processing approaches.
Probabilistic approaches refer methods that use Bayesian theory (Bernardo & Smith 2009) for estimating the conditional distribution of data. As the exact Bayesian inference is not practical, a variety of approximation are proposed such as Laplace approximation (MacKay 1992 Ritter et al.] 2018b a Kirkpatrick et al. 2017),, Variational Bayesian methods (Molchanov et al. 2017 Louizos
& Welling [017 Blundell et al., 2015. Louizos & Welling 2016; Wen et al. 2018) and Monte
Carlo Markov Chains (MCMC)
et 20.5 Chen et 20144 to make Bayesian deep networks tractable. MC-dropout (Gal Ghahramani (016)) replaces complicated sampling with simple dropout in training and test phases, which has been shown to approximate Variational Bayesian inference. Ensemble of DNNs (Lakshminaraynnan et al. (2017) is another straightforward probabilistic approach that can achieve better calibrated results than MC-dropout. This approach is appropriate for parallel computing, with multiple DNNs running at the same time. However, keeping the models in the memory during the test time brings high memory complexity.
Post-processing approaches are much less complex, albeit less accurate compared to probabilistic calibration. In post-procdt post-processing approaches, the main idea is to decrease the miscalibration of the network by minimizing a calibration loss (Gneiting & Raftery] (007) such as NLL. In order to train the neural network, NLL is used to simultaneously increase accuracy and decrease miscalibration. However, it easily gets overfitted to confidence and makes the network overconfident (Guo et al.) 2017. Post-processing
approaches like TS. Platt-Scaling (Platt et al.] 1999). Histogram Binning Zadrozny & Elkan| 2001). Isotonic Regression (Zadrozny & Elkan, 2002). and Bayesian Binning into Quantiles (Naeini et al. 2015) fine-tunes the softmax layer by keeping the DNNs' weights unchanged. They do not need to retrain the deep network from scratch and they only need to find the best parameter of softmax softening function by minimizing a calibration loss (like NLL) on a small validation set. Temperature Scaling is the state-of-the-art among the post-processing approaches which uses NLL as the loss function. It only uses one parameter to rescale the logit layer and soften the softmax output. Therefore with keeping the accuracy unchanged it calibrate the model with the minimum time and memory complexity. These features leads us to focus on TS and try to propose robust post-procsssing solution for domain shift based on TS framework.
2

---

Under review as a conference paper at ICLR 2020
Robustness to the domain shift: Previously, the results of calibrated model were also reported for different domains such as Out-Of-Distriution (OOD) and Adversaries (Lakshminarayanan et al, 2017 Ritter et al., 2018b) to show the model is uncertain about what it does not learn before. Recently, people get into importance of domain shift problem in calibration and assess how the calibrated methods would behave under domain shift condition (Ovadia et al. 2019 Maddox al.) 2019). Domain shift concept is different from adversaries and OOD. In the case of OOD, training and test domains are completely different in task distributions and in the case of adversaries the distribution shifts between the training and test is made with the goal of fooling the classifier. In domain shift, the training and test domains are distributionally different but related. The relation between two domains can be used as the prior knowledge to help improving the accuracy having better calibration. the literature of calibration, to the best of our knowledge, there no work that specifically designed to calibrate the model considering domain shift assumptions. In this paper we will focus on Covariate shift as the most famous domain shift setting in image classification and propose UTS as robust calibration method accordingly.
PRELIMINARIES
In this section, we define the domain shift and calibration setup to clarify UTS objectives. Then, we explain why NLL can be used as a calibration loss and when optimizing NLL will lead to a calibrated model toward the domain shift settings. Finally, we bring deep analysis of the post- processing method TS which uses NLL as a calibration loss. We show TS can be robust calibration solution to the domain shift if uses labeled samples from the test domain apply calibration. We discuss TS sensitivity to the labels of samples as the preliminaries to propose UTS method in the next section.
3.1 PROBLEM SETUP
Considering the domain shift assumptions, the goal of calibration in this work is to improve un- certainty estimation of a pre-trained model for different shifted domains. In this setting, (x(x y) considered as the ground-truth distribution of the source domain and g: y) is considered as the ground-truth distribution of the target domain where x ~ X E IRd and y E {1,2.... K}. In the setting of domain shift, the source and target domains have different but related dis- tributions. The relation between the domains is defined by Covariate Shift assumption (Adel & Wong 2015 which is: the data distributions qs (x. y) + 9: y) where the conditional distribution g-(y|x X = (y) x). and the task and marginal distributions y- (y( = (v) and (x(x) + (x))., re- spectively. Let d(x) = {S,(x) (x), :)} denotes the pre-trained model in which ÿ is the class prediction and Sy (x) is its associated confidence. In domain shift setting, for deep neural networks, model d(-) is a DNN trained on the source domain and would be tested on the target domain. In this setting, (x) is the output of the softmax layer which is calibrated when Sx) (v/xx)
Miscalibration of DNNs can be explained in different ways. Temperature Scaling models the miscal- ibration the rescaled logit layers by scaling factor T TS objective is to find T* value rescale the logit layer back and makes the model calibrated. More specifically, the calibrated output of TS
is defined as (x; ] exp( [g(x)) 7 )/ Σラ=1 exp( 7
((x) where f(x) [f] (x), (x()..... (x)]
is the logit layer of model d(x). In this paper, considering the same definition of miscalibration as TS, we propose UTS under domain shift condition. UTS objective is to find the scaling factor T
that (x; T*) qe (3(3 x)), given that we have access the source pre-trained model d(.), unlabeled
calibration set C {x;) L (x) and the known task distribution (v))).
3.2 ROBUSTNESS TO DOMAIN SHIFT WITH NLL LOSS FUNCTION
To calibrate a model, first we need to evaluate the quality of predicted uncertainty of the model. Evaluating the quality of predictive uncertainty challenging, as the ground-truth of the uncertainty estimate is usually not available. Accordingly, scoring rules are defined to measure the quality of predictive uncertainty (Gneiting& & Raftery (2007). Scoring rules are numerical scores that rank the distribution prediction po xx) by giving lower score better prediction of true distribution q(ylx)) Let a scoring rule be a function R(po. (x, y)) that evaluates the quality of the predictive distribution po(1|x) based on the samples (x, y) q(x, y) where q(x, y) is the true distribution of the data.
3

---

Under review as a conference paper at ICLR 2020
The expected scoring rule is defined by R(po.q) = qx. R(po. (x, y))dxxx A proper scoring rule function is one where R(po: q) I R(q.9) q) with equality if and only if po(y)x) = q(3lx) ) for all samples.
Negative Log Likelihood (NLL) is proper scoring rule based on Gibbs incquality i.c., Ripo. q) = ( x) log po I E (tyl x) log ((y/x). Therefore minimizing NLL w.r.t on the sam- ples generated from g(x, y) distribution, leads to po(y)x) + g(ylx). Under the domain shift as- sumption, as the training and test domains have different distributions, the final goal of calibration is (0(x)x) q: (y)x.. In the case of using NLL the loss function, if we minimize NLL on the samples that are generated from the test domain, we will have po (3/ (y(x) - 4 ()) and makes the method robust the domain shift. One of the post-processigg methods that uses NLL as the loss
function is TS, Therefore, TS has the ability to get robust to the domain shift.
3.3
TEMPERATURE SCALING ANALYSIS
TS (uuo al. 2017 is the state-of-the-ar post-processing approach which rescales the logit layer of deep model by parameter 7 that is called temperature. 'S is used to soften the output of the softmax layer and makes it more calibrated. The best value of T will be obtained by minimizing NLL loss function (explained in Sec. 3.2. why minimizing NLL leads to more calibrated model) respecting to T conditioned by T > on the calibration set as defined in Eq.
NLL
Tis = arg min
Σ log (S (xx:))))))
8. T 0, (x.MM E (Cxg(xxx))
T
), is the softed version of softmax by applying parameter T on the logit layer (x). TS has the minimum time and memory complexity with order of (1) among calibration approaches as it only optimizes one parameter T on small labeled calibration set. Having only one parameter helps TS not only to be efficient and practical but also not to get overfitted to NLL loss function when it is optimized on small calibration set. TS previously is applied for calibration (Guo et al. (2017)). distilling the knowledge (Hinton et al. (2015) and enhancing the output of DÑNs for better discrimination between the in and out distribution samples (Liang al. (2017)). TS models the uncalibration the rescaling factor in the logit layer. By computing the derivative of NL. respecting to T in Eq. ① and find the minimum, we will have:
where Sy, (x:; 7) exp(
b2 (xc,)) / Σø= exp( (xx)))
L K
Σ (x:) 1=1
Σ Σ (x:
=mmm
shows regarding to the true label of the samples, TS selects the T value which maximizes the Sj (x,, T) for k y/ and minimize Sx T') for all the other # ys. Therefore for correctly classified samples that yi = arg max, (x.). T' approaches 0 to increase the confidence of that class toward and for the misclassified samples, T goes toward oo to decrease the confidence of predicted label. The balance between the correctly classified and misclassified samples brings back the optimal value of T.
TS uses NLL as the loss function then by selecting the calibration set from the test domain instead of the training one, we can make TS robust to the domain shift problem. We refer to this approach as Targer. TS is highly dependent on the labels of the samples. however, Labeling the test samples a challenging task. When the calibration set contains data with labeling noise or unlabeled samples, TS loses the balance to find the optimal I and cannot calibrate the network successfully. Later, in Sec. (5.3), we will show even a small portion of the noise has big distortion in TS results. This brings the idea of Unsupervised Temperature Scaling which makes TS independent of labeled data and robust to the domain shift.
4 UNSUPERVISED TEMPERATURE SCALING
Considering the assumptions in Sec. (.IIp, its main objective to find Tips for the unlabeled calibration set. UTS the same TS uses NLL as the proper scoring rule to minimize the calibration
4

---

Under review as a conference paper at ICLR 2020
9
9 ==1
B
9
W
35
9 =
W
Class
y Class y -
Figure 1: A color view of the weight function in three class classification problem. For the samples which are classified as class
k and for the samples that á + k but located near to the decision boundary, the Wx(x, w²) = 1 which is shown with darker hue. For the samples that ý 전 k and are far from the decision boundary Wa (x, w + O, which is with lighter hue. The decision boundary illustrated by the black line.
gap and finds the optimal T' value. The first step of using NLL in UTS is to make NLL independent of labeled data. Considering NLL loss function, we can rewrite it with focus on per class distribution, formalized as:
NLL Σ
Σ
log (S,, (xx:))
k=1 (x..)))((x.x=33
In Eq. (3). NLL is the summation of K different sample sets, generated from class distribution q(. = k) where k E 21. K}. When the labels the samples are available, they can be used as the guide to select the samples set for each class distribution. But in the absence of the labels, the main question is how to select the samples generated from (x y = k) and calculate NLL. To come along with this challenge, instead of selecting the samples by labels, UTS applies weights on the samples. The weight function (x w") represents the probability that sample is drawn from gxx, = k). Later. in Sec. (4.1) we will give specific details of the weight function Wa (x; w") ) and how to approximate it. By applying weights on the samples, the UTS loss function defined as the Weighted NLL (WNLL) which is:
WNLL
L
Tits arg min
ΣΣ 1=1==1
Wh w²) (S (S&(x;;)))
s.:T>
(xi E C g(x)
4.1
WEIGHT FUNCTION Wa(:--)
We start the discussion about the weight function by introducing a fact from the Bayes rule (Jin et al.
2017
41y k/x) 4(v + k|x) g(xxx(xX *
[(x,y=k)
(5)
When a sample has a true label of = A it is drawn from distribution q(x y = k). However, Eq. shows that even samples with true label of y * can be used as the samples drawn from the dis- tribution qxx = k) by applying weight of g(y = k<lx)/q(v / k(x). Therefore, we can simply use the weight of for the samples with true label of y = I and the weight of q(v = k)x)/q(v + k x) for the samples * k to change all the samples in the calibration set to the samples drawn from q(x, y = k). Therefore, we define the weight function as (6)
1,
if X, ~ q(x. y k)
(x(x,)=
q(r=k lx.)
otherwise.
(6)
1-
5

---

Under review as a conference paper at ICLR 2020
Algorithm 1: Unsupervised Temperature Scaling
Require: q. (y)) task distribution
Require: d(-): the pre-trained model
Require: C ~ qt (x): unlabeled calibration set derived from test domain
1: Find the optimal w² = arg min (E Zi=1 (x(x;; - g(v k:))²
2: Find the optimal Türs arg minr - E Wa(x;; w²) "/0l (Sx (x:; 7))
3: Calibrate softmax output of model d(.) by: (x TiTs) = exp( fu(x))
(((x) Tūrs ) Σラ expl TuTs
To compute (-(-) (-) for the samples, we need the ground-trute distribution (x. = k) that in UTS setting is not available. However we can approximate empirically referring to UTS assumptions (Sec. 3.I)).
Proposition 1: Let Letd(.) be a model which gets miscalibrated with rescaled logit layer by factor w". Then, with known (z)), the empirical approximation of Wx(+) (.) is equal Wx(::-) which is defined as:
1, / w- log( log(Sy=t(X;; ) 1)),
if 9: = k otherwise.
(x;;;; w²) = {
where w is:
an) )
w arg min 20
Σ
ge(v = wc(xx;))oo(u-k) k))
{xi] E - (())
(8)
Proposition 1 valid for the domain shift setting with Covariate shift assumption and also for the case that there is no distribution shift between the training and test datasets. The validity of Proposition 1 for both settings are provided in Appendix A Fig- illustrates a schematic view of the weight function W&(+:)) in the feature space. The color hue correlated with the weight values. For the samples that are classified as ý = k and for the samples with ý * k located near to the decision boundary, the weight equal 1. The weight would decrease as the samples fall further from the decision boundary which shows they are less probable to be drawn from distribution q(x, = k).
Time Complexity of UTS: Computing W=++)) is parameter optimization which has the time complexity of O(1). After approximating the weight function (=.:)), UTS minimizes WNLL (4) with the same time complexity to find the optimal Türs which leads to have UTS with the total time complexity of (1). Algorithm I summarizes UTS.
Validity of UTS in Practice: UTS is valid when there is no domain shift or when the there is Co- variate Shift between domains. When the and training datasets are different in representation but keeps the same proportions of each class occurrence, it is categorized as Covariate shift assump- tion. In many applications like medical image classifications, the probability of happening class of object is staying the same during the training and test phases which means (3()) = (v)) but the illumination, capturing noise, resolution, and image size and viewpoint can vary between two domains which means ys (x) * (x).. Therefore, in classification problems with Covariate Shift assumption or without any shift, UTS only needs to calculate empirically the number of occurrence of each class to the total number of samples in the training set and use it as (e(y) to calibrate the model.
EXPERIMENTS
We conduct the experiments to analyze the behavior UTS in comparison to the other methods for two different calibration scenarios. First, we compare UTS with several post processing methods that use NLL as the loss function in the experiment with the same training and test domain distributions. This experiment is designed to be proof of concept to show that weighted NLL of UTS can indeed calibrate the model without accessing the labels. Second, in order to show the success of UTS in calibrating the model under domain shift condition, we compare UTS, TS and

---

Under review as a conference paper at ICLR 2020
Table 1: The results of NLLŞ for UTS and other post-processing approaches with the training and test domains. all cases UTS can calibrate model without labeled samples, however does not achieve the best results. This experiment shows UTS can calibrate off-the-shelf-modee with only test samples. The mean are reported in 20 independent runs.
Dataset
Model
Uncalibrated
TS
UTS
Vector Scaling
Matrix Scaling
Birds
ResNet50
0.9383
0.9287
0,9313
0.9355
7.1423
MNIST
Lenet-5
0.1044
0.0243
0.0429
0.0988
0.1187
SVIIN
ResNeil 10
0.2107
0.1534
0,1566
0.1936
0,2070
SVHN
DenseNet100
0.1803
0.1608
0,1735
0.1687
0,1754
CIFARIO
NenseNet40
0,2895
0.2221
0,2848
0.2912
0,2883
CIFARIO
DenseNet100
0.1973
0.1559
0,1635
0,2006
0,1965
CIFARIO
ResNetl 10
0.3134
0.2069
0.2341
0.2907
0,3103
CIFARIO
VGG16
0.2608
0,2036
0,2099
0,2503
0,2573
CIFAR100
DenseNet40
1,0964
1,0064
1.0217
1.2876
1.4914
CIFAR 100
DenseNet100
1.1285
0.8751
0.8889
1,2470
1.2761
CIFAR100
ResNetl
1.2442
1,066
1.0636
1.3869
1,5358
CIFAR100
WidcResNer10-4
0.8751
0.8192
0.8439
0.8757
0.8609
3 more probabilistic approaches for the training and test domains with different distributions. We also study the results of Target that a TS which selects the calibration set from the target (test) domain. Ta-Target has the most accurate uncertainty prediction among all other baselines for the shifted domain distributions. However, we will show in the third section of Experiments part, suffers from the labeling noise which justifies our try make TS unsupervised.
5.1 CALIBRATION WITH THE SAME TRAINING AND TEST DOMAINS
Here we consider the training and the test domains have the same distribution. Our goal is to show UTS can calibrate the models without labels the case of no domain shift.
We compare UTS with several post-processing baselines which are Temperature Scaling (TS) (Guo et al. (2017) and Matrix and Vector Scaling (Platt al. (1999)) wide range of different state-of -f-te-of-thh-art deep convolutional networks with variations in depth which are ResNet (He al. (2016)). WideResNet (Zagoruyko & Komodakis (2016)), DenseNet (landola al. (2014). LeNet (LeCun et al. (1998))). and VGG (Simonyan & Zisserman (2014)). We test the methods on different datasets such as CIFAR- and CIFAR-100 (Krizhevsky Hinton (2009)). SVHN (Netzer al.) (2011)) MNIST (LeCun et al. (1998b)), and Calthec-UCSD Birds (Wah et al. (2011). ). We use all the data pre- pre-processing, training procedures and hyper-parametert tuning for each dataset as described in each mentioned reference. To setup the calibration set, we randomly select 20% of the test dataset. Then, we consider the rest to be evaluated as a test set. We repeat each experiment 20 times independently and report the mean of NLL calibration metric. More explanation of experiment setup and the baselines, datasets and calibration metrics are provided in Appendix B
Experiment Setup
Results In Table the calibration results based on NLL are compared between TS and UTS, which have only one parameter for fine-tuning the softmax output layer, and Matrix and Vector scaling, which apply a linear function on logit layers. In all cases, TS calibrates the network better than all the other methods. Although the results of UTS are not better than TS, UTS shows improvement in calibration for all dataset-models. It means the weighted NLL the approximation of NLL with unlabeled samples can work properly to calibrate the model even though it is not as accurate as the NLL with access to labels. Although Matrix and Vector Scaling can define more complex functions to soften the softmax layer, they suffer from over-fitting w.r.t the validation set in confidence. We also provide the complete results with mean and standard deviation for accuracy as well as other standard calibration metrics (NLL, ECE and Brier Score) in Appendix C.I The explanation about the ECE and Brier are given in Appendix B.3.
5.2 CALIBRATION UNDER DOMAIN SHIFT SETTING
In this section, we divide the experiments into two parts. First, compare UTS to the uncalibrated model (UNC), TS and TS- Target on different domain shift scenarios. The goal of this experiment is to compare the gap of calibration between UTS and TSrTarget that can be considered the ground-

---

Under review as a conference paper at ICLR 2020
CIFARIO - Caussian Noise
MNIST Rolling
MNIST Rotation
100
Aucuuscy
045-
10
1ea 2
1nd. 85
90 15 101 un 12t 180 rio
UNC
1S
TS- 1S-Targo
UTS
Figure 2: Results show accuracy and Brier Score| in different degrec of shifting for MNIST and CIFARIO datasets. Comparing TS and TS-Target results shows TS-Target is more robust domain shift than TS. UTS with small gap is following TS- T'rTarget that the labeled version of UTS and can be considered as the ground- truth for it. The pre-trained models are trained on MNIST and CIFAR 10 datasets and tested on different degree of shifted MNIST and CIFARIO datasets to model domain shift.
CIFAR1O
CIFARIO Pixelate-5
CIBARIO Shot-Noise-
CIFARIO
MNIST Roll-8
MNNST Roll-12
MNIST Rotiiios-OS IIS
MNIST Rotazion-122 120
Contrast-5
Specklo-Notae-3
Beter
0.00
0.07
0.14
0.1A
0,14
6.10
0.00
0.
0.12
0.32
0.00
0.07
6.00
0LEN
0,0G
0.10
0.10
10
UNC
B-dhopoct
TS-Thagt
Figure 3: Comparison between different post- processocssing and probabilistic approaches under domain shift. The results reported for Brier Scorel, vs Accuracy. TS-Target has the most calibrated output comparing to the other probabilistic approaches. UTS after TS-Terget achieves
best results which shows comparing to the other probabilistic approaches, is robust to the domain shift. The models are trained on MNIST and CIFARIO later during the test different degrees of shifts applied on them to make the domain shift
truth for UTS when the labels are available. Later, we also evaluate the robustness of UTS, which was specifically designed to domain shift, and several probabilistic approaches, which only consider the case of calibration for the same distribution setting. The goal of the experiment to show that UTS can be indeed robust for different shifting domain scenarios.
Experiment Setup We follow the same experimental setup as Sec (5.1) but with different domain shift assumptions. We use the benchmark proposed specifically for domain shift problem in (Ovadia jt al. (019)). They model the distribution shift by applying different operations like rotation, trans- lation (rolling), and with different severity levels of intensity corruptions proposed in (Hendrycks) & Dietterich (2019)). In the first part of this section, we compare the result the UTS to uncal- ibrated, TS and TS-Target on MNIST and CIFAR10 datasets applying rotation, pixel translation and Gaussian noise to the test domain. In the second part, we add more probabilistic baselines such LL-Dropout(Gal
Ghahramani (2016)), SVI (Blundell al. (2015)) and Ensemble (Lak- shminarayanan et al. (2017)) with more variation of the domain shifts in the sense of corruption of intensities. Specific details of baselines and experiment can be found in Appendix B.
Results As we can see in Fig. 2 the accuracy of the model degrades by the effect of domain shift. TS family approaches does not change the accuracy during the calibration therefore, all the methods have the same accuracy as the uncalibrated one. -S-Target has the same setting as TS with the difference that it uses the labeled calibration set from the target domain. Then, in ideal situation, UTS uncertainty prediction would reach the TS- performance. We can see that UTS is working better than uncalibrated model (UNC) and TS which uses the source data for calibration under the domain shift condition. The gap between UTS and TS-Target is interestingly small in the sense of Brier Score. More results for other domain shifts are provided in Appendix C We also provide the analysis of UTS sensitivity number of calibration samples in compared to TS and TS-Target in Appendix C.44which shows UTS obtains stable results in decreasing the number of samples from 20% to 2.5% of test detest size.
8

---

Under review as a conference paper at ICLR 2020
CIFARIO
ResNet100
CIFARIO0 NenseNet100
MNIST Lenet5
SVHN ResNet110
1X
ETN
ITS
0.
42
14
14
02
Noise
Noise
Noise
Noise
Figure 4: Sensitivity of TS approach to the labeling noise. Even with small percentage of noise in the labels of samples TS cannot calibrate the model. UTS is completely robust to the labeling noise as it is an unsupervised approach. Shaded regions represent std over 20 runs.
compare probabilisttic approaches to UTS, uncalibrated model (UNC). TS and TS- Target. As all the calibration metrics are dependent on the accuracy of the models, controlling the accuracy to have fair comparison between the methods is important. Otherwise, the better calibration can be as the result of having better accuracy and not the calibration itself. Accordingly, we apply the shifts the datasets and check the accuracy of the UTS with other approaches, and select the domain shift settings that UTS accuracy is near to the others. As we can see for different combination of model and datasets. UTS can achieve better results than any other probabilistic approaches and has a small gap with TS- Target which achieves the best results. It shows that using the test samples to fine-tune the calibration toward test distribution can help the model be robust to the domain shift problem. As mentioned before, labeling the test samples is not trivial task, therefore, using directly TS-Target might not be possible in many cases which justifies the importance of an unsupervised approaches like UTS. In the next section, we show that for weakly supervision of the test samples, TS-Target cannot be successful calibration and needs exact labeling the test domain samples that might be impractical in many cases.
In Fig.
5.3 TS SENSITIVITY TO LABELING NOISE
When the labeled samples are available for calibration, TS shows the best results with and without domain shifts. In this section, we will investigate the sensitivity TS with labeling noise. We apply different rates of random altering the labels only for the calibration set and evaluate the calibration success of TS, UTS and uncalibrated methods accordingly. As we can see in Fig. 4 TS is extremely sensitive to the noise of labeling. Therefore, in order have successful calibration for TS in shifted domains, the exact labeling of test samples is essential which might be not feasible for many applications. UTS is robust the labeling noise as it is unsupervised calibration method and it can remove the challenge of labeling the test samples, completely. More results for more datasets- models are provided in Appendix
6 DISCUSSION AND FUTURE WORK
In this paper, we propose UTS as a robust unsupervised post-processing method to the domain shift calibration challenge. UTS is a member of TS family approaches which have low time and memory complexity, and can calibrate with few number of samples while preserving the accuracy intact. UTS utilizes a new calibration loss function, weighted NLL which independent of the labels. The computational complexity of weighted NLL is in the same order of NLL which makes UTS a fast and practical calibration solution. Since UTS uses the test samples to adjust the uncertainty, we show it is robust to domain shift and can make off-the-shed models calibrated when their training samples are not available anymore.
Recent studies (Maddox et al.) 2019, Kumar et al. 2018)) mentioned that using TS with probabilistic approaches can even improve the uncertainty prediction of already calibrated models. Therefore, we believe this work can be extended in the direction of combining UTS with such approaches in order to achieve more robust domain shift solutions. We also consider another direction of this work towards exploring UTS for more variant domain shift assumptions. In this paper, study UTS only for Covariate Shift assumption, however, can be extended to other shifting scenarios such as OOD and adversaries, in future.

---

Under review as a conference paper at ICLR 2020
REFERENCES
Tameem Adel and Alexander Wong. A probabilistic covariate shift assumption for domain adapta- tion. In Twenty-Ninh AAAI Conference on Artificial Intelligence, 2015.
Anoop Korattikara Balan, Vivek Rathod. Kevin P Murphy, and Max Welling. Bayesian dark knowl- edge. In Advances in Neural Information Processing Systems, pp. 3438-3446 2015.
José M Bernardo and Adrian FM Smith. Bayesian theory, volume 405. John Wiley & Sons, 2009,
Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint /rX5vv/505.055:0 2015.
Mariusz: Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv: 1644.0360 2016.
Glenn Brier. Verification of forecasts expressed terms of probability. Monthey Weather Review, 78(1):1-3, 1950.
Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient hamiltonian monte carlo. In International Conference on Machine Learning, pp. 1683-1691, 2014.
Andre Esteva, Brett Kuprel, Roberto A Novoa, Justin Ko, Susan M Swetter, Helen M Blau, and Sehastian Thrun. Dermatologist-level classification of skin cancer with deep neural networks. Nature, 542(7639):115, 2017.
Yarin Gal and Zoubin Ghahramani. Dropout as bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050-1059, 2016.
Tilmann Gneiting and Adrian E Raftery. Strictly proper scoring rules, prediction, and estimation.
Journal of the American Statistical Association, 102(477):359-378 2007.
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. arXiv preprint arXiv: 170..04999 2017.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recog- nition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016.
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common cor- ruptions and perturbations. arXiv preprint arXiv: /903.. /2261, 2019.
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in neural network. arXiv preprint 1:Xiv::503.0053/ 2015.
Forrest landola, Matt Moskewicz, Sergey Karayev, Ross Girshick, Trevor Darrell, and Kurt Keutzer. Densenet: Implementing efficient convnet descriptor pyramids. arXiv preprint arXiv:1404.188 1869, 2014.
Long Jin, Justin Lazarow, and Zhuowen Tu. Introspective classification with convolutional nets. In Advances in Neural Information Processing Systems, pp. 823 023-833, 2017.
Pegah Khosravi, Ehsan Kazemi, Marcin Imielinski, Olivier Elemento, and Iman Hajirasouliha. Deep convolutional neural networks enable discrimination of heterogeneous digital pathology images. EBioMedicine, 27:317-328, 2018.
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska et al. Overcom- ing catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521-355 2017.
Ms Seema Kolkur, D Kalbande, and Vidya Kharkar. Machine learning approaches to multi-class human skin disease detection. Int. J. Comput. Intell. Res, 14:29-39, 2018.
10

---

Under review as a conference paper at ICLR 2020
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Tech- nical report, Citeseer, 2009.
Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 and cifar-100 datasets. https::/www: cs. toronto. edu/kriz/cffar. html, 6, 2009.
URI:
Aviral Kumar, Sunita Sarawagi, and Ujjwal Jain. Trainable calibration measures for neural networks from kernel mean embeddings. In International Conference Machine Learning, pp. 2810- 2819, 2018.
Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in Neural Information Processing Systems, pp. 02236413,22 2017.
Yann LeCun, Léon Bottou, Yoshua Bengio, Patrick Haffner, et al. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(1 (0(11))2278222 2324,, 1998a.
Yann LeCun, Corinna Cortes, and Christopher Burges. Mnist dataset, 1998b.
Shiyu Liang, Yixuan Li, and R Srikant. Enhancing the reliability of out-of-distribution image detec- tion in neural networks. arXiv preprint arXiv: 776602660, 2017.
Christos Louizos and Max Welling, Structured and efficient variational deep learning with matrix gaussian posteriors. In International Conference Machine Learning, pp. 1708-1716, 2016.
Christos Louizos and Max Welling. Multiplicative normalizing flows for variational bayesian neural networks. In Proceedings of the 34th International Conference Machine Cturning-Volume 70, pp. 2218-2227. JMLR. org, 2017.
David JC MacKay. Bayesian methods for adaptive models. PhD thesis, California Institute of Technology, 1992.
Wesley Maddox, Timur Garipov, Pavel Izmailov, Dmitry Vetrov, and Andrew Gordon Wilson. A simple baseline for bayesian uncertainty in deep learning. arXiv preprint arXiv:1902.02476, 2019.
Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Variational dropout sparsifies deep neural networks. In Proceedings of the 34th International Conference on Machine Coarning-Volumee 70, pp. 2498-2507, JMLR. org, 2017.
Mahdi Pakdaman Naeini, Gregory Cooper, and Milos Hauskrecht. Obtaining well calibrated prob- abilities using bayesian binning. In Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015.
Radford M Neal. Bayesian learning for neural networks, volume 118. Springer Science & Business Media, 2012.
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Ng. Reading digits in natural images with unsupervised feature learning. NIPS, 01 2011.
Linnaea Ostroff and Hongkui Zeng. Electron microscopy scale. Cell, 122(3):4744755 2015.
Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, Sculley, Sehastian Nowozin, Joshua V Dil- lon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model's 's uncertainty? eval- uating predictive uncertainty under dataset shift. arXiv preprint arXiv: /906: 005.02330, 2019.
John Platt et al. Probabilistic outputs for support vector machines and comparisons to regularized likelihood methods. Advances in large margin classifiers, 10(3):61-74, 1999.
Hippolyt Ritter, Aleksandar Botev, and David Barber. Online structured laplace approximations for overcoming catastrophic forgetting. In Advances in Neural Information Processing Systems, pp- 3742-3752, 2018a.
Hippolyt Ritter, Aleksandar Botev, and David Barber. A scalable laplace approximation for neural networks. 2018b.
11

---

Under review as a conference paper at ICLR 2020
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv: 2014.
Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The caltech-ucsd birds-200-2011 dataset. 2011.
Yeming Wen, Paul Vicol, Jimmy Ba, Dustin Tran, and Roger Grosse. Flipout: Efficient pseudo- independent weight perturbations on mini-batches. arXiv preprint arXiv: 1803.0080 2018.
Bianca Zadrozny and Charles Elkan. Obtaining calibrated probability estimates from decision trees and naive bayesian classifiers. In lcml, volume I, pp. 609-616. Citeseer, 2001.
Bianca Zadrozny and Charles Elkan. Transforming classifier scores into accurate multiclass proba- bility estimates. In Proceedings of the eighth ACM SIGKDD international conference Knowl- edge discovery and data mining, pp. 994-699. ACM, 2002.
Sergey Zagoruyko and Nikos Komodakis. arXiv:1605.07146, 2016.
Wide
residual networks.
arXiv preprint
12

---

Under review as a conference paper at ICLR 2020
A PROOF OF PROPOSITION 1
First we investigate the validity of Proposition for the settings with no distribution shift. Proposition 1: let Wi(-) be weight function defined as:
if xx~ y k)
Wx(x;)
[(x= T-9(y m/x;)
otherwise.
and let d(-) be a model which gets miscalibrated with rescaled logit layer by factor w". Then, with known task distribution q(v), the empirical approximation of Wx(.) is equal Wx(::.) which is defined as:
[1, Wx(x;, = [1/exp( =-- 1og((S=((xx))- 1)),
if 91 = otherwise.
where w" is:
2 Wa(x;w) g(v - -k)
w" arg min
ΣΣ
x; x:EC~gl
For simplicity we split the proof into two parts. First, we show that for known value of wn, Wx(::) is the approximation Wx()). In other words, 1/exp( /f- log((S 1)) k + xx)):
Proof:
The softmax output of uncalibrated model d(-) with rescaled logit layer by factor w", can be formulated as:
Sy=x(x)= exp(wff((x:)) Σ/= exp(w"fy
Syzz = (x)x(x) Therefore calibrated output will be defined as:
Sy=k(x; w²) = exp(fe (I;)) = g(v = k/x)
Σx= exp(f, (x,))
Syzk(x, w²)= =1 Sy=x w²) a(v # k/x)
Considering these definitions:
exp
1 log
I exp(w (xx(("(((xx)) (xx))))xx((1) (fa(x)) exp(w" (x:))
exp
SK exp(1, (xxpeeeeex)) exp(fe(x:))
exp
log
ΣK (x:)) (x.))
exp(fe(xx))
exp(fx(xx))
Σド= exp(f, (x,)) exp(ff (x:))
exp(fx Ex/n exp(fe (x.))
explfe(xx))
Σラ= exp(()(xx))
S Sy=x(x; w²))
4(y = x/xx
g(v k[x)
1 3)=x(xx wt)
1 9(3 -/xx)
g(v * k/x)
13

---

Under review as a conference paper at ICLR 2020
We consider i k as the rough estimation of condition x, q(x.y== y k). The accuracy of the uncalibrated model is the same as calibrated one when it gets uncalibrated by rescaled logit layer. Therefore
the prediction output of uncalibrated model to have rough estimation of the samples that x ~ q(x. k)-
Now in the second part, show that w- arg min (Et= Els WA (x;;;;; w) 4( -k))
where E C ~ q(x)
Referring to Wk(+) definition, we can simply show:
[ We(x))(x, g(v k)
Which means (otxw)/ak(e = g(v = k), and as Wa(+)) is equal to W&(.), empirically we can show Expec
( k). In this problem sefting, we assume q(y) is known. Therefore, w can be found easily by minimizing (E (x(x;w) - q = k)
2
Now we show the validity Proposition I under Covariate Shift assumptions.
Corollary 1: Considering the same weight function W&(+) defined in Proposition 1, let d(-) be model which gets miscalibrated with rescaled logit layer by factor w" toward the target domain qe (x, y). Assume covariate shift where 9o(u)x) = q (y x), qs(y) = ge(y) and (x(x) + (x().. Then, with known qu) the empirical approximation of (-) is equal Wa(::-) which is defined as:
11, |1/exp( +tf (xg(Sy=(xx:)- 1)),
if U = otherwise.
Wa(K,,
where wn is:
L
2
"" arg min Wx(x;w) - qoly - =
ΣV
x, C g((x)
w
Proof: The first part of the proof is exactly the same Proposition with considering that w" with new assumptions is the scaling factor that makes the model uncalibrated towards the target domain. Therefore, we will conclude:
S Sy=k (x; (x:w")
w*) Symk (x; w*)
9: = k(x)
(y== = k)
1 qe k(x)
2: + k
For the second part of the proof, we have:
f( Wx(x))a 9)x (o k)
Referring to covariate shift assumption where qo (1)x)) dr (v(x)) and qv(v) (x(v). can deduce:
[ (x(()) v)dx ge k))
Which means (x.)) [Wx(x)] qcly k). and as We(:-) is equal to Wx(.), empiri- cally we can show Exçer Wx(xx;w") = qly k). In this problem setting, we assume (u()) is known that is equal (v))).
Therefore, w" can be found easily by minimizing
EK Ete We(x;w)- g = k)
14

---

Under review as a conference paper at ICLR 2020
B EXPERIMENTAL SETUPS
B.1 BASELINES
Temperature Scaling (Guo et (017) ): is explained in Sec. (3.3)
Matrix and Vector Scaling Platt et al. 1999)); Matrix Scaling applics linear transforma-
tion on the logits to soften them:
Sy v. (x:; 0, b)
max (00,((x)) + b)
k
(9)
V = arg max (0.f(xx, b)(k)
Where is the softmax function which takes logit layer f(x) an input. The parameters xx and bx are optimized with respect to NLL on the validation set. Vector Scaling is the relaxed version of Matrix Scaling in which 0x x is diagonal matrix.
I-Dropout Monte-Carde Dropout(Gal Gal & Ghahraman (2016)), A pre-trained model which is trained with dropout rate = 0.5 only on the activation function before the last layer, and keeping the dropout active during the test with the same rate.
Ensembles Ensembles of 10 networks trained independently on the entire dataset using the random mnitiaiizationLaaasmnnnaaa Lakshmanaaaaaaann et al. (2017)).
SVI Stochastic Variational Bayesian Inference for deep learning (Blundell al. (2015 ;
Wen et al. 2018) with the specific settings of training mentioned in (Ovadia et al. (2019)
B.2 DATASETS
We apply the calibration method on different image classification datasets. For each experiment, the size of validation set is 20% of the test set which is selected randomly. For all the model-datese have trained them on the training set.
1. CIFAR-10 KKrizhevsky al. (2009)): It contains 60000. 32x32 color images of 10 different objects, with 6000 images per class. The size of training and test sets are 50000 and 10000 respectively.
2. CIFAR-100 (Krizhevsky al. (2009)): With the same setting CIFAR-10, except it has 100 classes of different objects containing 600 images in each class.
3. SVHN (Netzer et al. (20TT)): It contains 32x32 color images of numbers between that has 73257 digits for training. 26032 digits for testing.
4. MNIST (LeCun et al. (1998b)) It contains 28 x8x28 x28 gray-scale images of numbers between
0 9. It has 60,000 images for training, and 10,000 images for test.
5. Calthec-UCSS UCSD Birds (Wah et al. (201T)): ): It contains 1 11,788 color images of 200 different birds species. We divided randomly into 7073 training, and 4715 testing samples.
B.3 CALIBRATION METRICS
Expected Calibration Error (ECE)
ECE (Naeini et al.) (2015)) measures the average gap between the accuracy and predicted prob- abilities. Based on this definition calibration, ECE is proposed as empirical expectation error between the accuracy and confidence. It is calculated by partitioning the range of confidence be- tween (0, 1] into equally-spaced confidence bins and then assign the samples to each bin B, where 6 {I, ..... B} by their confidence range. Later it calculates the weighted absolute difference be- tween the accuracy and confidence for each subset B;. More specifically:
Bb N
ECE
acc(B,) - conf(Bb)
(10)
where N the total number of samples. In this paper, we consider 15 to report the ECE enror. ECE is not derivable function. Therefore mostly it is ignored the loss function of the
15

---

Under review as a conference paper at ICLR 2020
post-processing approaches in calibrating the model by gradient decent optimizing methods.
Brier Score
Brier Score (Brerr (950)) is a scoring rule for measuring the accuracy of predicted probabilities. It is computed the square enror of predicted probability and the one-hot encoding of the correct label. That is:
K
((x;,M)) = Σ y=1
1
(S,(x,) - 5(y y:))
(11)
K
C MORE EXPERIMENTAL RESULTS
C.I TABLES OF ACCURACY, NIL,, ECE AND BRIER SCORE
We report additional results of the experiment applied in Sec. 5.1 to evaluate the behavior of UTS in calibration with the same training and test domains. We report the accuracy, NLL., ECE and Brier Score in Table 2 3 and [5] respectively. Notice that TS family approaches keep the accuracy unchanged while Matrix and Vector Scaling can change the accuracy. In two cases Matrix and Vector Scaling improve the accuracy. However, they get overfitted on validation set and lose the accuracy and calibration in general. We report the results for different calibration score to show that UTS will calibrate the model regarding different calibration evaluation metrics. NLL and Brier Score have related definition of calibration as both of them are proper scoring rule. But ECE has different calibration definition. The detail explanation are given in Sec. (B.3) for each score. We can see in Table 4 UTS even can calibrate the model better than TS for two dataset-model combination with ECE definition of calibration.
Table Accuracy different post-processe processing approaches for different model-datasets
Datasct
Model
Uncalibrated, TS, UTS
Voctor Scaling
Matrix Scaling
Birds
ResNet50
76.03 +/- 0.17
75.94 +/- 0.31
38.82 +/- 1.92
MNIST
Lenet-5
99.19 +/- 0.03
99.18 +/- 0.03
99.11 +/- 0.05
SVHN
ResNet110
96.09 +/- 0.08
96.07 +/- 0.08
96.08 0.08
SVIIN
DenseNet100
95.77 +/- 0.03
95.94 +/-
95.86 0.02
CIFARIO
DenseNei40
92.67 +/- 0.12
92.20 +/- 0.10
92.55 0.04
CIFARIO
DenseNet100
95.08 +/- 0.09
94.81 +/- 0.12
95.02 0.1
CIFARIO
ResNer110
93.62 +/- 0.13
93.53 +/- 0.14
93.49 0.13
CIFARIO
VGG16
93.42 +/- 0.12
93.39 +/- 0.14
93.40 +/- 0.11
CIFARIO0
DenseNe140
71.56 +/- 0.18
66.89 +/- 0.56
63.79 +/- 0.81
CIFAR 100
DenseNer100
75.87 +/- 0.15
73.38 +/- 0.25
73.12 +/- 0.15
CIFAR 100
ResNet1 10
70.41 +/- 0.26
67.24 +/- 0.20
65.27 +/- 0.28
CIFARIO0
Net4
79.80 +/- 0.22
79.57 +/- 0.15
79.79 +/- 0.17
Table NL.L... for UTS and other post-processing approaches. The mean and std are reported in 20 independent
runs.
Dataset
Model
Uncalibrated
UTS
Voctor Scaling
Matrix Scaling
Birds
ResNer50
0,9383 0.0086
0.9287 +/- 0.0077
0.9313 +/-0.0078
0.9355 +/- 0.0093
7.1423 0.2424
MNIST
Lenet-S
0,1044 +/- 0.0064
0.0243 +/- 0.0013
0.0429
+/- 0.0009
0.0988 +/- 0.0073
0.1187 +/- 0.0094
SVHN
ResNet110
0,2107
0.1534 +/- 0.0023
0.1566
0.1936 +/ 0.0035
0.2070
0.0036
SVHN
1enseNet100
0,1803 +/- 0.0017
0.1608 +/- 0.0013
0.1735 +/- 0.0048
0.1687 +/- 0.0025
0.1754 +/- 0.0017
CIFARIO
DenseNet40
0.2895 +/- 0.0058
0.2221 +/- 0.0034
0.2848 0.0419
0.2912 +/- 0.0076
0.2883 0.0061
CIFARIO
DenseNet100
0,1973 +/- 0.0060
0.1559 +/- 0.0035
0.1635 +/- 0.0051
0.2006 +/- 0.0098
0.1965 +/- 0.0061
CIFARIO
R10
0.3134 +/- 0.0083
0.2069 +/- 0.0047
0.2341 +/- 0.0109
0.2907 +/- 0.0090
0.3103 +/- 0.0081
CIFARID ID
VGG16
0,2608 +/ 0.0060
0.2036 +/- 0.0039
0,2099
0.0065
0.2503 +/- 0.0093
0.2573 0.0064
CIFAR100
DenseNet40
1.0964 +/- 0.0067
1.0044 +/- 0.0053
1.0217 +/- 0.0053
1.2876 +/- 0.0255
1.4914 +/- 0.0520
CIFAR100
DenseNet100
1.1285 0.0072
0,8751
+/- 0,0042
0.3889
0.0054
1,2470 0.0008
1.2761 0.0129
CIFAR100
ResNet110
1.2442 +/- 0.0132
1.0466
+/- 0.0090
1.0636
+/- 0.0140
1.3869
+/- 0.0186
1.5358 +/- 0,0204
CIFAR
Ne
0.8751 +/ 0.0111
+/- 0.009
0.8439 0.0089
0.8757 +/ 0.0095
0.8609
16

---

Under review as a conference paper at ICLR 2020
Table 4: ECE, for UTS and other post-processing approaches. The mean and std are reported in 20 independent
runs.
Datasel
Model
Uncalibrated
TS
UTS
VS
MS
Bards
ResNet50
0.0601 +/- +/00.0015
0.0397 +/- 0.0025
0.0350 +/- 0,0024
0.0576 +/- 0.0019
0.2940
0.0089
MNIST
Lonet-5
0.0074 +/- 0,0004
0.0027 +/- 0.000009
0.0199 +/- 0.0014
0.0074 +/- 0.0004
0.0077 +/- 0.0005
SVHN
ResNet110
0.0266 +/- 0.0004
0.0044 +/- 0,0009
0.0127 +-
0.0247 +/- 0.0003
0.0264 0.0005
SVHN
DenseNer100
0.0160 +/- 0.0004
0.0089 +/- 0.0009
0.0106 +/- 0.0013
0.0139 +/- 0.0003
0.0156 +/- 0.0005
CIFARIO
DenseNec40
0.0409 +/-
0.0070 +/- 0.0009
0.0351 +/ 0.0039
0,0410 +/- 0.0021
0,0419 0.0008
CI
DenseNer100
0.0262 +/- 0.0010
0.0073 +/- 0.0017
0.0157 +/- 0.0040
0,0281 +/- 0.0033
0.0262 +/- 0.0017
CIFARIO
ResNet110
0.0431 +/-
0.0088 +/- 0.0009
0,0226 +/- 0,0021
0,0435 +/- 0.0023
0,0439
0.0012
CIFARIO
VGG16
0.0419 +/- 0,0010
0.0169 +/- 0.0009
0.0297 +/ 0.0043
0,0402 +/- 0.0011
0.0419 +/- 0.0011
CIFAR100
DenseNer40
0.0861
0.0109 +/- 0,0018
0.0390 +/ 0,0062
0.1312 +/- 0.0054
0.0102
CIFAR100
DenseNet100
0.1223 +/- 0.0016
0.0152 +/- 0.0011
0.0372 +/ 0.0063
0,1416 +/- 0.0020
0.1452 +/- 0.0039
CIFAR100
Re
0.1265 0.0006
0.0102 +/- 0,0027
0,0447 +/- 0,0048
0.1567 +/- 0.0045
0.1740 0.0074
CIFAR100
WedeRe
0.0894 +/- 0,0012
0.0402 +/- 0.0027
0.0689 +/ 0.0033
0,0839 +/- 0.0037
0.0850 +/- 0.0023
Table 5: Brier Scoret for UTS and other post-processing approaches. The mean and std are reported in 20 independent runs.
Dataset
Model
Uncalibrated 0,0017 +/ 0.0000
TS
UTS
VS
MS
Birds
ResNet50
0.0017 +/- 0.0000
0.0017 +/- 0.0000
0.0017 +/- 0.0000
0.0043 +/- 0.0001
MNIST
Lenet-5
0.0015 +/- 0.0001
0.0012 +/- 0.0001
0.0014 +/ 0.0000
0,0015 +/ 0.0001
0.0016 +/- 0.0001
SVHN
ResNer1
0.0066 +/ 0.0001
0,0061 +/- 0.0001
0.0062 +/- 0.0001
0.0065 +/- 0.0001
0.0066 +/- 0.0001
SVHN
DenseNet100
0.0066 +/- 0.0001
0,0065 +/- 0.0001
0.0065 +/- 0.0001
0.0063 +/- 0.0001
0.0064 +/- 0.0001
CIFARIO
DenseNer40
0.0118 +/ 0.0001
0.0109 +/- 0.0001
0.0115 +/- 0.0002
0.0121 +/- 0.0002
0.0118 +/- 0.0001
CIFARIO
DemseNet100
0.0080 +/- 0.0002
0.0075 +/- 0.0002
0.0076 +/- 0,0002
0,0084 +/- 0.0005
0.0080 +/- 0.0003
CIFARIO
ResNet1
0.0108 +/- 0.0002
0.0098 +/- 0,0001
0.0100 +/- 0.0001
0.0110 +/- 0.0003
0.0108 +/- 0.0002
CIFARIO
VGG16
0.0108 +/- 0.0002
0.0098 +/- 0.0003
0.0102 +/ 0,0003
0,0106 +/ 0.0002
0.0107 +/- 0.0002
CIFAR100
DenseNer40
0.0040 +/. 0.0000
0.0039 +/- 0.0000
0.00339 +/- 0.0000
0.0048 +/- 0.0001
0.0052 +/- 0.0002
CIFARI00
DemsNNet100
0.0037 +/- 0.0000
0.0033 +/- 0.0000
0.0034 +/ 0,0000
0,0040 +/- 0.0000
0.0040 +/- 0.0001
CIFAR100
ResNetl 1D
0.0043 +/ 0.0000
0,0040 +/- 0.0000
0.0040 +/- 0.0000
0.0048 +/ 0.0001
0.0051 +/- 0.0001
CIFAR100
WideResNee40-4
0.0030 +/- 0,0000
0.0029 +/- 0.0000
0.0030 +/ 0,0000
0,0031 +/- 0.0000
0.0030 +/- 0,0000
C.2 COMPARING DIFFERENT TS FAMILY APPROACHES TO UTS FOR DOMAIN SHIFT SCENARIOS
In this section, we provide more results to compare the behavior of UTS with TS and TS-Target in different domain shift applied to CIFARIO dataset. Details of shifting operation can be found in (Hendrycks& & Dietterich 2019). We can see in Fig. [ that TS-Target has the most calibration robustness to the domain shift and followed by UTS with small gap.
C.3 MORE EXPERIMENTAL RESULTS FOR SENSITIVITY OF TS TO THE LABELING NOISE
In this section, we provide more experiments for more models and datasets. As we can see in Fig. TS shows a huge sensitivity to the noise of labeling in calibration set. UTS is completely robust to this noise as it is an unsupervised method. It shows if TS wants to calibrate the model without available labeled data, the labeling phase should be handled precisely. Otherwise TS results are not reliable.
C.4 ANALYSIS OF UTS SENSITIVITY TO NUMBER OF SAMPLES
In this experiment, we show the impact of number of available calibration samples on TS, UTS and TS-Target. As we can see in Fig 7 TS and UTS vary significantly when the number of samples are really few (between 30- ~ 50) while TS- T-rgett is not affected severely (the variance of TS-Target comparing to other methods is small then it is not properly shown in the image). However, by increasing the number of samples 500, UTS reaches to the optimal Törs and after that increasing the number of samples does not consequences better results.
17

---

Under review as a conference paper at ICLR 2020
CIFARIO Brightness
CIFARIO Contrast
CIFARIO Defocus Blur
15-Tage
0,005
010.0
0,007
0025
0.00
12x
CIFARIO Elastic Transform
CIFARIO - Fog
CIFARIO Frost
DNC
60-
0/51
3 0.000
T1
Te1
CIFARIO Gaussian Blur
CIFARIO Glass Blur
CIFARIO Impulse Noise
13C
0.10
0.10
Bee
CIFARI0 Pixelate
CIFAR10 Rolling
CIFARIO Saturate
TNC
D..0
010
285
CIFARIO Shot Noise
CIFARIO Spatter
CIFARIO Speekle Noise
TNC
0.50
0035
0.00
2051
2
155
UNC
18
T Target
U1S
Figure 5: Robustness UTS domain shift problem compare to TS, Ts-Target and uncalibrated methods. UTS with small gap caan follow TS-Tartet which shows is robust method to domain shift
18

---

Under review as a conference paper at ICLR 2020
Birds ResNet50
CIFARIO DenseNes40
Uncalibrated
Uncalibrated
1.6
TS
TS
UTS
0.8
UTS
1.4
NL.1
NLI
1.2
0.1
0.0
0.1
0.2
0.3
0.1
0.5
0.0
0.1
0.2
0.3
0.1
0.5
CIFARIO DenseNet100
CIFARIO VGG16
Uncallbrated
Uncalibrated
0.8
0.7
TS
TS
UTS
0.6
UTS
NLL
NL.
0.3
0.2
0.0
011
0122
0.3
0.1
0.5
0.0
01.1
0.2
0.3
0.4
0.5
CIFARIO0
DenseNet40
CIFARIO0 100 ResNerl IO0
Unatelbrated
2.0
Uncalibrated
2.0
TS
TS
UTS
UTS
1.8
NL.
1.6
NLL
1.4
1.2
1.2
1.0
1.0
0.0
0.1
0.2
0.3
0.4
0.5
0.0
0.1
0.2
0.3
0.4
0.5
CIFARI00 WideResNec40-4
SVHN Densemet100
Uncalibrated
Unculibrated
1.4
TS
0.7
TS
UTS
UTS
1.2
NLJ
0.5
1.0
0.3
0.8
0.0
0.1
0.2
0.3
0.4
0.5
0.0
0.1
0.2
0.3
0.4
0.5
Noise
Noise
Figure 6: Sensitivity of TS method to the labeling noise in calibration set in compare to UTS and uncalibrated methods. UTS is not sensitive to the labeling noise in calibration sets at all as it is unsupervised approach. Shaded regions represent std over 20 runs.
19

---

Under review as a conference paper at ICLR 2020
CIFARIO Gaussian Noise
MNIST Rolling
MNIST Rolation
100
Austawy
Auaracy
30
0.00
3.1
D/27
3.0
15
30
1.01 130,
|0| 30
[C]
[C]
0.00
0.1
10
Tox 15
30
T5 150
100
|C|
= 50
[C]]
50
[C]
50
110
110
20
Dase
0005
10
11o
2
10
Text 15
th
12r
186 rio
[C]
500
[C|
500
|C| 500
0.00
0.1
5053
0.11
|C|
1000
[C]
1000
|C|
1000
1101
25-
0.00
0005
T14
Tea
2
10
Tex.
15
90
45
00
90
10G
120 156 150 168
[C]
2000
[C]
2000
|C| 2000
UNC
TS
TS-
UTS
Figure 7: Comparing the stability of different TS family approaches to the number of calibration samples. TS-
Target has the best stability. However UTS converges quickly to the optimal solution. Consider that collecting samples for UTS comparing to TS- TS-Target is much less expensive task as does not need labeled samples. The number of samples in calibration set C from top row to the bottom is 30, 50, 500, 1000, and 2000.
20


Reviews:
[{"review_id": "rJxwD1Tb5B", "reviewer": "AnonReviewer3", "summary": "", "questions": "", "limitations": "", "rating": 6, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "The authors propose an approach for calibrated predictions under domain shift scenarios. The approach, that leverages (unlabeled) test samples allows for unsupervised post-processing calibration, even for off-the-shelf models for which the training data is not available. Experiments compare the proposed approach with existing calibration methods in shifted domains.\n\nEquation (5) is confusing. If I understand correctly, the authors are simply making the point that q(x,y=k) can be written in terms of q(x,y\\neq k) by weighting by the ratio of conditionals, which are available.\n\nSensitivity to noisy labels. The experiment is reasonable and the results are convincing, however, the authors do not justify why accurate (manual) labels on the target set are not feasible in many applications. The authors could point to a few examples for context.\n\nThe authors assume that q_s(y) = q_t(y), which seems restrictive in practice. Though it does not impact my opinion of the proposed approach, it seems narrow to think of a practical situation where the space of covariates is changing but the class composition remains unchanged. This is vaguely addressed in Section 6. Perhaps it can be elaborated further.\n\nI enjoyed reading the paper, the proposed reinterpretation of NLL in terms of a weighted average and its approximation based on weights that do not depend on the labels but the (assumed known) labels marginal is interesting and seems to yield good results.", "extra_scores": {"experience_assessment": "I have published one or two papers in this area.", "review_assessment:_thoroughness_in_paper_reading": "I read the paper thoroughly.", "review_assessment:_checking_correctness_of_experiments": "I carefully checked the experiments.", "review_assessment:_checking_correctness_of_derivations_and_theory": "I assessed the sensibility of the derivations and theory."}, "extra_text": {}}, {"review_id": "S1eu25Nqtr", "reviewer": "AnonReviewer1", "summary": "", "questions": "", "limitations": "", "rating": 1, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "The authors present an algorithm for postprocessing neural networks to ensure calibration under domain shift.\nCalibration under domain shift is an interesting challenge that has been receiving increasing attention and tackling this in an unsupervised manner is an interesting approach. However, I have 2 major concerns regarding the approach presented by the authors.\n\nWhat makes calibration under domain shift useful and appealing is that the model is then robust against any changes in the test distribution that can occur during the life cycle of a model. These often include erroneous/samples (corresponding to truly OOD samples), but also gradual domain shift, where the test distribution continuously moves away from the training distribution (e.g. due to a continuous drift in user behaviour/change in customer base) or unforeseen changes. My first major concern is regarding the requirements for UTS, which render this approach not very useful in many of these practical  applications: UTS first requires knowledge of and access to the test distribution; in addition it assumes that the distribution of the labels remains unaffected under domain shift. These assumptions are violated in the practical applications described above, in particular those where a gradual, continuous domain shift occurs - in this case, access to the test distribution is difficult since it changes continuously. On this note I also would have liked to see some analysis on how performance depends on the number of samples that are available from the test set, since in practice this might be substantially smaller than the full test set used.\nFurthermore, I find the assumption that the distribution of labels remains unchanged problematic (q_s(y) = q_t(y) and even q_s(y|x)=q_t(y|x)): once sufficiently out-of-domain, labels become meaningless and predictions for truly OOD samples should have maximum entropy. Even for small domain shifts in practical applications it is not clear why q_s(y|x)=q_t(y|x) should hold and it would have been useful to see a discussion and some robustness analysis on this.\nFinally,  the algorithm requires re-calibration whenever the test distribution changes, which in practice is  often not clear (and part of the reason why dealing with predictions under domain shift is so challenging). \n\nIn addition to doubts on practical applicability, my second major concern is regarding the depth of the evaluation.\nFirst, while the authors present some comparisons to probabilistic methods, I am missing a crucial comparison to Evidential Deep Learning (Sensoy et al, NeurIPS 2018), which results in far superior performance than deep ensembles, SVI or dropout. Importantly, the comparisons to probabilistic approaches presented by the authors are very limited. The big advantage of those approaches is that, once trained, no further recalibration is necessary and well calibrated predictions can be made for any level of domain shift, whereas UTS requires a recalibration step for very level of domain shift. That is why I think it is crucial to not only show one arbitrarily picked level of domain shift for each dataset/perturbation, but calibration across all levels of domain shift, as for TS and TS-Target; since no recalibration is required for those probabilistic approaches \n this is very straight-forward and would be very informative - especially since e.g Figure 5 shows that UTS has only very minor advantages over TS in many settings. \nI appreciate that the authors report some performance in terms of ECE in the supplement, but I think it would be very informative to report performance in terms of ECE for all domain-shift experiments: The Brier score conflates accuracy with calibration (see eg the 2 component decomposition), whereas ECE directly quantifies calibration and is hence easier to interpret and arguably the more meaningful measure when quantifying calibration. \n\nMinor:  I find the manuscript lacks clarity. Aspects such as the definition of calibration as well as implications and interpretation of Proposition 1 should be described in more detail in the manuscript. \n", "extra_scores": {"experience_assessment": "I have published one or two papers in this area.", "review_assessment:_thoroughness_in_paper_reading": "I read the paper thoroughly.", "review_assessment:_checking_correctness_of_experiments": "I carefully checked the experiments.", "review_assessment:_checking_correctness_of_derivations_and_theory": "I carefully checked the derivations and theory."}, "extra_text": {}}, {"review_id": "HkgcVHZttr", "reviewer": "AnonReviewer2", "summary": "", "questions": "", "limitations": "", "rating": 3, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "I've read the rebuttal and unfortunately, I'd like to keep my score as is. I still think the assumption made in the paper is too limiting for most practical settings. \n\n#########################\n\nThe paper proposes an unsupervised calibration method in a domain adaptation setting. The approach is based on the well known temperature scaling and does not require labels for the calibration set. The problem of calibration under domain shift is an important problem in areas where uncertainty estimation is useful; the paper tackles this problem and relaxes the assumption of knowing the input distribution. The method does not rely on the labels in the calibration set but has a major limitation of knowing the task distribution which may not be true in many practical settings where uncertainty estimation is relevant (such as medical diagnostics).\n\nThis assumption may not be a negative point for the paper as any domain adaptation problem needs at least some minimal assumptions; however,  the limits of the proposed method should be studied with respect to this assumption. For instance, in the experiments how robust are the experiments with respect to the assumption of a known q(y)? In the practical applications of the method in medical domain and self driving cars, q(y) is only known up to some approximation; so understanding the robustness of the method w.r.t. to this assumption is critical in real applications. \n\nAlso with the recent attention to calibration and uncertainty estimation in DL; I believe the acceptance bar for papers in this area has risen. Unfortunately, most papers in this area rely on completely synthetic experiments which makes their impact limited. I understand that ground truth uncertainty may not be available in some of these domains; however, other indirect metrics such as missclassification detection can be used. There are also medical datasets available (e.g. Diabetic Retinopathy) that can be used for evaluation. \n\nTo summarize, the paper addresses an important problem of calibration under domain shift but it needs some more empirical work to show the real advantage and limitations of the proposed method in a practical setting.", "extra_scores": {"experience_assessment": "I have published one or two papers in this area.", "review_assessment:_checking_correctness_of_experiments": "I assessed the sensibility of the experiments.", "review_assessment:_thoroughness_in_paper_reading": "I read the paper at least twice and used my best judgement in assessing the paper.", "review_assessment:_checking_correctness_of_derivations_and_theory": "I assessed the sensibility of the derivations and theory."}, "extra_text": {}}]

Author rebuttal:

Meta-review: The paper proposes a method called unsupervised temperature scaling (UTS) for improving calibration under domain shift.

The reviewers agree that this is an interesting research question, but raised concerns about clarity of the text, depth of the empirical evaluation, and validity of some of the assumptions. While the author rebuttal addressed some of these concerns, the reviewers felt that the current version of the paper is not ready for publication.

I encourage the authors to revise and resubmit to a different venue.
Decision: Reject