Deep Generative Classifier for Out-of-distribution Sample Detection
Authors: Dongha Lee
Sehun Yu
Hwanjo Yu
Venue:  (2020)
Keywords: Out-of-distribution Detection
Generative Classifier
Deep Neural Networks
Multi-class Classification
Gaussian Discriminant Analysis

Abstract: The capability of reliably detecting out-of-distribution samples is one of the key factors in deploying a good classifier, as the test distribution always does not match with the training distribution in most real-world applications. In this work, we propose a deep generative classifier which is effective to detect out-of-distribution samples as well as classify in-distribution samples, by integrating the concept of Gaussian discriminant analysis into deep neural networks. Unlike the discriminative (or softmax) classifier that only focuses on the decision boundary partitioning its latent space into multiple regions, our generative classifier aims to explicitly model class-conditional distributions as separable Gaussian distributions. Thereby, we can define the confidence score by the distance between a test sample and the center of each distribution. Our empirical evaluation on multi-class images and tabular data demonstrate that the generative classifier achieves the best performances in distinguishing out-of-distribution samples, and also it can be generalized well for various types of deep neural networks.

Under review as a conference paper at ICLR 2020
DEEP GENERATIVE CLASSIFIER FOR OUT-OF-DISTRIBUTION SAMPLE DETECTION
Anonymous authors Paper under double-blind review
ABSTRACT
The capability of reliably detecting cut-of-distribution samples is one of the key factors in deploying a good classifier, as the test distribution always does not match with the training distribution in most real-world applications. In this work, we propose a deep generative classifier which is effective to detect out-of-distribution samples well as classify in in-distribution samples, by integrating the concept of Gaussian discriminant analysis into deep neural networks. Unlike the discrim- inative (or softmax) classifier that only focuses the decision boundary parti- tioning its latent space into multiple regions, our generative classifier aims to ex- plicitly model conditonnii distributions as separable Gaussian distributions. Thereby, we can define the confidence score by the distance between a test sam- ple and the center of each distribution. Our empirical evaluation on multi-class images and tabular data demonstrate that the generative classifier achieves the best performances in distinguishing outtof-distribution samples, and also it can be generalized well for various types of deep neural networks.
INTRODUCTION
(OOD) detection, also known as novelty detection, refers to the task of identify- ing the samples that differ in some respect from the training samples. Recently, deep neural networks (DNNs) turned out to show unpredictable behaviors in case of mismatch between the training and testing data distributions: for example, they tend to make high confidence prediction for the samples that are drawn from OOD or belong to unseen classes (Szegedy et al. 2014 Moosavi-Dezfooll et al.) 2017.. For this reason, accurately measuring the distributional uncertainty (Malinin & Gales) 2018) of DNNs becomes one of the important challenges in many real-world applications where we can hardly control the testing data distribution. Several recent studies have tried to simply detect OOD
samples using the confidence score defined by softmax probability (Hendrycks & Gimpel 2017
Liang et al.) 2018) or Mahalanobis distance from class means (Lee et al. 2018), and they showed promising results even without re- traininin the model.
However, all of them employ the DNNs designed for a discriminative (or softmax) classifier, which has limited power locate OOD samples distinguishable with in-distribution (ID) samples in their latent space. To be specific, the softmax classifier is optimized to learn the discriminative latent space where the training samples are aligned along their corresponding class weight vectors, maximizing the softmax probability for the target classes. As pointed out in (Hendrycks & Gimpell 2017). OOD samples are more likely to have small values of the softmax probability for all known classes, which means that their latent vectors get closer to the origin. As result, there could be large overlap between two sets of ID and OOD samples in the latent space (Figure []. which eventually reduces the gap between their confidence scores and degrades the performance as well.
In addition, most of existing confidence scores adopt additional calibration techniques (Goodfellow et al., 2014) Hinton et al. 2015) to enhance the reliability of the detection, but they include sev- cral hyperparameters whose optimal values vary depending on the testing data distribution. this situation, they utilized small portion of each test set (containing both ID and OOD samples) for validation, and reported the results evaluated on the rest by using the optimal hyperparameter values for each test case. Considering the motivation of OOD detection that prior knowledge of test distri- butions is not available before we encounter them, such process of tuning the hyperparameters for each test case is not practical when deploying the DNNs in practice.

---

Under review as a conference paper at ICLR 2020
Training distribution
Test distribution
Training distribution
Test distribution
Figure 1: The 2D latent spaces obtained by the softmax classifier (Left) and our proposed generative calssifier (Right). In-distribution and out-of-distribution samples are shown as colored and white circles, respectively. (Dataset: GasSensor, OOD class: "Ammonia" Model: Multi-layer perceptron)
In this paper, propose novel objective train DNNs with generative (or distance) classifier which is capable of effectively identifying OOD test samples. The main difference of our deep gen- erative classifier is to learn separable class-conditional distributions in the latent space, by explicitly modeling them as DNN layer. The generative classifier places OOD samples further apart from the distributions of all given classes, without utilizing OOD samples for its validation. Thus, based on the Euclidean distance between a test sample and the centers of the obtained class dlass-conditioall distri- butions, we can calculate how likely and how confidently the sample belongs to each class. This can be interpreted as multi-class extension of unsupervised anomaly detection (Ruff et al.) 2018)) and Gaussian discriminant analysis provides the theoretical background for incorporating the generative classifier into the DNNs. Our extensive experiments on images and tabular data demonstrate that the proposed classifier distinguishes OOD samples more accurately than the state-of-the method, while maintaining the classification accuracy for ID samples.
METRIC LEARNING-BASER DEEP GENERATIVE CLASSIFIER
We introduce a novel objective for training deep neural networks (DNNs) with a generative classi- fier, which is able effectively detect out-of-distributin samples well classify in-distribution samples into known classes. We first derive the learning objective from the Gaussian discriminant analysis, and propose the distance-based confidence score for out-of-distribution sample detection.
Metric learning objective for classification. The key idea of our objective is to optimize the deep learning model that the latent representations (i.e., the outputs of the last layer) of data samples in the same class gather together thereby form an independent sphere. In other words, it aims to learn each class-conditional distribution in the latent space to follow normal distribution that is entirely separable from other cans-connitional distributions. Using the obtained distributions, we can calculate the caas-cooniiional probabilities that indicate how likely an input sample is generated from each distribution, and this probability can serve good measure of the confidence. We define the two terms based on the Euclidean distance between the data representations obtained by the DNNs, denoted by fxx), and the center of each class-conditional distribution, denoted by cą- Given N training samples { (x1,, (x1,91).... y1).... (N)) from K different classes, the objective is described as follows.
N log exp(-115(x; W) - Cy. 112++ +b.)) + X (1f - cy. cy.l12) -wull)). (1) Ek exp((11f(x;; W) - 11 2 bb)
min W.e.b N
The objective includes three types of trainable parameters: the weights of DNNs W, the class centers Ci....,Co Cк and biases bi....,br All of them can be effectively optimized by stochastic gradient descent (SGD) and pack-propagation, which are widely used in deep learning.
Note that we directly optimize the latent space induced by the DNNs using Euclidean distance, similarly to other metric learning objectives. Existing deep metric learning based on the triplet loss (Hoffer & Ailon, 2013) et al.) 2015)) learns the distance among training samples utilizing their label information capture their similarities into the metric space for variety of retrieval
2

---

Under review as a conference paper at ICLR 2020
tasks. On the other hand, our objective focuses on the distance between the samples and their target class centers for the accurate modeling of class-conditional distributions.
Derivation from Gaussian discriminant analysis. Our objective for the generative classifier can be understood from the perspective of Gaussian discriminant analysis (GDA) (Murphy) 2012).
The generative classifier defines the posterior distribution P(y|x) by using the class conditoantli distribution P(xly) and class prior P(y). In case of GDA, each classcconiiional distribution is assumed follow the multivariate Gaussian distribution (i.e., P(xly k) - -V(x pi: Ex) )) and the
Be class prior is assumed follow the Bernoulli distribution (i.e.. P(y k) Σx B ). To simply fuse GDA with DNNs, we further fix all the class covariance matrices to the identity matrix (i.e., Σn- 1). Then, the posterior probability that sample (xx belongs the class k is described as
Ply k)) P(f())) k)
exp( f1l 14x11 + log 3x)
P(y - -((x)(((x)) = Σx Ply=
Σ. exp( (xx - p4 12 + log 3R))
Considering ( and log 3g as the class center Ck and bias by respectively, the first term of our objective (1) is equivalent to the negative log posterior probability. That is, the objective eventually trains the classifier by maximizing the posterior probability for training samples.
However, the direct optimization of the DNNs and other parameters by its gradient does not guaran- tee that the class-conditional distributions become the Gaussian distributions and the class centers are the actual class means of training samples. Thus, to enforce our GDA assumption, we minimize the Kullback-Leibler (KL) divergence between the k-th empirical class-conditional distribution and the Gaussian distribution whose mean and covariance are C₁ and I, respectively. The empirical class- conditonndiion distribution is represented by the average of the dirac delta functions for all train- ing samples of target class, i.e., Ps. 1 Ey,= 8(x fxx)), where N₂ is the number of the training samples of the class k. Then, the KL. divergence is formulated as
Nr
KT.(PP& || (ckk, 1)) = /
(2x)a/2 exp (-51ix call²) dx
5(x f(x:)) log
N
y.=k
+
Σ
5(x - f(xx))
Σ 5(x - f(xi)) dx
N
NA
yi=k
wi=k
1 Σ log
1
exp ( (lf(xx)) - -clll)
+ log N₁
N₂
(2x))d12
Wi=k
llf(x))
cxll2 + constant.
2N
The entropy term of the empirical class-conditional distribution can be calculated by using the def- inition of the dirac measure (Murphy 2012). By minimizing this KL divergence for all the classes, objec-
can approximate the K class conditionl Gaussian distributions. Finally, complete tive by combining this KI. term with the posterior term using the X-weighted sum order to control the effect of the regularization. We remark that À is the hyperparameter used for training the model, which depends on only ID, not OOD; thus it does not need to be tuned for different test distributions.
In-distribution classification. Since our objective maximizes the posterior probability for the target class of each sample P(y = y lx), we can predict the class label of an input sample to the class that has the highest posterior probability
follows.
(x) arg max Pyy = k/x) = arg max (-11f(x - c1 + by)
In terms of DNNs, our proposed classifier replaces the fully-connected layer (fc-layer) computing the final classification score by Wx fx) + by with the distance metric layer (dm-layer) com- puting the distance from each center by - (x)
c2 + by. In other words, the class label is mainly predicted by the distance from each class center, so we use the terms "distance classifier" and "generative classifier" interchangeably in the rest of this paper. The dm-layer contains the exactly same number of model parameters with the fully-connecter layer, because only the weight matrix
W [wi;...; wx] RKxd is replaced with the class center matrix C [ci;...; cK] E Rkxd
3

---

Under review as a conference paper at ICLR 2020
Table 1: Statisties of tabular datasets.
Dataset
Attributes
# Instances
Classes
GasSensor
128
13,910
Shuttle
58,000
DriveDiagnosis
48
58,509
11
MNIST
784
70,000
10
Out-of-distributie detection. Using the trained generative classifier (i.e., class-conditional dis- tributions obtained from the classifier), the confidence score of each sample can be computed based on the caasscooniiional probability P(xly k). Taking the log of the probability, the confidence score D(x) using the Euclidean distance between a test sample and the center of the closest class-conditionn distribution in the latent space,
simply define
D(x) = min [I((x) - 1=
This distance-basee confidence score yields discriminative values between ID and OOD samples. In the experiment section, show that the Euclidean distance in the latent space of our distance classifier is more effective to detect the samples not belonging to the K classes, compared to the Mahalanobis distance in the latent space of the softmax classifier. Moreover, it does not require further computation to obtain the class means and covariance matrix, and the predictive uncertainty can be measured by single DNN inference.
Relationship to deep one-class classifier. Recent studies on one-class classification, which have been mainly applied anomaly detection, try employ DNNs in order effectively model the normality of single class. Inspired by early work on onc-class classification including one-class support vector machine (OC-SVM) (Schölkopf et al.) (00T) and support vector data description (SVDD) (Tax & Duin, 2004). Ruff objective, DeepSVDD. trains the DNNs to map samples the single known class close to its class center in the latent space, showing that it finds hypersphere of minimum volume with the center c:
Rufff et al. (2018) (019) proposed simple yet powerful deep learning
I N W N
min
Σ
()) - c|l
Our DNNs with the distance classifier can be interpreted as an extension of DeepSVDD for multi- class classification, which incorporates K one-class classifiers into single network. In the proposed objective (T). the first term makes the K classifiers distinguishable for the multi-class setting, and the second term learns each classifier by gathering the training samples into their corresponding center, as done in DeepSVDD. The purpose of the one-class classifier is to determine whether test sample belong the target class not, thus training for each class is useful for detecting out-of -iito--diitribttion samples in our task as well.
3 EXPERIMENTS
In this section, we present experimental results that support the superiority of the proposed model. Using tabular and image datasets, we compare the performance of our distance classifier (i.e., DNNs with dm-layer) with that of the softmax classifier (i.e., DNNs with fc-layer) in terms of both ID clas- sification and OOD detection. We also provide empirical analysis on the effect of our regularization term. Our code and preprocessed datasets will be publicly available for reproducibility.
3.1 EVALUATION ON TABULAR DATASETS
Experimental settings. We first evaluate our distance classifier using four multi-class tabular datasets with real-valued attributes: GasSensor, Shuttle, DriveDiagnosis, and MNIST. They downloaded from UCI Machine Learning repository"] and we use them after preprocessing all the attributes using z-score normalization. Table [ summarizes the details of the datasets. To simulate
4

---

Under review as a conference paper at ICLR 2020
Table 2: Performance of ID classification and OOD detection by each confidence score (and the classifier) on tabular datasets. The best results are marked in bold face.
Classification acc.
TNR at TPR 85%
AUROC
Detection acc.
Data
OOD
Baseline (softmax) Mahalanobis (softmaxx Euclidean (distance)
0
99.65 99.35/ 99.59
42.42/ 95.95 990.58
57.46 95.90 / 94.54
64.99/ / 91.52 / 88.27
GasSensor
99.71 / /99.33/ 99.664
35.00 / 87.87 99.20
49.54 / 99.86/ 98.99
60,96 / 88.65 96.03
2
99.74/ 99.53 99.72
72.63 88.97 / 92.88
85.48 92.97 95.881
79.42 / 87.94 90.77
3
99.67
99..42 199661
93.97 / 33.80/ / 99.88
95.87 75.88 / 99.36
90.36 / 72.73 / 97.55
4
99.72
99.54 19.773
67.31 / 99.99/ / 99,49
78.67 / 96.65 / 98.91
76.62 / 90.94 / 95,88
5
99.70 / 99.41 / 99.60
47.44/ / 19.05 88.95
78.72/ / 69.88 93.72
74.50/ / 69.73 / 87.98
0
99.94 99.94/ 99.90
88.69 99.36/ / 18.73
91.69 / 99.11 / 98.65
90.27 / 98.10 / 97.38
99,96 93 99.94
69.20 / 100.0/ / 100.0
77.34 99.58 99.722
79.94/ 99.22 97.56
Shuttic
99.96 99.96/ 99.96
52.63 19.883 99.553
63.63 98.51 / 99.000
70.58/ /94.75/ / 95.39
3
/ 93 99.95
96.42 / 98.21 / 99.90
98.08 98.44 / 98.73
92.68 94,61 / 94.58
4
99.97 / 96.96 99.96
69.80/ 100.0/ / 100.0
76.66 / 99.90 99.92
80.81 99.87 / 99.70
99.95 / 99.93 99.94
14.00 / 100.0/ 100.0
16.84 / 99.94/ 99.93
56.01/ 99.92 99.91
99.97 99.93 99.95
00.00 96.92 / 100.0
00.00 96.82 99.78
50.00 / 98.24 / 99.77
0
99.71 98.477 99.73
13.74 82.22 62.24
20.78 91.28 80.26
51.70/ 84.63 / 74.65
99.72 98.89/988889 99.84
07.98 55.94 62.22
12.09 79.74 82.97
50.04 74.44 74.92
2
99.67 98.29 19.668
63.73 / 55,50 / 77.41
75.30 / 79.92 88.64
75.96 / 73.65 / 81.70
DriveDiagnosis
3
99.67 98.20 99,66
53.78 / 80.39 / 89.63
63.16 / 90.43 94.28
69.68 / 84.57 / 88.19
4
99.74 58.59 99.73
78.71 / 23.42 94.07
81.72 / 66.72 96.55
82.44 / 64.03 / 91.21
99.75 98 67 99.77
68.82 24.51 / 80.58
78.24 68.24 89.43
77.58 65.46 83.33
99.63 / 99.63
08.63 / 99.83/ / 91.06
10.58 99.67 995777
50,92 98.16 90.08
7
99.68 98.31 / 199.75
24.62 / 66.13 71.97
34.04 / 85.34 / 85.68
55.47 / 79.10 79.30
8
99.68 98.57 / 99.75
59.24/ 43.86 / 71.60
74.69 / 75.40 85.19
/ 69.62 / 78.60
99.70 98.94 99.74
02.38 65.51 / 28.78
04.43 / / 63.21
50,00 77.47 / 61.30
99.61 10
99.23 99.61
10.06 100.0/ / 100.0
12.93 99.97 99.99
51.89/ 99.97 99.87
0
97.82 96.93 97.24
85.81 / 63.55 89.60
82.93 / 93.09
87.34/ / 76.97 / 87.45
97.86 96.87 96.99
93.34 / 09.77 88.20
90.39 59.52 90.75
91.47 61.69 / 84.93
2
97.97 / 99.116 / 97.46
73.88 / 74.99/ / 84.78
71.61/ / 88.83 / 90.95
82,52 / 81.38 / 84.98
MNIST
3
97.99 97.50/ / 97.56
72.31 / 49.71 / 89.01
69.82 / 19.19 92.60
81.29 / 72.72 87.24
4
98.02 97.26 99.447
51.20 24.91 63.24
49.36 / 65.9 / 80.15
71.27 / 62.61 / 74.74
98.04 97.38/ 97.57
74.38 / 83.09
72.18 74.37 89.86
82.98 69.30 84.14
6
97.86 96.97 997377
73.86 49.43 87.72
71.30 79.04 91.54
81.82 / 72.26 85.42
7
98. 10 97.17 97.51
71.20 46.75 82.05
08.90/77.22 89.60
81.10
83.59
8
98.10 / 97.41 99.66
86.21 / /4.74/95.18
83.78 / 62.85 95.71
87.63 / 63.00 90.99
9 98.21
/ 99. 197.53
78.06/ 12.69 / 87.12
75.95 / 57.82 91.42
84.44 / 60.40 86.18
the scenario that the test distribution includes both ID and OOD samples, we build the training and test set by regarding one of classes as the OOD class and the rest of them as the ID classes. We exclude the samples of the OOD class from the training set, then train the DNNs using only the ID samples for classifying inputs into the K-1 classes. The test set contains all samples of the OOD class as well as the II) samples that are left out for testing. The evaluations are repeated while alternately changing the OOD class, thus we consider K scenarios for each dataset. For all the scenarios, we perform 5-fold cross validation and report the average results.
The lulti-layer perceptron (MLP) with three hidden layers is chosen as the DNNs for training the tabular data. For fair comparisons, we employ the same architecture of MLP (# Input attributes x x128 x 128 x 128x # Classes) for both the softmax classifier and the distance classifier. We use the Adam optimizer (Kingma & Ba 2014) with the initial learning rate n 0.01, and set the maximum number of epochs to 100. In case of tabular data, we empirically found that the regularization coefficient À hardly affects the performance of our model, fix it to 1.0 without further hyperparameter tuning.
We consider two competing methods using the DNNs optimized for the softmax classifier: 1) the baseline method (Hendryeks & Gimpel 2017) uses a maximum value of softmax posterior proba-
bility as the confidence score, max; Σn (
exp(w, (6x)+ and 2) the state-of-the-art method Lee
5

---

Under review as a conference paper at ICLR 2020
Table 3: Performance of OOD detection by each confidence score (and the classifier) on image datasets. The best results are marked in bold face.
TNR TPR 85% Baseline (softmax) Mahalanohis (softmax)
AUROC
Detection acc. Euclidean (distance)
Model
ID
OOD
CIFAR-10
89.86/ 90,65 98.38
92.29/ / 94,81 997.68
87.44 / 87.87 94.07
SVHN
ImageNet
91.93 85,86 98,30
93.58 92.94 97.98
88.51 85,58 93.56
LSUN
90.67 85.85 / 95.551
92.74 92.79 95.86
87.84 85.68 90.63
RetNet
SVHN
70.85 72.21 / 70.58
88.59 88.65 86.42
80.75 82.34 80.82
CIFAR-10
ImageNet
83.53
67.76 98.26
91.22 86.75 19,30
85.01 79.21 991.75
LSUN
89.94 / 73.85 / 98.55
93.19/ 88:95 99.16
87.78 / /82.23 / 92.19
SVHN
40.12 44.52 / 42.18
78.26 80.52 76,56
72.69 74.44/ 71.45
CIFAR-100
ImageNet
44.49 / 48.04 004/50.0 50.78
78.67 76.57 18.02
72.21 69.58 75.58
LSUN
44.37 / 46.35 51.07
78.87 / 76.41 83.30
72.64 69.77 77.40
CIFAR-10
90.06 / 88.65 / 94.26
92.98 / 93.67/ 995.49
88.05 86.85 899667
SVHN
ImageNet
94.89/ 86.83 95.774
95.88 / /3.33/ 96.43
91.10/ 86.03 / 90.87
L.SU
92.63 75.94 195.52
94.67 88.98 19.200
89.70 81.24 90.68
DenseNet
SVHN
90.63 88.32 91.31
92.87 / 94.06 / 94.85
87.52 87.09 88.33
CIFAR-10
Imagenet
83.98
69.47 85.00
90.77 83.31 92.12
88.12 77.56 85.12
LSUN
85.33
66.24 86.52
92.26 82.82 92.83
84.06 75.83 85,80
SVHN
37.80/ 48.96 52.48
75.14 68.82/ 79.16
70.03 62.02 72.37
CIFAR-100
ImageNet
35.22
48.21 /56.01
62.12 68.87 80.29
60.30/ 61.73 73.30
LSUN
38.71 / 43.62 47.39
66.36 67.51 / 75.82
63.15 59.94 69.93
et al. 2018) defines the score based the Mahalanobis distance using empirical class means Pa and covariance matrix E. which is max; (x((x) jux) ( (-((((x) ju)). Note that any OOD samples are not available at training time, so we do not consider advanced calibration techniques for all the methods; for example, temperature scaling, input perturbation (Liang al., 2018), and
regression-basee feature ensemble (Lee et al. 2018). We measure the classification accuracy for ID test sample as well as three performance metries for OOD detection: the true negative rate (TNR) at 85% true positive rate (TPR), the area under the receiver operating characteristic curve (AUROC), and the detection accuracy
Experimental results. In Table our proposed method (i.e., distance-based confidence score) using the distance classifier considerably outperforms the other competing methods using the soft- max classifier in most scenarios. Compared to the baseline method, the Mahalanobis distance-based confidence score sometimes performs better, and sometimes worse. This strongly indicates that the empirical data distribution in the latent space does not always take the form of Gaussian dis- tribution for each class, in case the softmax classifier. For this reason, our explicit modeling of dlass-condition Gaussian distributions using the dm-layer guarantees the GDA assumption. and it eventually helps to distinguish OOD samples from ID samples. Morcover, the distance classifier shows almost the same classification accuracy with the softmax classifier; that is, it improves the performance of OOD detection without compromising the performance of ID classification.
For qualitative comparison the latent spaces of the softmax classifier and distance classifier, we plot the 2D latent space after training the DNNs whose size of latent dimension is set to 2. the training and test distributions of the GasSensor dataset, where the class 3 (i.e.. Ammonia) is considered as the OOD class. Our DNNs successfully learn the latent space so that ID and OOD samples are separated more clearly than the DNNs of the softmax classifier. Notably, in case of the softmax classifier, the covariance matrices of all the classes are not identical, which violates the necessary condition for the Mahalanobis distance-based confidence score be effective
Thhe oftt--of-thc-art method can predict the class label of test samples by the Mahalanobis distance from class means, j(x) arg ming (x (Ax) ブ-1 (f(x)- (.)) "These performance metrics have been mainly used for OOD detection (Lee al. 2018
Liang et al. 2018

---

Under review as a conference paper at ICLR 2020
Table 4: ID classification accuracy of each method on image datasets.
SVHN
CIFAR-10
CIFAR- 100 Fuclidean (distance)
Model
Baseline (softmax)
Mahalanohis (soltmax)
ResNet
95.81 / 95.76 95.92
93.93 /3.92/ 93,92 99.30
75.59 74.78 78.32 72.27 68.22 75.339
DenseNet
95.30 95.22 / 95.59
92.87 / 91.66 94.74
in detecting OOD samples |
In this sense, the proposed score does not require such assumption any longer, because our objective makes the latent space satisfy the GDA assumption.
3.2 EVALUATION ON IMAGE DATASETS
Experimental settings. We validate the effectiveness of the distance classifier on OOD image detection as well. Two types of deep convolutional neural networks (CNNs) are utilized: ResNet (He et al.. 2016) with 100 layers and DenseNet (Huang et al. 2017) with 34 layers. Specifically, we train ResNet and DenseNet for classifying three image datasets: CIFAR-10. 10, CIFAR-100 (Krizhevsky er al. 2009), and SVHN (Netzer et al. 2011). Each dataset used for training the models is considered as ID samples, and the others are considered as OOD samples. To consider variety of OOD samples at test time, we measure the performance by additionally using TinyImageN
(randomly cropped image patches of size 32 x 32 from ImageNet dataset) (Deng et al., 2009) and LSUN (Yu et al. 2015) as test OOD samples. All CNNs are trained with stochastic gradient descent with Nesterov momentum (Duchi et al. 2011). and we follow the training configuration (e.g., the number of epochs, batch size, learning rate and its scheduling, and momentum) suggested by (Lee et al., 2018 Liang et al. 2018). The regularization coefficient À of the distance classifier is set to 0.1.
Experimental results. Table shows that our distance classifier also can be generalized well for deeper and more complicated models such as ResNet and DenseNet. Similarly to tabular data, our confidence score achieves the best performance for most test cases, and significantly improves the detection performance over the state-of-the-art method. Interestingly, the distance classifier achieves better ID classification accuracy than the softmax classifier in Table 4 These results show the possibility that any existing DNNs can improve their classification power by adopting the dm- layer, which learns the class centers instead of the class weights. From the experiments, we can conclude that our proposed objective is helpful to accurately classify ID samples as well as identify OOD samples from unknown test distributions.
3.3 EFFECT OF REGULARIZATION
We further investigate the effects of our regularization term on the performance and the data dis- tributions in the latent space. We first evaluate the distance classifier, using the DNNs trained with different À values from 10-3 to 10a. Figure 2 presents presentsssss the performance changes with respect to the À value. In terms of ID classification, the classifier cannot be trained properly when À grows beyond 10?, because the regularization term is weighted too much compared to the log posterior term in our objective which learns the decision boundary. On the other hand, we observe that the OOD detection performances are not much affected by the regularization coefficient, unless we set À too small or too large; any values in the range 10.1, 10) are fine enough obtain the model working well.
We also visualize the 2D latent space where the training distribution of MNIST are represented, varying the value of {0.01, 0.1, 1, 10). In Figure 3 even with a small value of X, we can find the decision boundary that partitions the space into K regions, whereas the class centers (plotted as black circles) do not match with the actual class means and the samples are spread over the entire space. As À increases, the class centers approach to the actual class means, and simultaneously the samples get closer to its corresponding class center thereby form multiple spheres. As discussed in Section [ the regularization term enforces the empirical class-conditional distributions to ap- proximate the Gaussian distribution with the mean C₁. In conclusion, the proper value of À makes the DNNs place the condiiccn Gaussian distributions far apart from each other, so the OOD samples are more likely to be located in the rest of the space.
"This confidence score is derived under the assumption that all the classes share the covariance matrix.
7

---

Under review as a conference paper at ICLR 2020
100
100
100
Classibeation Avc.
TNR 85%
GOD Closs
Detrxettonn act.
96
80
AIRRC
80
80
class
941
class
70
70
class
class
20
*10 #10 16" 10 10s
10"
10
710
F30
100
10
10
10
11 710
'10 110F 201 1D 10>
'10 "10
410
'10" 10' 10F T0
Repularize: (A)
Regularizer
Requlacizer (A)
Reqularizer (A)
Figure The performance changes with respect to values. (Dataset: GasSensor)
Figure 3: The training distribution in our 2D latent space, A=0.01, 0.1, 1, and 10. (Dataset: MNIST)
4 RELATED WORK
As DNNs have become the dominant approach wide range of real-world applications and the cost of their emrors increases rapidly, many studies have been carried out on measuring the uncer- tainty of model's prediction. especially for non-Bayesian DNNs (Gall 2016 Teye et al. 2018). Recently, Malinin & Gales (2018) defined several types of uncertainty, and among them, distri- butional uncertainty occurs by the discrepancy between the training and test distributions. In this sense, the OOD detection task can be understood as modeling the distributional uncertainty, and variety of approaches have been attempted, including the parameterization of prior distribution over predictive distributions (Malinin & Gales 2018) and training multiple classifiers for ensem- ble method (Shalev et al. 2018: Vyas et al. 2018)).
The baseline method (Hendrycks & Gimpel 2017) is the first work to define the confidence score by the softmax probability based on a given DNN classifier. To enhance the reliability of detection, ODIN (Liang al., 2018) applies two calibration techniques, i.e., temperature scaling (Hinton al., 2013) and input perturbation (Goodfellow et al., (0014), to the baseline method, which can push the softmax scores of ID and OOD samples further apart from each other. [ee et al. (2018) uses the Mahalanobis distance from class means instead of the sofumax score, assuming that samples of each class follows the Gaussian distribution in the latent space. However, all of them utilize the DNNs for the discriminative (i.e, softmax) classifier, only optimized for classifying ID samples. Our approach differs from the existing methods that explicitly learns the class-conditional Gaussian distributions and computes the score based on the Fuclidean distance from class centers.
5 CONCLUSION
This paper introduces a deep learning objective learn the multi-class generative classifier, by fusing the concept of Gaussian discriminant analysis with DNNs. Unlike the conventional soft- max classifier, our generative (or distance) classifier learns the class-conditional distributions to be separated from each other and follow the Gaussian distribution at the same time, thus it is able to effectively distinguish OOD samples from ID samples. We empirically show that our confidence score beats other competing methods in detecting both OOD tabular data and OOD images, and also the distance classifier can be easily combined with various types DNNs to further improve their performances.
8

---

Under review as a conference paper at ICLR 2020
REFERENCES
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pp. 248-255, 255, 2009.
John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. JMLR, 12(1u):2121-2159 2011.
Yarin Gal. Uncertainty in deep learning. PhD thesis, PhD thesis, University of Cambridge, 2016.
lan J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv: 112.:::4 2014.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recog- nition. In Proceedings of the IEEE conference computer vision and pattern recognition, pp. 770-778, 2016.
Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In ICLR, 2017.
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge neural network. arXiv preprint ar 10030535,,, 2015.
Elad Hoffer and Nir Ailon. Deep metric learning using triplet network. International Workshop on Similarity-Bass Pattern Recognition, pp. 84 92, 2015.
Gao Huang. Zhuang Liu, Laurens Van Der Maaten, and Kilian Weinherger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700-4708, 2017.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980 2014.
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. simple unified framework for detecting out-of-distribution samples and adversarial attacks. In NeurlPS, pp. 7167-7177, 2018.
Shiyu Liang, Yixuan Li, and R Srikant. Enhancing the reliability of out-of-distribution image detec- tion in neural networks. ICLR, 2018
Andrey Malinin and Mark Gales. Predictive uncertainty estimation via prior networks. In NeurIPS, pp. 7047-7058, 2018.
Seyed-Mohsen Moosavi-Dezfodu Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. In CVPR, pp- 1765-1773, 2017.
Kevin P Murphy. Machine learning: probabilistic perspective. MIT press, 2012.
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Ng. Reading digits in natural images with unsupervised feature learning. 2011.
Lukas Ruff, Robert Vandermeulen, Nico Goernitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Alexan- der Binder, Emmanuel Müller, and Marius Kloft. Deep one-class classification. In ICML, pp- 4393 4402, 2018
Lukas Ruff, Robert A Vandermeulen, Nico Görnizz, Alexander Binder, Emmanuel Müller, Klaus- Robert Müller, and Marius Kloft. Deep cemi-supervised anomaly detection. arXiv preprint arXiv:1906.0m 02694, 2019.
Bernhard Schölkopf, John C Platt, John Shawe-Taylor. Taylor, Alex J Smola, and Robert C Williamson. Estimating the support a high-dimensional distribution. Neural computation, 2001.

---

Under review as a conference paper at ICLR 2020
Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. CVPR, pp. 815 115-823,20 2015.
Gabi Shalev, Yossi Adi, and Joseph Keshet. Out-of-distribttion detection using multiple semantic label representations. NeurIPS, pp. 7375-7385, 2018.
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2014.
David MJ Tax and Robert PW Duin. Support vector data description. Machine learning, 54(1): 45-66, 2004.
Mattias Teye, Hossein Azizpour, and Kevin Smith. Bayesian uncertainty estimation for batch nor- malized deep networks. In ICML, pp. 4914-4923, 2018.
Apoory Vyas, Nataraj Jammalamadaka, Xia Zhu, Dipankar Das, Bharat Kaul, and Theodore Willke. Out-of iitoo--distributin detection using an ensemble of self supervised leave-out classifiers. In ECCV, pp. 550-564, 2018.
Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.033: 2015.
10


Reviews:
[{"review_id": "rkg7luoWcS", "reviewer": "AnonReviewer2", "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": "This paper presents an algorithm two learn both classifier and out-of-distribution sample detector. Instead of learning softmax weights, the proposed approach learns to project the inputs to a latent space, where each class is a Gaussian distribution. Out-of-distribution samples can be detected by the distance between the learnt representation and centers. The proposed approach can be viewed as generalization of Gaussian discriminant analysis and one-class classification. The proposed approach is technically sound, and the experiments do show some improvement over previous algorithm on out-of-distribution detection, especially on tabular datasets. However I think there are some weaknesses of this paper\n\n* The novelty is a little thin. The proposed algorithm is based on just a modification of the learning objective, and there are no theoretical analysis of why the proposed approach can work better.\n* Experimental result is somewhat weak. Improvement on the image datasets seems marginal, especially on the SVHN dataset. I also doubt if classifying Cifar10 against TinyImageNet or LSUN challenging enough, because these datasets are fairly different. I am interested in whether the proposed approach can detect novel classes, such as training using only 9 of 10 classes on Cifar10.\n\nAnother question: does learning classifier as well as centers need additional optimization techniques, like special initialization?\n\nUpdate\n======= \n\nAfter a careful read of the Mahabolis baseline (Lee et al., 2018) I agree with the authors that this paper has some novelty comparing with previous works, i.e., directly learning a generative classifier instead of converting a discrimitively trained classifier into generative. Combined with the good results obtained. I will raise my score to a weak accept (though without a strong belief).", "extra_scores": {"experience_assessment": "I do not know much about 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": {}}, {"review_id": "Sygh7IBZ5r", "reviewer": "AnonReviewer3", "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": "This paper proposes a metric learning-based generative model for detecting the out-of-distribution examples.  A new objective function is proposed to model class-dependent class-distribution into a Gaussian analysis models. For the proposed objective, the illustration of derived KL divergence under the Gaussian discriminative analysis assumption is well done.  The empirical results conclude the superiority of the proposed loss function in both tabular and image datasets, when comparing the plain network and one with a softmax.\n\nThis study aims is to detect out-of-distribution samples for better generalization. However, the related works need to be revised and present the novelty of the work compared to some metric and distance-based learning algorithms. For example, the proposed idea is similar to adding a regularization term to the prototypical network with Euclidean distance (Snell et al. 2016). This aspect is not very well explained.\n\nAnother issue is the lack of comparison with state-of-the-art approaches. The Related Work section (Sec. 2) show a baseline (plain) and another one based on softmax. Experimental comparison with state-of-the-art will help to position this work.\n\n** Update ** I read the authors comments and other reviews. Although some clarification were useful, I still maintain my rating of \"weak reject\", I don't get much excitment and I am not feeling there is something great with this work.\n", "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": {}}, {"review_id": "SJgAzmZUYr", "reviewer": "AnonReviewer1", "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": "Summary:\n\nUnlike the softmax classifier, the authors considered the generative classifier based on Gaussian discriminative analysis and showed that such deep generative classifiers can be useful for detecting out-of-distribution samples. For various benchmark tasks, the proposed method outperforms baselines based on the softmax classifier.  \n\nDetailed comments:\n\nThe novelty of this paper is not significant due to the following reasons:\n\n1. The main message (i.e. the concept of the deep generative classifier can be useful for detecting out-of-distribution samples) is not really new because it has been explored before [Lee' 18]. Even though this paper considers training a deep generative classifier directly unlike [Lee' 18], the proposed method looks like a simple variant of [Lee' 18].\n\n2. Missing baselines for training the deep generative classifier: training the deep generative classifier directly has been studied by [Guerriero' 18] and [Pang' 18] but the authors did not compare the proposed training method with such baselines. Because of that, it is hard to say that contributions from proposing a training method are significant. \n\nQuestions:\n\n1. Could the authors consider a case without an identity covariance assumption? Most training methods for deep generative classifier assumes the identity covariance matrix because optimizing the log determinant is not easy. So, it would be interesting if the authors can handle this issue. \n\n2. Even though the authors assume the identity covariance matrix, the covariance matrix of pre-trained features can not be an identity matrix. Could the authors report the performance of Mahalanobis detector using the proposed deep generative classifier? \n\n[Lee' 18] Lee, K., Lee, K., Lee, H. and Shin, J., 2018. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In Advances in Neural Information Processing Systems (pp. 7167-7177).\n\n[Guerriero' 18] Samantha Guerriero, Barbara Caputo, Thomas Mensink, DeepNCM: Deep Nearest Class Mean Classifiers, ICLR workshop 2018.\n\n[Pang' 18] Pang, T., Du, C. and Zhu, J.,  Max-mahalanobis linear discriminant analysis networks. In ICML, 2018.", "extra_scores": {"experience_assessment": "I have published in this field for several years.", "review_assessment:_checking_correctness_of_derivations_and_theory": "I carefully checked the derivations and theory.", "review_assessment:_checking_correctness_of_experiments": "I carefully checked the experiments.", "review_assessment:_thoroughness_in_paper_reading": "I read the paper thoroughly."}, "extra_text": {}}]

Author rebuttal:

Meta-review: The paper presents a training method for deep neural networks to detect out-of-distribution samples under perspective of Gaussian discriminant analysis.

Reviewers and AC agree that some idea is given in the previous work (although it does not focus on training), and additional ideas in the paper are not super novel. Furthermore, experimental results are weak, e.g., comparison with other deep generative classifiers are desirable, as the paper focuses on training such deep models.

Hence, I recommend rejection.
Decision: Reject