Adaptive Uncertainty Estimation via High-Dimensional Testing on Latent Representations
Authors: Tsai Hor Chan
Kin Wai Lau
Jiajun Shen
Guosheng Yin
Lequan Yu
Venue: NeurIPS 2023 poster (2023)
Keywords: Bayesian deep learning
high-dimensional testing
uncertainty estimation
out-of-distribution detection
TL;DR: We introduce a novel uncertainty estimation framework via high-dimensional testing

Abstract: Uncertainty estimation aims to evaluate the confidence of a trained deep neural network. However, existing uncertainty estimation approaches rely on low-dimensional distributional assumptions and thus suffer from the high dimensionality of latent features. Existing approaches tend to focus on uncertainty on discrete classification probabilities, which leads to poor generalizability to uncertainty estimation for other tasks. Moreover, most of the literature requires seeing the out-of-distribution (OOD) data in the training for better estimation of uncertainty, which limits the uncertainty estimation performance in practice because the OOD data are typically unseen. To overcome these  limitations, we propose a new framework using data-adaptive high-dimensional hypothesis testing for uncertainty estimation, which leverages the statistical properties of the feature representations. Our method directly operates on latent representations and thus does not require retraining the feature encoder under a modified objective. The test statistic relaxes the feature distribution assumptions to high dimensionality, and it is more discriminative to uncertainties in the latent representations. We demonstrate that encoding features with Bayesian neural networks can enhance testing performance and lead to more accurate uncertainty estimation. We further introduce a family-wise testing procedure to determine the optimal threshold of OOD detection, which minimizes the false discovery rate (FDR). Extensive experiments validate the satisfactory performance of our framework on uncertainty estimation and task-specific prediction over a variety of competitors. The experiments on the OOD detection task also show satisfactory performance of our method when the OOD data are unseen in the training. Codes are available at https://github.com/HKU-MedAI/bnn_uncertainty.

Adaptive Uncertainty Estimation via High-Dimensional Testing on Latent Representations
Tsai Hor Chan Department of Statistics and Actuarial Science The University of Hong Kong hchanth@connect. hku hk
Kin Wai Lau TCL AI Lab Hong Kong stevenlau@tcl.coom
Jiajun Shen TCL AI Lab Hong Kong shenj jaanjjiann wawnn00gmaaa......mm com
Guosheng Yin
Department Mathematics Imperial College London
guosheng. yin@imperiall... ac. uk
Lequan Yu*
Department of Statisties and Actuarial Science The University of Hong Kong lqyu0hku.ha hk
Abstract
Uncertainty estimation aims to evaluate the confidence of a trained deep neu- ral network. However, existing uncertainty estimation approaches rely on low- dimensional distributional assumptions and thus suffer from the high dimensionality of latent features. Existing approaches tend to focus on uncertainty on discrete classification probabilities, which leads to poor generalizability to uncertainty estimation for other tasks. Moreover, most of the literature require seeing the out- of-distribution (OOD) data the training for better estimation of uncertainty, which limits the uncertainty estimation performance in practice because the OOD data are typically unseen. To overcome these limitations, we propose new framework using data- adaptive high- dige-dimensional hypothesis testing for uncertainty estimation, which leverages the statistical properties of the feature representations. Our method directly operates latent representations and thus does not require retraining the feature encoder under a modified objective. The test statistic relaxes the feature distribution assumptions high dimensionality, and it is more discriminative uncertainties in the latent representations. We demonstrate that encoding features with Bayesian neural networks enhance testing performance and lead accurate uncertainty estimation. We further introduce a family-wise testing proce- dure to determine the optimal threshold of OOD detection, which minimizes the false discovery rate (FDR). Extensive experiments validate the satisfactory perfor- mance of our framework on uncertainty estimation and ass--spccific prediction over variety of competitors. The experiments on the OOD detection task also show sat- isfactory performance of our method when the OOD data are unseen in the training. Codes are available at wtthtts::/// thub. com HKU MedAI/ MedAI/bnn, uncertainty
"Corresponding Author
37th Conference on Neural Information Processing Systems (NcurIPS 2023).

---

Introduction
Deep neural networks (DNNs) have demonstrated state-of-the-ar (SOTA) performances on many
problem domains, such as computer vision 30 31, medical diagnosis 16 38 2], and recommen- dation systems [ 3]. Despite their successes, most of the existing DNN designs can only recognize in-distribution samples (i.e., samples from training distributions) but cannot measure the confidence level (i.e., the uncertainties) in the prediction, especially for out-of-distribun
(OOD) samples. Estimation of prediction uncertainties plays an important role in many machine learning applications For instance, uncertainty estimation can help to detect OOD) samples in the data and inspect
25 37]- anomalies in the system. Further, the uncertainty estimates indicate the distributional shifts in the environment and thus facilitate learning in non-stationary environment.
In response to the high demand, several attempts have been made to obtain better estimate of the uncertainty, which can be roughly divided into two categories - Bayesian and non-Bayesian methods. Bayesian methods 4 [9 mainly operate with a Bayesian neural network (BNN), which introduces a probability distribution (e.g., multivariate Gaussian) to the neural network weights. This enables the model to address model-wise (i.e., epistemic) uncertainty by drawing samples from the posterior distribution. Non-Bayesinn methods [32 10), on the other hand, assume a distribution on the model outputs (e.g., classification probabilities). The uncertainty scores can be obtained by evaluating a pre-determined metric (e.g.. classification entropy) on the derived distribution.
However, most of the aforementioned methods are subject to several drawbacks: (1) They rely on strong assumptions (e.g.. parametric models) on low-dimensional features and thus suffer from the curse of high dimensionality, leading to poor performance when the dimension of the ouiput is high. (2) They are limited to classification problems, and existing methods explicitly make assumptions about the classification probabilities. This leads to poor generalizability in uncertainty estimation for other tasks, such as regression and representation learning. (3) Their performances heavily rely upon the feature encoder, which can be compromised when the features are of poor quality (e.g., the number of samples used to train the encoder is small). (4) They require a modification of the training loss, and thus additional training is needed when applying the methods new problem. Pretrained features cannot be directly applied to the OOD tasks without retraining for their proposed loss.
Observing the above limitations, we propose new framework for uncertainty estimation. Our framework comprises two key components: one Bayesian deep learning encoding module and one uncertainty estimation module using the adaptable regularized Hotelling T (ARHT) (26). Our contributions are summarized as: (1) We formulate uncertainty estimation as a multiple high- dimensional hypothesis testing problem, and adopt a Bayesian deep learning module to better address the alcatoric and epistemic uncertainties when learning feature distributions. (2) We propose using the ARHT test statistic for measuring uncertainty and demonstrate the advantages of ARHT over the existing uncertainty measures, including its consistency and robustness properties. This enables us to design data-adaptive detection method so that each individual data point be assigned an optimal hyperparameter. Because it relaxes the strong assumptions on latent feature distributions, ARHT less sensitive the feature quality. As result, our method can be interpreted method as it works on feature distributions generated by any encoder (e.g., a pre-trained encoder). (3) We adopt the family-wise testing procedure determine the optimal threshold of OOD detection, which minimizes the false discovery rate (FDR). (4) We perform extensive experiments on standard and medical image datasets validate our method on OOD detection and image classification tasks compared to SOTA methods. Our proposed method does not require prior knowledge of the OOD data, while yields satisfactory performance even when the training samples are limited.
post-hoc
2 Preliminaries
Deep Neural Network: A deep neural network (DNN) with L layers can be defined as
1
f((:; Wi,
VD (Wid(fi-I(E;; W(-1,, + bi. LE (I....,,} L}.
where oi a nonlinearity activation function, x is the input, Dz-1 the dimension of the input, by E RD: is a vector of bias parameters for layer 1, and W, E RDD is the matrix of weight parameters. Let w; = (W1,b, b denote the weight and bias parameters of layer I, and the entire trainable network parameters are denoted as 0 = }
2

---

Bayesian neural network (BNN): A BNN specifies prior x(0) on the trainable parameters O. Given the dataset D (æ.; Vi s= of N pairs of observations and responses, aim to estimate the posterior distribution of 0, ( = x (0) ff, (z)):)))((D) where ff,, 0)) is the likelihood function and (D) is the normalization term.
Pooled Sample Covariance Matrix: Let [ be the p-dimensional embeddings from the training images and {X2y) 12 f=1 be the p-dimensional embeddings from the testing images. The pooled
sample covariance is defined
2 Rk
S,
Xaj
(x) Xx)
(1)
71
where n1 R2. ng is the sample size and X is the sample mean of the k-th set (A: 1,2).
High-Dimensional Test Statistics: The Hotelling 2 test statistic [5] is given by
n(n - p) p(n - (Xi - X2) ST' -X2).
T
The Hotelling 2 test assumes T ~ F p) under the null hypothesis. To resolve the potential singularity of the covariance matrix, the regularized Hotelling T (RHT) test statistic loads an identity matrix Ip to T,
RHT(A) = 71
(X,
(S, 'X X2),
(3)
n1 12
where À is tuning parameter. The ARHT test statistic, which will be formally introduced by Eq. in Section 3.3 standardizes the RHT and addresses the skewness of Hotelling's T when the feature dimension is high.
3 Methodology
Our uncertainty estimation framework comprises a Bayesian neural network encoder and an OOD testing module with ARHT the uncertainty measure. Provieee overview of our proposed framework, with the detailed algorithm given in the appendix. Ablation studies on key components of our framework are provided in Section 5
3.1 Problem Definition and Test Hypothesis
Suppose that we have a set of samples (J....,, Jn) !i,..., } containing both in-distribution and OOD data. We aim develop uncertainty es- timation framework that can accurately classify the test samples as either in-distribution or OOD, without seeing the OOD data during the training. Moreover, the framework can still perform well on its predictive task (e.g., classification) without sacrifice in uncertainty estimation. We set the null hypothesis Ho μn #2 and the alternative hypothesis mean representations of the training and the testing samples, respectively.
as the training set, and a set of testing samples
: 14 * 142, where μe and μ2 are the
3.2 Bayesian Neural Network as Encoder
We adopt a BNN encoder and train it with stochastic variational inference (SVI) 29 learn the representation of the input. In SVI, posterior distribution p(0ly) is approximated by a dis- tribution q selected from a candidate max Eg Beogglloo(((( [))] (L(gl(T). where KL((|IT)) is the Kullback-Lein Leibler divergence between the variational posterior distribution g and the prior distribution n, p(y 0) is the likelihood, and Ea~g (orrgllogp())) (8)] represents the learning objective. This can be supervised (e.g., cross- coos-entropy loss) or unsupervised (e.g., contrastive learning loss) learning. The KL. divergence of two multi-varial Gaussian distributions is provided in the appendix. We use gradient descent optimize the ELBO, ie., minimize the distance between prior and variational posterior distributions. We obtain the trained BNN encoder once the optimization step is completed. Since BNNs operate on ensemble
Q by maximizing an evidence lower bound (ELBO):
3

---

Training
BNN x(O)-N(0,1)
Training Data (In-distribution)
KL
ELBO
obi
Fixed after training
Back-propagate
Testing
Testing data
In-distribution Embeddings
In-distribution
1
OOD Detection
ARHT
BNN Encoder
Distr.
Testing Embeddings
Σ
0OD
OOD
Figure 1: Workflow of our proposed uncertainty estimation framework. Our framework contains BNN encoding module and an uncertainty estimation module using high-dimensional testing. The training objective Labj be either supervised (e.g., cross-entropy) or unsupervised (e.g., contrastive learning). The ELBO represents the evidence lower bound used for training BNN.
of posterior model weights, they can capture the epistemic uncertainties in the posterior predictive distribution p (Dy)D). Hence, using BNNs instead of frequentist architectures can better approximate the posterior distribution of the feature embeddings.
To obtain the uncertainty scores, need to compute the sample means X1, X₂ and covariance matrices E, Σg for the training data (containing in-distribution data only) and the testing data (containing both in-distribution and OOD data). First, sample weights for every data point in the training data, and generate representations for each data point using the sampled weights. In total, n, representations are generated from the training data. We can compute the mean X and covariance matrix Ej of the training data using these n1 representations. For each testing data point 2t, we sample n2 weights from the variational posterior distribution, and generate n2 representations (Æe, = fz 0,) 0 where 0, is the j-th weight sample drawn from the trained posterior distribution D). We obtain the mean X₂ Σド1 Bij/n2 and the covariance matrix Σg th (Eng ( X²)T/ma /n2. Hence, we can compute the pooled covariance matrix S,
by Eq.
3.3 ligh-DDimesiioal Testing Uncertainty Measure
With the pooled sample covariance matrix, we can compute the ARHT test statistics by Eq. (3) and Eq. (4), where X, is the mean of training samples and X₂ is the mean of n2 embeddings of each testing sample. To solve the skew E distribution of RHT when n >>> for large n and (as shown in Figure we adopt the ARHT statistic to perform a two-sample of the covariance matrix (26 In particular, the ARHT is given by
which has robust regularization
ARHT(A)= vD" 'RHT(A) (A,))
(2,
where (1,))) Amr (mmF(-))3/L) 7(1 >mmF(-A)),,
@z(A,7) 1 1 \mF(-1)
2 m=(-A) (-1)
711 Amr(-A))
71 Amm((-A))
mp(2) = irr (x){, - -1r (2)) Rx(2) = -Sn -I,)
p
As a result, we have ARHT(A) ~ A0 26). which prevents the catastrophic skewness of F. distribution in high dimensions (see Figure 2 and yields smoother uncertainty scores. The ARHT can

---

Table 1: The OOD detection performance (in %) of our method, BNN-ARHT, compared to various
competitors, using the LeNet 22 architecture. Standard deviations are given in brackets.
OOD Datasets
Fashion-MNIST
MNIST
OMNIGLOT
SVHN
Model
In-Distrib.
AUC
AUPR
AUC
AUPR
AUC
AUPR
MC Dropout 10
MNIST
99.33 (0.3)
(0.3)
99.85 (0X11)
99.88 (0.07)
99.96 (0.007)
99.96 (0.0022
Deep Ensembles
21
MNIST
(8.40
91.08
99.70
91.08 (7.7)
99.21 (0.9)
99.68 (0.4)
Keudall and Gal
19
MNIST
92.64
92.77 (1.9)
94.11
93.40 (5.7)
99.60 (0.5)
99.13 (1.0)
EDL
32
MNIST
73.43 (16.0)
80.22
72.61 (8.6)
81.42 (7.0)
63.43 (1.2)
85.09 (3.4)
DPN
MNIST
99.41 (0.2)
09.37(0.3)
99.96 (0.03)
99.96 (0.03)
99.96 (0.01)
99.96 (0.003)
PostNet [4]
MNIST
98.59 (0.4)
94.70 (0.5)
Detectron 12]
MNIST
75.57 (15.2)
83.75 (29.9)
95.71 (11.0)
85.00 (30.0)
77.92 (12.4)
83.75 (37.3)
BNN-ARHT (Ours)
MNIST
99.51 (0.4)
(0.3)
(0.01)
(0.044)
99.97 (0.007)
99.96 (0.004)
MC Dropout 10
CIFARTO
74.21 (5.23((566
(2.15(222)
(1.9
78.09
84.35 (1.1)
Deep Ensembles 21
CIBARIO
71.25 (3.0)
75.32 (2.3)
86.77 (3.6)
90.35 (3.1)
76.15 (5.3)
82.62 (13.1)
Kendall and
CIFARIO
77,41 (17.3)
77.00 (18.2)
89.08 (17.8)
90.93 (14.8)
67.40
(10.1)
E.D.
52
CIFARIO
67.81 (12.1)
71.81 (11.5)
77.53 (14.4)
80,50 (11.7)
69.57 (4.7)
83.74 (3.4)
DPN
27
CIFARIO
(1.74
68.29 (3.4)
62.34 (3.7)
70.49 (8.0)
$7.48 (4.4)
77.76 (6.2)
PostNet
CIFARIO
76.04
69.30
Detectron 1
CIFARIO
76.46 (15.3)
71.63 (21.5)
76.99 (15.9)
91.00 (24.4)
76.01 (13.6)
90.00 (22.9)
BNN-ARHT (Ours)
CIFARIO
77.78 (5.0)
79.06 (6.8)
92.77 (1.8)
93.74 (1.0)
82.01 (1.2)
91.61 (0.3)
be interpreted more robust distance measure on embedding distributions compared to existing metrics such as Mahalanobis distance.
We select À from predefined set using data-adaptive method 26 The set for grid search is chosen as {Aa, 5 10Ao} given the hyperparameter An- For a testing data point 2t, we compute
for each À in the candidate set, where & = E1. (2) E I2 is pre-specified weight vector set as & = (0, 1, 0), 7o(-A,7) = m 0i(-), (A,,), and (²))
Q(), 7: E)
Ex=o (xpx(-X)
-pi (-X,, The optimal is then selected by maximizing the Q function, i.e., arg max Q(), 7: E). For each testing data point, can proceed with the above selection process to determine the optimal À for the individual input. This makes the determination of uncertainty scores more flexible and data-adaptive.
3.4 Optimal Threshold Adjusting for Pamily-Wisse Discovery Error
We obtain the area under the receiver operating characteristic curve (AUROC) and the area under the precision-recall curve (AUPR) using different thresholds. To determine the optimal threshold, we adopt a family-wise testing procedure to compute the p-values. It is necessary
balance the tradeoff between the power and the type I error rate of the test. We adopt the Benjamini-Hochberg (BH) proce- dure (35] procedure to adjust for multiple tests. The threshold of p-values is calibrated by the BH procedure, and we have a rejection set A of in- dices to the samples whose y-values are below the threshold, f = {i E I Di S (k/(m))))) } p. S ak(mHHm)..
HRAL
0.8
5-
0.4
0.2
where = max (k E
0.0
I= (1...., m] the set of indices correspond- ing to the m tests, and Hm = - 1/j. The samples in the rejection set are then classified as the OOD sample. The BH procedure is shown achieve more powerful hypothesis testing perfor- mance B
Figure 2: Comparison of the density functions of N 1) and F-distribution under low (left) and high (right) dimensions.
4 Experiments
4.1 Datasets and Experiment Setting
We design OOD detection tasks on both standard and medical image datasets to demonstrate the application of our framework. We also evaluate our framework on the image classification
5

---

Table 2: The OOD detection performance (in %)
Table 3: Classification performance (in %)
on DRD [8). with the LeNet [22] architecture.
on MNIST, with the LeNet [22] architecture.
Model
AUROC
AUPR
Model
Accuracy
F-1 Score
MC Dropout [10
(1.1)
60.95 (6.0)
MC Dropout [10
98.48
98.89
Kendall and Gal 19
91.06 (9.8)
92.71 (7.8)
Kendall and Gal 19
98.78
98.65
Deep Ensembles [1
59.67 (1.3)
56.58 (2.3)
Deep Ensembles 21
97.90
97.89
DPN
27
60.57 (1.1)
65.32 (1.3)
DPN [27
98.89
98.83
EDL
32
53.01 (1.9)
58.22 (9.6)
EDL [32
21.24
12.88
Detectron
12
90.74 (9.9)
46.00 (31.4)
PostNet 44
99.12
99.06
BNN-ARHT (Ours)
93.44
95.44 (2.2)
BNN-ARHT (Ours)
99.26
99.06
task in comparison with the baseline methods to show that framework does not sacrifice classification performance. For the image classification task, we benchmark the classification performance of the encoder trained on holdout set of the in-distribution dataset (i.e., MNIST). For the OOD detection task, we treat CIFAR 10 and MNIST as the in-distribution datasets, and Bushion-MNIS OMNIGLOT, and SVHN as the OOD datasets. To validate the advantage of BNN encoding on limited observations, we compose a medical image benchmark using samples from the Diabetes Retinopathy Detection (DRD) dataset (8), with samples shown in Figure We treat healthy samples as in-distribution data and unhealthy samples as OOD data. Distinct from the settings in some existing works [27] which include OOD data in the training, we exclude the OOD data when training the feature encoder. We use the AUROC and AUPR as the evaluation metrics for OOD detection tasks, and adopt accuracy and the macro F1 -s-oe to evaluate the classification performance. Detailed definitions of the evaluation metrics and further descriptions of the datasets can be found in the appendix.
Figure 3: Healthy (left) and unhealthy (right)
samples of the DRD dataset.
4.2 Competitive Methods
We compare our proposed framework, named as BNN-ARHT, with seven competitors (1) Deep ensembles [21] an ensemble of neural networks to address the epistemic uncertainties, and the number of models in the ensemble is set as 5; (2) MC Dropout [0]] a non- -anaasssi method using dropout on trained weights to produce Monte Carlo weight samples 27 (3) Kendall and Gal 19] the first work addressing the aleatoric and epistemic uncertainties deep learning: (4) EDL it estimates uncertainty by collecting evidence from outputs of neural network classifiers by assuming a Dirichlet distribution on the class probabilities; (5) DPN [27]] it assumes a prior network with Dirichlet distributions on the classification outputs; (6) PostNet [4] it uses normalizing flow to predict an individual closed-form posterior distribution over predicted class probabilities; (7) Detectron [12] it detects the change in distribution with the discordance between an ensemble of classifiers trained to agree on training data and disagree on testing data. Since Detectron operates on small samples from each dataset for OOD detection (e.g.. 50 over 60,000 for CIFAR 10), we use larger number of runs (i.e., 100) for a fair comparison. Five-fold cross-validatio is applied to each of the competitive methods. We report the means and standard deviations over the runs for each metric.
32
4.3 Predictive and Uncertainty Estimation Performance
Verify Uncertainty Quality by OOD Detection. Tables and 2 present the OOD detection results of our method compared with competitors on different pairs of datasets. We observe that existing methods, which assume having seen OOD data in the training, perform poorly in our settings, especially when the training observations are limited. Detectron [12] yields larger standard errors than other methods since it operates on small samples of the datasets. This validates the argument that existing methods heavily rely upon the availability of OOD data during the training. We also observe that our framework outperforms all the baselines on almost all OOD detection tasks, which demonstrates its satisfactory performance. In particular, our method shows great improvement on the DRD dataset in which the number of samples small, indicating the advantage of using a BNN encoder. As the MNIST dataset has dense feature representations, the OOD features can be easily distinguished. Hence, the OOD performance of the methods relatively better on MNIST than on CIFAR10.

---

Table 4: The OOD detection performance (in %) of competitive methods under various model architectures 20 14.. CNN refers to the two-layer standard CNN architecture used by MMlmmin and Gales 27). We use CIFARIO as the in-distribution dataset and SVHN as the OOD dataset. 'Freq" represents the frequentist architecture and 'Bayes' represents the Bayesian architecture.
CNN
LeNet
AlexNet
ResNet
of parameters (Freq)
31,340
62,006
2,472,266
11,699,522
of parameters (Bayes)
62,700
125,112
4,922,120
12,372,900
Model
AUROC
AUPR
AUROC
AUPR
AUROC
AUPR
AUROC
AUPR
MC Dropout [00
63,85
74.79
68.58
78.53
74.72
82.57
61.46
76.04
Deep Ensembles 21
78.44
89.10
61.01
62.69
72.14
59.83
58.11
78.26
Kendall and Gal
67.77
80.87
55.36
69.82
70.88
73.15
50.01
83.86
EDL [32
65.26
67.07
66.53
67.12
65.81
61.68
51.34
73.50
DPN
227
63.98
77.30
57.44
73.84
80.75
76.36
86.46
PostNet
73.68
66.85
76.04
69.30
81.67
76.52
82.19
79.43
Detectron
73.84
88.50
76.01
90.00
80.58
85.00
78.27
89.50
BNN-ARHT (Ours)
85.36
89.37
82.01
91.61
82.10
70.04
88.16
93.19
Predictive Performance Is Preserved. As shown in Table we also perform image classification to demonstrate the benefits of the post-hoc method (i.e., without modifying the original objective). We fix the neural network architecture as LeNet. For Kendall and Gal [9] and our method, we use the Bayesian counterpart of LeNet perform the experiment. We observe that without modifying the original learning objective, the predictive performance of the encoder can be preserved and outperforms other methods. The BNN may underperform its frequentist counterpart due to the introduction of the KI. regularization. Hence, in practice, a (pre-trained) frequentist encoder can be used replace the BNN encoder if predictive performance is the focus. Section 5 shows the sacrifice in the OOD detection performance if frequentist architecture is used.
Visualization of Uncertainty Scores. To better understand the uncertainty scores of in- distribution and OOD data under different uncertainty measures, Figure 4 presents the dis- tributions of the ARHT uncertainty scores of in-distribution data (MNIST) and OOD data (FNSh)on-MNIST), respectively. We observe that the distributions of ARHT are of dif- ferent shapes for in-distribution data and OOD data. This demonstrates the effective- ness of ARHT in identifying the unique characteristies of the distributions of the datasets.
5 Ablation Studies
Different Neural Network Architectures. We com- pare the performance with encoders under different architectures. We choose the standard CNN used in
1259
Malinin and Gales 27 LeNet [22), Alexnet [20). and ResNet18 [14] the SOTA examples in encod- ing image features. For ResNet18, as the variance increases drastically with the increasing depth of the architecture, it is not feasible to replace all the lay- with their Bayesian counterparts. Therefore, we replace only the last fully-connected layer and the second last convolutional layer with their Bayesian versions. Table / presents the comparison of OOD detection of our method with the competitors under different neural network architectures. We observe that our method is able to obtain satisfactory performance over the competitors when the neural network architecture changes.
Figure 4: Distributions of the ARHT certainty scores for the in-distribution data (MNIST) and OOD data (Fashion-MNISTT, respectively.
Effects of Key Hyperparameters. We evaluate our method with range of hyperparameters to assess their impacts on our method. Prrseets the OOD detection performance with different values of λg. R2, and p. (1) Initial loading value Ag: we observe that the performance of our model is robust to changes Ag- Since the ARHT relaxes the Gaussian assumption of embeddings, the change in the magnitude of the loading matrix would not heavily affect the covariance structure of the testing embeddings. Hence we can safely load À to the covariance matrix to resolve the singularity problem, with concern about the decrease in performance; (2) Number of training weight samples n1:

---

Purformance by 2
Performance
0.998
0.9
1.00
0.996
0.8
0.992
0.7
0.99
0.6
0.988
1.04
0.982
698
0.98
#AAX3CC
Figure 5: Performance of our method with different values of Ao (left), n2 (middle), and p (right) by fixing the network architecture as LeNet [22]. We use MNIST as the in-distribution dataset and Mushion-MNISH as the OOD dataset.
The size n is controlled by the hyperparameter in our framework. We have conducted experiments with ranging from to 5 (Figure 6). The pattern shows that the performance decreases when increases (i.c., more embedding samples from the in-distribution dataset). This demonstrates that the covariance structure affects ARHT more increases, and the contribution of testing embeddings is less weighed, which leads to slightly decreasing performance. (3) Number testing weight samples nz: The number of testing weight samples n2 is key to approximate the testing embedding distribu- tions. Since the approximation
the testing distribution is crucial to the performance our method, tune the syper-parameter n2 determine the optimal number of testing embeddings to choose for each task. We observe that even if the number of testing samples is small (e.g.. 5), ARHT can still cap- ture the distributional difference between the in-distribution and OOD data. This leads consistent performance as n2 varies. (4) Embedding dimension pt mance of our method with respect to the change in embedding dimensions (p 8, 16, 32, 64, 128). We observe that our method is robust to changes in feature dimensions. This enables our framework perform OOD detection on the representation level with customized embedding dimensions, relaxing the constraint on classification problems.
we also evaluate the OOD detection perfor-
Performence by
100
Feature Learning Objectives. One key component of our framework is the BNN encoder, which is trained by supervision (i.e., cross-entropy loss for image classification) on standard datasets. We eval- uate the robustness of our method when the encoder is trained with different objectives (i.e., unsupervised contrastive learning loss). We select the margin of contrastive learning loss as 0.2. The performance in AUROC on the OOD detection task decreases slightly from 99.98 to 98.42 (for MNIST vs. OMNIGLOT OOD detection). This shows that our framework is sensitive to the quality of the encoder, and supervised learning objective is preferred to improve the encoding performance.
AUGROC
Figure 6: Ablation study with respect to s
(In-distribution: CIFAR 10, OOD: SVHN).
Discussion: Impacts and Limitations of BNN and ARHT
discuss why a BNN encoder is preferred for our framework, with Figure 7 illustrating the difference between features generated by BNN and frequentist DNN. A frequentist DNN gives one feature embedding to every input data point, and the uncertainty estimate ignores the covariance structure of the distribution because only the point estimate is provided. However, BNN estimates the posterior embedding distribution for every data point, and the covariance structure can be incorporated to obtain a more accurate uncertainty estimate. Although some recent non-Bayesian method 32 27 places parametric distributions on posterior embeddings (e.g.. Dirichlet distribution class probabilities), these parametric distributions are less accurate in approximating the posterior distributions than BNNs because the strong parametric assumption limits their capabilities searching the candidate distributions.
To demonstrate why ARHT preferred as an uncertainty metric, we further evaluate its perfor- mance over array of uncertainty measures, including the maximum probability, entropy, and

---

differential entropy proposed by Malinin and Gales 27 Detailed definitions of these metrics are presented in the appendix. We also include the frequently used Mahalanobis distance which possesses stronger assumptions on the Gaussianity of the embeddings. We fix the model architec- ture to be LeNet and compare its Bayesian and frequentist designs. of the comparison. We observe that using ARHT as the uncertainty score can achieve the best OOD detection performance than existing uncertainty measures when a BNN encoder is used. Our method achieves better perfor- mance using features generated by BNNs than those generated by frequen- tist counterparts, which demonstrates the advantage of using Bayesian coders in our framework. However, BNN encoders require drawing n2 sam- ples of weights for posterior inference, which requires higher time complexity than the frequentist counterparts. Fur- ther, BNNs are limited by the scalability constraints [T] which makes them dif- ficult to have deeper structures. How make BNNs deep remains a challenging topic 7 29).
the summary
Uncertainty
ONN Featur
Festure di Buston
Samples (ry ONN/EARU
RAIN Ponterier Predictiv
Marvell
Samplie
Semppie
Figure 7: Comparison of features generated by frequen- tist DNN and those by BNN. The uncertainty estimated by a frequentist DNN ignores the covariance structure of the posterior distribution, where BNN provides distri- butional estimate for each testing sample.
Support of Single-Sample Uneer- tainty. As the training set (as the in- distribution set) is available (at least for training or fine-tuning the encoder) in most of the problems, one can use samples from training sets and the testing samples to compute ARHT. One exception is the zero-shot case where we only have the pre-trained encoder but no original data (i.e., in-distribution samples). In this case, most of the uncertainty estimation methods cannot work since they require at least in nn-distribution data to fit their parametric assumptions (e.g., concentration rates of the Dirichlet distributions in classification problems). However, one may still obtain ARHT as an uncertainty estimate using methods to recon- struct/generrat pseudo-training data from the pre-trainee models, which is not the focus of our work but warrants future research.
7 Related Works
Uncertainty Estimation. Estimating uncertainty in neural networks has become an increas- ingly important topic in deep learning. Existing uncertainty estimation methods can be di- vided into two classes: Bayesian methods [19 23] and non-Bayesian methods [32] 27 2T 4 9 [0]. Bayesian methods address the model-wise (i.e., epistemic) uncertainties by learn- ing a posterior distribution of weights. The uncertainties neural networks can be ap- proximated by the predictions given by the weights sampled from the posterior distributions. Despite the success of these methods, most works only focus on classification uncertainties and rely upon arbitrary distributional assumptions on the class probabílities. For instance, DPN [27] as- sumes that the classification probabilities follow a Dirichlet distribution and train the OOD detector based on the KL divergence of the prior and pos- terior Dirichlet distributions. These methods are not generalizable to tasks other than classification. Furthermore, most existing methods [32 27 10
Table 5: Performance of the ARHT against other uncertainty measures, with the LeNet 22 archi- tecture, the in-distribution dataset CIFARIO, and the OOD dataset SVHN.
Frequentist
Bayesian
Model
AUROC
AUPR
AUROC
AUPR
Maximum
77.50
64.69
81.30
83.11
Prubability
Entropy
80.22
88.47
82.49
78.14
Differental
assume that the samples from the target domain are available when training the OOD detector, which is unrealistic in most applications.
Entropy
79.59
86.98
66.15
75.27
RHT
79.06
62.82
82.29
64.07
ARUT
79.07
63,44
82.64
91.69
Hypothesis Testing in High Dimension. The task of uncertainty estimation can be redefined as a high-dimensional hypothesis testing problem. We report the detection of OOD samples if we
reject the null hypothesis at significance level a. The Hotelling T22 test [5 18] Eq. 2 assumes T ~ F(P, n p) under the null hypothesis. The unnormalized version of T in Eq. is known

---

as Mahalanobis distance. However, the Hotelling test statistic suffers from poor robustness and consistency when and p are large and even becomes undefined when p n or when S,, is singular [26] This results in all test statistics (as uncertainty scores) concentrating on the singular point leading to trivial estimation of uncertainties. Figure 2 presents an example of comparisons of F(10, 10) and F(1000, 1000) to (0, 1). Chen et al. [ attempt to overcome this issue by proposing the RHT statistic, which resolves the singularity issue of the covariance matrix but yet the inconsistency and
poor performance of Hotelling's s 7 statistic under the regime p/n 7. Li et al. adaptable RHT and design an adaptive selection procedure for the loading parameter based on the work of Chen et al. [5], which resolves the inconsistency of Hotelling's T
[26] propose
demonstrate significant success in tasks from different domains. Their designs enable them to mine high-dimensional features into low-dimensional representations and address the aleatoric uncertainties. Despite the success, the DNNs typically only yield maximum likelihood estimates of weights under the frequentist framework and cannot address epistemic uncertainties [9]. Existing works of BNN assign prior distributions to the neural network weights so to obtain the posterior distributions of weights given the observed data [36 11 29 17 This enables BNN to provide a more accurate approximation to the target distribution and address epistemic uncertainties. Particularly when the training observations limited, using a BNN can prevent overfitting and generate more representative feature distributions.
Bayesian Deep Learning. SOTA DNN architectures 33 14
8 Conclusion
We propose novel uncertainty estimation framework by introducing high-dimensional hypothesis lesting to feature representations. We introduce the ARHT as the uncertainty measure which is adaptable individual data point and robust compared to existing uncertainty measures. Our proposed uncertainty measure operates on latent features and hence can be generalized to any other tasks beyond image classification (e.g., regression or feature representation learning). Empirical evaluations on OOD detection and image classification tasks validate the satisfactory performance of our method over the SOTAs. Ablation studies on key components of the proposed framework validate the robustness and generalizability of our method to variations. One of the best potential applications of our framework is continual learning, where the proposed method can accurately measure the uncertainty as the domain shifts when encountering -ta-istato environments. Our framework can be potentially applied to various settings where distributional shifts and OOD detection are vital, such medical imaging, computational histopathology, and reinforcement learning.
Acknowledgement. We thank the anonymous reviewers, the area chair, and the program chair for their insightful comments on our manuscript. This work was partially supported by the Research Grants Council of Hong Kong (17308321), the Theme-based Research Scheme (T45-401/22-N), and the National Natural Science Fund (62201483).
References
[1] Xuheng Cai,, Chao Huang, Lianghao Xia, and Xubin Ren. Lightgel: Simple yet effective graph contrastive learning for recommendation. In The Eleventh International Conference on Learning Representations, 2023.
[2] Tsai Hor Chan, Fernando Julio Cendra, Lan Ma, Guosheng Yin, and Lequan Yu. Histopathology whole slide image analysis with heterogeneous graph representation learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2023.
[3] Tsai Hor Chan, Chi Ho Wong, Jiajun Shen, and Guosheng Yin. Source-aware embedding training on heterogeneous information networks. Data Intelligence, pages 1-14, 2023.
[4] Bertrand Charpentier, Daniel Zügner, and Stephan Günnemann. Posterior network: Uncer- tainty estimation without ood samples via density-basee pseudo-counts. Advances in Neural Information Processing Systems, 33: 1356-1367, 2020.
[5] Lin S Chen, Debashis Paul, Ross I. Prentice, and Pei Wang. A regularized hotelling's 's 2 test for pathway analysis in proteomic studies. Journal of the American Statistical Association, 106 (496):1345-136)) 2011.
10

---

[6] Danruo Deng, Guangyong Chen, Yang Yu, Furui Liu, and Pheng-Am Ann Heng. Uncertainty esti- mation by fisher information-basse evidential deep learning, arXiv preprint arXiv:2303.0204. 30..000455. 2023.
[7] Michael Dusenberry, Ghassen Jerfel, Yeming Wen, Yian Ma, Jasper Snoek, Katherine Heller, Balaji Lakshminarayanan, and Dustin Tran. Efficient and scalable bayesian neural nets with rank-1 1 factors. In International conference machine learning, pages 2782-2792 PMLR, 2020.
[8] Angelos Filos, Sebastian Farquhar, Aidan N Gomez, Tim GJ Rudner, Zachary Kenton, Lewis Smith, Milad Alizadeh, Arnoud de Kroon, and Yarin Gal. A systematic comparison of bayesian deep learning robustness in diabetic retinopathy tasks, arXiv preprint 1912. 2019.
[9] Vincent Fortuin, Adrià Garriga-Alonse Florian Wenzel, Gunnar Rätsch, Richard E Turner, Mark van der Wilk, and Laurence Aitchison. Bayesian neural network priors revisited. s.l., 2020-12-12. NeurIPS, 1st I Can't Believe It's Not Better Workshop (ICBINB@ NeurIPS 2020); Conference Location: Online; Conference Date: December 12, 2020; Conference lecture on 12 December 2020.
[10] Yarin Gal and Zoubin Ghahramani. Dropout bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pages 1050-1059. PMLR, 2016.
[11] Soumya Ghosh, Jiayu Yao, and Finale Doshi-Velez. Model selection in bayesian neural networks via horseshoe priors. J. Mach. Learn. Res., 20(182): 2019.
[12] Tom Ginsberg, Zhongyuan Liang, and Rahul G Krishnan. A learning based hypothesis test for harmful covariate shift. arXiv preprint arXiv:2212.02742, 2022.
[13] Christophe Giraud. Introduction to high-dimensional statistics. CRC Press, 2021.
[14] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and paltern recognition, pages 770-778, 2016.
[15] Harold Hotelling. The generalization of student's ratio. In Breakthroughs in statistics, pages 54 65. Springer, 1992.
[16] Maximilian Ilse, Jakub Tomezak, and Max Welling. Attention-basede deep multiple instance learning. In International conference machine learning, pages 2127-2136. PMLR, 2018.
[17] Laurent Valentin Jospin. Hands-on bayesian neural networks-a tutorial for deep learning users. 2020.
[18] Tapas Kanungo and Robert M Haralick. Multivariate hypothesis testing for gaussian data: Theory and software. Technical Report ISL. Tech. Report: ISL--R-95-005 1995.
[19] Alex Kendall and Yarin Gal. What uncertainties do we need in bayesian deep learning for computer vision? Advances in neural information processing systems, 30, 2017.
[20] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
[21] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. Advances in neural information processing systems, 30, 2017.
[22] Yann LeCun, Bernhard Boser, John Denker, Donnie Henderson, Richard Howard, Wayne Hubbard, and Lawrence Jackel. Handwritten digit recognition with back-propagation network. Advances in neural information processing systems, 2, 1989.
[23] Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. Training confidence-calibraaed classi- fiers for detecting ooitt---istii samples. In 6th International Conference on Learning Representations, ICLR 2018, 2018.

---

[24] Bin Li, Yin Li, and Kevin W Eliceiri. Dual-stream multiple instance learning network for whole slide image classification with self-supervised contrastive learning. In Proceedings of the IEEF/CVF conference computer vision and pattern recognition, pages 14318-14328, 2021.
[25] Chun-Liang Li, Kihyuk Sohn, Jinsung Yoon, and Tomas Pfister. Cutpaste: Self-supervised learning for anomaly detection and localization. In Proceedings of the IEEE/CVE Conference on Computer Vision and Pattern Recognition, pages 9664-9674, 2021.
[26] Haoran Li, Alexander Aue, Debashis Paul, Jie Peng, and Pei Wang. An adaptable generalization of hotelling's 's test in high dimension. The Annals of Statistics, 48(3):1815-184) 2020.
[27] Andrey Malinin and Mark Gales. Predictive uncertainty estimation via prior networks. Advances in neural information processing systems, 31, 2018.
[28] Andrey Malinin and Mark Gales. Reverse kl-divergence training of prior networks: Improved uncertainty and adversarial robustness. Advances in Neural Information Processing Systems, 32, 2019.
[29] Eric Thomas Nalisnick. On priors for Bayesian neural networks. University of California, Irvine, 2018
[30] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652-660, 2017.
[31] Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. Advances in neural information processing systems, 30, 2017.
[32] Murat Sensoy, Lance Kaplan, and Melih Kandemir. Evidential deep learning to quantify classification uncertainty. Advances in neural information processing systems, 31, 2018
[33] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguclov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEFE conference computer vision and pattern recognition, pages 1-9, 2015.
[34] Mingxing Tan and Quoc Lc. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pages 6105-6114. PMLR, 2019.
[35] David Thissen, Lynne Steinberg, and Daniel Kuang. Quick and easy implementation of the benjamini- hochhergg procedure for controlling the false positive rate in multiple comparisons. Journal of educational and behavioral statistics, 27(1))77-83, 2002.
[36] Ba-Hien Tran, Simone Rossi, Dimitrios Milios, and Maurizio Filippone. All you need is a good functional prior for bayesian deep learning. Journal of Machine Learning Research. 23(74): 1-56, 2022.
[37] Shenzhi Wang, Liwei Wu, Lei Cui, and Yujun Shen. Glancing at the patch: Anomaly localization with global and local feature comparison. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 254-263, 2021.
[38] Shujun Wang, Yaxi Zhu, Lequan Yu, Hao Chen, Huangjing Lin, Xiangbo Wan, Xinjuan Fan, and Pheng-Am Heng. Rmdl: Recalibrated image classification. Medical image analysis, 58:101549, 2019.
deep learning for whole slide gastric
12

---

Overview. In the appendix, we first provide more explanations on the ARHT test statistic in Section We then present detailed summary of the datasets in Section Additional experiment results and analysis are reported in Section Detailed descriptions of distributions used for BNN training are provided in Section D We further present the implementation settings, hyperparameters and settings of baseline methods in Section E We give the definitions of uncertainty measures used for comparison Section F together with an algorithm of our framework (Algorithm I
A Additional Discussion on ARHT
Why using ARHT? One of our motivations is to formulate uncertainty estimation as a hypothesis lesting problem, where we interpret high-dimensional test statistics as distance measures. The ARHT can viewed distance measure between each testing sample and the mn-distribution sample, where a larger ARHT indicates the sample is more likely to be OOD. The detection of OOD is then determined by threshold, while the optimal threshold can be obtained by the Benjamini-Hochberg (BH) procedure. One advantage of ARHT is that it directly operates on the sampling distributions of the latent features, and hence does not require parametric assumptions on the latent features or logits (e.g., assuming a Dirichlet distribution on class probabilities), which makes it more robust metric for uncertainty estimation.
Motivation of loading App: This is a standard way to ensure the covariance matrix to be positive definite (and thus invertible) and hence improve the numerical stability.
Why does ARHT follow the standard normal distribution? prove why ARHT(A) follows the standard Gaussian distribution. The proof is complex and hence is not focused this paper. Intuitively, (RHT(A) can be viewed as "standardized" version of RHT (i.e., known Mahalanobis distance) by its theoretical mean and SD, for which the derivations detailed Li et al. 26
The major part of et al. 22 is to
Intuitive explanation and detailed derivation of the BH procedure: Although the BH procedure may not be intuitive to the general audience, is well-known the statistics community due to multiple testing issues. Intuitively, we consider the OOD detection procedure for each testing image as hypothesis testing problem. Then, such a procedure for whole testing set can be viewed as multiple-testing problem (i.e., conducting large number of tests). However, applying universal threshold for all tests (e.g., a = 0.05) is too conservative and leads to many false discoveries. Hence, the BH procedure is applied to assign threshold adaptable to each sample according to the p-values of all tests such that the false discovery rate (FDR) can be minimized.
B Additional Information on Datasets
Table summary of the datasets used for the experiments. We use eight image datasets to evaluate our method, including natural images and medical images.
Table 6: Summary of datasets, including the number of classes for classification, and the split of training and testing sets.
Dataset
No. Classes
No. Training
No. Testing
MNIST
10
60,000
10,000
Fashion-MNIITT
60,000
10,000
OMNIGLOT
50
13,180
19,280
SVHN
10
73,257
26,032
CIFAR-10
10
60,000
10,000
CIFAR-100
100
60,000
10,000
TinyImageNet
200
80,000
20,000
DRD
50
100
Diabetes Retinopathy Detection (DRD). For this experiment, we define in-distribution samples as healthy (no DR; with label 0), and OOD samples as DR (mild, moderate, severe, or proliferative DR; corresponding to labels 1-4). We select 50 healthy images to train the encoder, and compute μn and
13

---

E1 from these samples using the trained encoder. For testing. we select 50 images as in in-distribution data and 50 images the OOD data. All images are resized 64 for computational convenience. We train the encoder with a task to classify whether the input image is the left eye or right eye. The examples of healthy and DR are presented in Figure X
Healthy samples, y
(b) Unhealthy samples, y = 1.
Figure 8: Health and unhealthy (DR) samples from the Diabetes Retinopathy Detection (DRD) dataset (
C Additional Experiment Results
We first present the OOD detection results on more realistic dataset (i.e., TinylmageNet), with more realistic architecture (e.g., ResNe(50), We also include more baseline methods for comparison. Additionally, to study the effect of the encoder quality OOD detection performance, we use the training accuracy different epochs to measure the quality of the encoder, and assess how the OOD detection performance changes accordingly.
C.1 More Realistic Datasets.
We have conducted additional experiments on OOD detection, with CIFAR10 as the in in-distribution dataset and TinylmageNet as the OOD dataset. The results are presented Tables a 8 which show that the uncertainty estimation still performs satisfactorily when being generalized to larger datasets.
Table The OOD detection performance (in %) our method, BNN-ARHT, compared to various competitors, using the LeNet (22) architecture. We use CIFAR 10 as the in-distribution dataset and TinyImageNet as the OOD dataset.
Model
AUC
AUPR
MC Dropout [10]
66.98
64.46
Deep Ensembles 21
66.41
63.97
Kendall and Gal 19
63.23
63.06
EDL 32
51.64
66.31
DPN [27]
61.68
58.33
BNN-ARHT (Ours)
67.77
66.74
C.2 Scalability
aim use the Bayesian counterpart of a smaller architecture to demonstrate the capability of BNNs to generate latent feature distributions (for details see the discussion section in the main text). One can generate ideal feature distributions using very large frequentist vision models (e.g., ViT), which however induces enormous complexity in training and inference.
14

---

Table 8: The OOD detection performance (in %) of our method, BNN-ARHT, compared with various competitors, using the LeNet [22] architecture. We use TinyImageNet as the in in-istribution dataset and CIFARIO as the OOD dataset.
Model
AUC
AUPR
MC Dropout 10
64.36
60.47
Deep Ensembles 21
66.41
63.97
Kendall and Gal
19
58.54
55.29
EDL 132
50.37
70.39
DPN 27
59.59
59.87
BNN-ARHT (Ours)
69.27
71.54
Table 9: The OOD detection performance (in %) of our method, BNN-ARHT, compared with various
competitors, using the ResNet50 architecture. use CIFAR as the in-distribution dataset and SVHN the OOD dataset.
Model
AUC
AUPR
MC Dropout (10)
68.32
78.24
Deep Ensembles
65.13
82.19
Kendall and Gal 19
72.24
81.43
EDL
32
51.21
73.78
DPN
27
62.33
79.11
Detectron 12
73.16
82.5
BNN-ARHT (Ours)
73.46
78.27
A related ablation experiment comparing the frequentist and Bayesian architecture is presented in the main text. We additionally conduct an experiment with the Bayesian model architecture scaled up to ResNet50. We further conduct experiment using the frequentist ResNet50 (the hypothesis test reduces to a one-sample test) and the testing AUROC is 72.77. These results validate the scalability of our method large and modern vision architectures.
C.3 Encoder Quality
To assess the effect of the encoder quality, we fix the encoder (e.g.. LeNet) when comparing our framework with the current SOTA methods. Since the baseline methods are trained on classification problems (e.g., the CIFAR 10 image classification and DRD auxiliary task), we use the training accuracy different epochs to measure the quality of the encoder. We observe that the OOD detection performance is monotonously improved with the increase the training accuracy (i.e., the encoder quality). Figure 9 presents an example of the OOD detection experiment on CIFAR10 and TinylmageNet.
C.4 Influence of 122-
Figure 11 presents the OOD detection results under a more complex setting (In-distribution: CIFAR10 10, OOD: SVHN). We observe similar pattern to that in Figure 5 in the main text. This shows that the sample covariance more influenced by the n; statisties reflect more the training distribution (hence the overall consistent pattern). Future work on variance-adjusted test statistics may put more weight on the feature distributions of testing samples, so that would more easily observe performance improvement as n2 increases in this case.
samples, making the test
C.5 Under the Regression Setting.
choose OOD as the benchmark task since most common benchmark for uncertainty estimation. We additionally construct regression setting with two multivariate Gaussian distributions of different means and variances indicating different distributions. Most the uncertainty estimation frameworks cannot be applied to this setting because they only work under the classification settings.
15

---

Validation AUC
0.64
0.62
0.6
0.58
0.56
0.54
0.52
Train Accuracy
0.2
0.3
0.4
0.5
0.6
Figure 9: The OOD detection performance in terms AUROC with respect to the training accuracy of the encoder. We adopt CIFAR 10 as the ceining/in-distriuutio dataset and TinyImageNet as the OOD data.
Performance by
Performance by n_2
100
80
10
100
F1.2
AUCROC AUPR
AUCROC AUPR
Figure 10: Ablation study with respect to We Figure 11: Ablation study with respect to r2g. We use CIFARI0 as the in in-distribution dataset and use CIFAR 10 as the in-distribution dataset and SVHN the OOD dataset.
SVHN the OOD dataset.
The results in Table show that our method also achieves satisfactory performance under the regression settings, demonstrating its generalizability to other tasks.
C.6 Comparison with More Baselines
use the Fisher information matrix to measure the informativeness of evidence carried by each sample; and (2) RKL- PN [28]: prior networks trained with the reverse KL divergence. Table preseennt the additional results, from which we observe that our method still achieve the state-of-the-ee performance with more baselines included.
More baselines on uncertainty estimation are added for comparison: (1) I-EDL 6
D Multivariate Gaussian Distribution
The multivariate Gaussian distribution crucial for the approximation of a vanilla BNN 17 We provide the formal definition and its important properties in this section. The density of multivariate
16

---

Table 10: The OOD detection performance (in %) of our method, BNN-ARHT, compared with various competitors, using the ResNet50 architecture. We constructed a simulated regression setting where Mi, Σ) the distribution for in-distribution data and (- Σ) the distribution for OOD data. The auxiliary regression task is to predict the norm of the sampled vector using an MLP with two layers. We choose μ [0.5..... 0.5) Σ pT and p 128.
Model
AUROC
AUPR
MC Dropout [T0]
62.12
63.35
Deep Ensembles 21
73.18
70.45
Kendall and Gal 19
67.00
70.00
BNN-ARHT (Ours)
73.52
72.99
Table 11: The OOD detection performance (in %) of our method, BNN-ARHT, compared with
various competitors, using the LeNet architecture. Standard deviations are given in brackets.
OOD Datasets
Fashion-MNIST
SVHN
Model
In-Distrib.
AUC
AUPR
In-Distrib.
AUC
AUPR
MC Dropout
MNIST
99.33 (0.3)
99.27 (0.3)
CIFARIO
78,09
(1.35
Deep Ensembles
MNIST
(8.4)
91.08 (7.7)
CIFARIO
76.15 (5.3)
82.62 (13.1)
Kendall and Gal
MNIST
92.54
92.77 (1.9)
CIFARIO
(3.4)
(10.1
EDL
MNIST
73.43((1.0)
80.22 (11.1)
CIFARIO
69.57 (4.7)
83.74
DPN
MNIST
99.41 (0.2)
99.37 (0.3)
CIFARIO
57.48 (4.4)
77.76 (6.2)
PostNet
MNIST
(0.4)
94.70 (0.5)
CIFARIO
76.04
69.30
Detectron
MNIST
75.57 (15.2)
83.75 (29.9)
CIFARIO
76.01 (13.6)
90.00 (22.9)
RKL-PN
MNIST
78.45 (3.1)
CIFARIO
57.89
61.11 (2.8)
I-EDL
MNIST
98.49 (0.3)
98.89 (0.3)
CIFARIO
83.26 (2.4)
BNN-ARHT (Ours)
MNIST
99.51 (0.4)
99.47 (0.3)
CIFARIO
82.01 (1.2)
91.61 (0.3)
Gaussian distribution is defined as
2 (x a) T -1))
p( μr Σ)
exp
(2
Σ
where E IRP is p-dimensional vector and E E RPxp is the covariance matrix. The KL divergence between two multivariate normal distributions N(H,, Σ and N(H2, E2) is given by
Σa tr
- (p2 m1) T (pz mn)
KL(N(M, En)l Σz))
log
p +
2
Σ
E
Baseline Methods and Implementation Details
Implementation Details. We present additional implementation details and hyperparameter settings. We first provide the key settings and adaptations applied to the baseline methods for reproducibility. We follow the default settings for other fine-grained parameters (e.g., learning rates).
The proposed method is implemented in Python with Pytorch library on a NVIDIA TESLA V100 GPUs. The dropout ratio of each dropout layer is selected as 0.2. All models are trained with 100 epochs with possible early stopping. We use the Adam optimizer optimize the model with a learning rate of 5 x 10 and a weight decay of 1 x 10 Data augmentations such as color jittering and random cropping and flipping are applied as regularization measure.
equipped with four
Hyper Hlperraareeetrr Settings. The hyperparameter settings for BNN training and ARHT testing are given follows:
Prior mean of weights sampled from (-(,00000
17

---

* 300
À 0.01
Additional Settings of Baseline Methods. We further introduce the experimental settings of baseline methods:
Deep ensembles [21]
Set the number of ensembles
MCDropout [10 Set the dropout ratio 0.2 for both training and inference.
Kendall and Gal
Set the number of inference weight samples as 20.
Detectron
Set the number runs as 100.
PostNet Because the original codes operate on the features extracted from the stan- dard datasets, this method cannot be generalized to new datasets (e.g., SVHN) due to unavailability of the data processing codes.
F Uncertainty Measures
We describe the uncertainty measures used in the OOD misclassification task in this section. These definitions are well-known and summarized in Malinin and Gales [27]
Entropy:
H H = Σ p(we In p(w.)D)
where P(w,|D) is the predictive probability of class and K is the number of classes for classification.
Maximum probability: take the maximum predicted probability P from all classes the confidence score,
p max P(we D).
Differential entropy:
S SK-- p(H(D) In ppp(
TV. 14 (D
where SK-1 is the supporting set, and μa is the predictive class probability assumed to follow a Dirichlet distribution.
Accuracy: the fraction of correct predictions the total number of ground truth labels.
F-1 score: The F-1 score for each class is defined
precision recall
F-1 score precision + recall
where 'recall' is the fraction of correct predictions to the total number of ground truths each class and 'precision' is the fraction correct predictions to the total number of predictions in each class.
AUROC: the area under the receiver operating curve (ROC) which is the plot of the true positive rate (TPR/Recall) against the false positive rate (FPR).
AUPR: the area under the precision-recal curve. Note that the AUPR for binary classification is sensitive to the distribution of positive and negative classes. Hence, the higher AUPR does not necessarily imply better model performance.
G
Algorithm
Algorithm gives the detailed workflow of our proposed uncertainty estimation framework.
18

---

Algorithm 1 Our proposed uncertainty estimation framework
Input:
The prior distribution of weights of BNN encoder (0) NN I);
Training data Der {zi, Mi No.
Testing data Dtc = (æi, y4 ) Hyperparameters Noo Po. n2:
Initial variational posterior distribution q(0) ~ (Ht, + exp(p))) with initial parameters
μ 1o1 1 and p = Po1
Output: The uncertainty scores
for (æt, ye) in Der do
Train BNN encoder
2: Draw weight sample A from (()) fo;;)
3: 9:
Forward propagation
4:
Compute task-specific loss Lobj
5:
Compute KI.(q ()) and hence the ELBO
6:
Backpropagate the ELBO to update and p
7: end for
8: Compute 14 E 12, Σ1 ReXp
Obtain summary statistics of training
9: for (æ;, y:) in Der
OOD Detection
10:
Compute A42 E IRP, Σg 12pxp
11:
Compute the pooled sample covariance matrix by Eq. (1)
12:
Compute ARHT by Eq. (4) the uncertainty score
13:
Detect OOD samples using the uncertainty score under family-wist adjusted threshold
14: end for
19


Reviews:
[{"review_id": "PUTxoiWfeq", "reviewer": "Reviewer_vwXa", "summary": "This paper proposes an OOD detection procedure by applying adaptable regularized Hotelling’s T-square (ARHT) test [24] on the feature representation of learned BNN networks. Authors introduced the application o ARHT on BNN encoder, and proposed a procedure to adaptively calibrate detection threshold based on Benjamini–Hochberg (BH) procedure. On a suite of low-dimensional image experiments (CIFAR, MNIST, OMNIGLOT, SVHN) and a medical image benchmark (DRD) and using small architectures (e.g., LeNet, AlexNet, ResNet18), authors illustrates that the proposed method clearly outperforms previous methods in terms of OOD AUC. Thorough ablation study is conducted.", "questions": "See Weakness.", "limitations": "See Weakness.", "rating": 6, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "* An novel approach to OOD detection leveraging multivariate tests and associated calibration procedures.\n* Authors conducted thorough experiment on academic benchmarks to show the advantage of the approach.", "weaknesses": "* Some description of previous literature may be incorrect. For example, in line 43-48, authors mentions that (1) BNNs perform poorly when the dimension of the output is high. (2) BNN are limited to classification problems. I am not sure if either of these are true for modern BNNs. For example, [rank-1 BNN](https://arxiv.org/pdf/2005.07186.pdf) outperforms their deterministic counterparts on ImageNet, and regression is a rather standard BNN task (e.g., conducted on UCI benchmarks).\n\n* The experiments are done on rather simplistic architectures and benchmarks.  Therefore the generalization of this approach (either in terms of quality and computational feasibility) to more realistic data setting (e.g., ImageNet) and nontrival modern large models is less clear. \n\n* I find that the point \"our framework is sensitive to the quality of the encoder\" (line 260-266) to be rather important. Three suggestions regarding this point: \n\n   * this seems to contradict the paper's claim that ARHT is superior to traditional BNN whose \"performances heavily rely on the feature encoder and are poor when the features are of poor quality\" (line 48). As it seems ARHT suffer a similar issue but to a lesser extent. I recommend adjust the descriptions in 48-50 correspondingly so it is not misleading (maybe refocus (3) in terms of sample efficiency). \n  * It would be interesting to have a more thorough investigation on the relationship between encoder quality v.s. OOD detection performance, where encoder quality can be quantified in terms of standard representation learning metric such as linear probing accuracy.  This can be done via a scaling study of different sample sizes and / or architectures. I think a study like this can possibly show ARHT performance is associated with encoder quality, but can achieve a stronger OOD performance when compared to other method under the same accuracy.\n  * Please consider discussing this in the limitation section.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "Thank you for your detailed and constructive comments. We will address your questions and concerns as follows. \n\n>**Q1. A More accurate description of the literature.** \n\nThank you for the suggestions. We believe that there might be some misunderstanding. We focused on comparing the previous uncertainty estimation methods instead of BNNs. Most of the **uncertainty estimation methods** (with or without BNNs) are limited to classification problems. They do not operate on latent distributions, hence they perform poorly when the dimension of output is high (e.g., high dimensional regression). Hence, we highlight that our proposed uncertainty estimation method can address these common limitations. We will revise the description in our manuscript for a clearer presentation to avoid confusion.\n\n>**Q2. Generalization to More Realistic Datasets and Modern Architectures.**\n\nWe have included additional experiments on TinyImageNet and ResNet50. The results still outperform the baseline methods, validating the performance of our framework when being scaled to larger datasets and architecture.  Please see the **general comments** for the results on TinyImageNet and the **comments to reviewer jk7P** for results with ResNet50.\n\n>**Q3. Influence of the Quality of Encoder.** \n\nThank you for the suggestions. We are also aware of the effect of the encoder quality, and thus we fixed the encoder (say, LeNet) when comparing our framework with the current SOTA methods. Since the baseline methods are trained on classification problems (e.g., the CIFAR 10 image classification and DRD auxiliary task), we adopt the **training accuracy at different epochs** to measure the quality of the encoder, and we observe that the OOD detection performance is overall monotonously improved with the increase in training accuracy (i.e., the encoder quality). See **Figure 3 in the rebuttal file** for the visualization. More specifically, we claim that ARHT outperforms traditional **uncertainty estimation methods** which heavily rely on the encoder quality. Since ARHT operates on latent representations, it still requires the quality of the encoder to generate ideal latent distributions. We would adjust the claim in a later version of the manuscript and clarify this point in the limitation section."}, {"review_id": "ymch5olPvo", "reviewer": "Reviewer_jk7P", "summary": "The paper proposes BNN-ARHT, which introduces a uncertainty estimation framework that uses high dimensional hypothesis testing in the feature space of a network. The key idea is to use ARHT to determine in vs outliers in a feature space, and so it is generic and broadly applicable to any kind of task and network type trained with supervised or unsupervised objectives. In particular, the paper relies on a Bayesian encoder to compute the ARHT on train and test data, that is trained with Stochastic Variational Inference (SVI). The testing statistic is the Hotelling’s $T^2$ test statistic, of which the adaptable and regularized version is used. The threshold $\\lambda$ is tuned from a pre-defined set for each sample, and for each task separately which is argued to produce the best results", "questions": "My main concerns are regarding the lack of more comprehensive evaluation for OOD detection. Using better baselines, large scale benchmarks and more modern architectures.", "limitations": "Yes", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "* ARHT seems to be a interesting and novel statistic from the uncertainty estimation point of view.\n* An appealing aspect of the proposed approach is that it can work in arbitrary feature spaces, which vastly expands its applicability. This is also relatively under studied as compared to most approaches that compute uncertainty in the output space. \n* Predictive performance on the networks tested is preserved, while retaining benefits of OOD detection. Good ablation studies are performed to understand the characteristics of the method. \n* The finding that the method can be used with a encoder trained with supervised or unsupervised architecture is very interesting, and raises several intriguing questions. This can be studied in more detail — perhaps a related work is \"Predictive Inference with Feature Conformal Prediction” from ICLR 2023. https://arxiv.org/abs/2210.00173", "weaknesses": "* The paper only compares with few uncertainty estimation methods for the OOD detection setup — whereas i think it should compare more comprehensively with the wide range of state of the art techniques that have achieved high performance on all the benchmarks considered here. \n* The lack of more realistic OOD benchmarks is a limitation. The experiments are only done on CIFAR10/MNIST with simple networks (ResNet18) whereas it is essential to validate these interesting claims on more realistic benchmarks. \n* The generality of the approach needs to be rigorously evaluated — UQ for regression, and tasks other than classification can be evaluated and compared against existing methods. \n* On UQ -- why is OOD the only application considered? OOD benchmarks are often artificial and can have a lot of artifacts which can aid in detection (See for e.g. Semantically Coherent Out-of-Distribution Detection, ICCV '21). Tasks like Bayesian function optimization can shed more light on the quality of uncertainties, and its performance on regression. \n* Scalability needs to be addressed — a big limitation is the scalability of the proposed approach to bigger and more realistic datasets and networks. Even for ResNet18 considered here, the only a single layer is replaced with its BNN equivalent. it’s unclear why the last layer is optimal, or how this choice can be made in other settings. Further, the threshold needs to be identified each time for each task, which is a computational burden, that other competing methods do not have.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "Thank you for your positive comments on the novelty and the appealing aspects of our methods. And thank you for indicating an intriguing future direction for this work using conformal inference. We will address your concerns and questions as follows. \n\n>**Q1. More Comprehensive Evaluation.**\n\nAccording to your comments, we conduct additional experiments to more extensively evaluate our method, including adding more baselines, experiments on more diverse datasets, and experiments with larger architectures.\n* **More baselines.** We have added additional baselines on uncertainty estimation approaches for comparison: (1) I-EDL [1]: use the Fisher information matrix to measure the informativeness of evidence carried by each sample; and (2) RKL-PN [2]: prior networks trained with the reverse KL divergence. **Table 1 in the rebuttal file** presents the results. We will comprehensively compare these baselines on more datasets in the future.\n\n*  **More datasets.** We validated our framework on a more realistic dataset in medical imaging --- the Diabetes Retinopathy Detection (DRD) dataset (see Table 2 in the manuscript for the results) in addition to standard datasets like CIFAR and MNIST. Additionally, we performed uncertainty estimation on a larger and more diverse dataset (as suggested by reviewer vwXa) with TinyImangeNet as the OOD dataset. The results show that our model is still robust when generalized to a larger dataset. Please see the **general comments** for the results and a detailed discussion. \n\n*  **More tasks.** We choose OOD as the benchmark task since it is the most common benchmark for uncertainty estimation. We additionally construct a regression setting with two multivariate Gaussian distributions with different means and variances indicating different distributions. Most of the uncertainty estimation frameworks cannot apply in this setting since they only work under the classification settings. The following table presents the results. The Experiment demonstrates that our method also achieves satisfactory performance under the **regressions settings**, showing the generalizability to other tasks. \n\nTable: The OOD detection performance (in \\%) of our method compared with various competitors, using the ResNet50 architecture. We constructed a simulated regression setting where $\\mathcal{N} (\\boldsymbol \\mu, \\boldsymbol \\Sigma)$ is the distribution for in-distribution data and $\\mathcal{N} (-\\boldsymbol \\mu, \\boldsymbol \\Sigma)$ is the distribution for OOD data. The auxiliary regression task is to predict the norm of the sampled vector with an MLP with 2 layers. We choose $\\boldsymbol \\mu = [0.5, 0.5, \\ldots, 0.5]^\\top$ and $\\boldsymbol \\Sigma = 9 I$.\n|  Model   | AUROC  | AUPR |\n|  ----  | ----  | ---- |\n| MC Dropuout | 62.12  | 63.35\n| Deep Emnsembles | 73.18 | 70.45\n|Kendall and Gal | 67.00 | 70.00\n| BNN-ARHT (Ours)  | **73.52** | **72.99**\n\n>**Q2. More Modern Architecture \\& Scalability concerns.** \n\nFollowing your suggestion, we additionally tested the performance of our ARHT using ResNet 50 with some layers being replaced by its Bayesian replication. The results show that our method still performs well when being scaled to large model architecture. Note that our method does not necessarily rely on a Bayesian encoder. In fact, a large frequentist network (e.g., ViT) can also generate ideal latent distributions, while our experiments focus on the BNN to emphasize its capability to generate good latent distributions. Detailed results and discussion can be found in the **general comments**. \n\n>**Q3. Replacing Some Layers to Create Deep Bayesian CNNs.**\n\nThe rationale of replacing some layers (either convolutional or linear layer) as Bayesian is to introduce variance to parameters. The empirical performance demonstrates that our method is **less sensitive to which layers are being replaced** (we experimented on several combinations of layers), as long as the total variance in parameters is not too large (such that the BNN would not underfit to a random guess).\n\n>**Q4. Identification of Threshold $\\lambda$.** \n\nWe consider the threshold $\\lambda$ as a characteristic in our algorithm which makes the uncertainty estimation adaptive.  We understand the concern about the computational burden.  However, since the computation of the inverse of the covariance matrix dominates the algorithm, the computation of the optimal $\\lambda$ is relatively trivial.  Moreover, from the ablation study, we observe that the framework is robust to changes in $\\lambda$, and thus one can also set a universal $\\lambda$ in practice. \n\n>**Q5. Uncertainties with Conformal $p$-Values.** \n\nWe would like to thank the reviewer for highlighting an interesting direction of uncertainty estimation with conformal inference. Currently, our settings assume the samples drawn from the latent distribution are IID (also the assumption of ARHT). While this may be true for the in-distribution data, it is likely that the IID assumption is violated for testing samples (as latent features are drawn from a single testing image, which leads to highly correlated features). This is also a possible reason why Figure 4 is not strictly the standard normal (see the discussion with reviewer VpvZ). With conformal inference relaxing the IID assumption to exchangeability, we may be able to develop more robust P-values as uncertainty estimation measures in future work (a related work is Testing for Outliers with Conformal $p$-values S Bates *et al.* 2021)\n\n[1] Deng *et al.* Uncertainty estimation by fisher information-based evidential deep learning. ICML 2023\n\n[2] Malinin and Gales. Reverse kl-divergence training of prior networks: Improved uncertainty and adversarial robustness. NeurIPS 2019\n"}, {"review_id": "wSmdH41r3a", "reviewer": "Reviewer_VpVz", "summary": "This paper proposes a framework to detect out-of-distribution (OOD) data via high-dimensional testing on latent representations.\n\nThe proposed framework consists of:\n- a Bayesian Neural Network that, for any input, can produce an ensemble of latent presentations by sampling the posterior of the weights\n- a hypothesis testing procedure that computes the adaptable regularized Hotelling's $T^2$ score (ARHT) as a measure of uncertainty, and classifies the input as OOD when the ARHT score is larger than a threshold calibrated by the Benjamini-Hochberg (BH) procedure\n\nThe paper demonstrates the superior performance of the proposed framework on standard OOD detection benchmarks and a medical image dataset.", "questions": "- The paper says that $T(\\lambda) \\sim \\mathcal{N}(0,1)$, but looking at Figure 4, the scores do not appear to be Gaussian, and the scale of the scores grows to several thousands. Is my understanding about Fig. 4 wrong, or there is some mistake in plotting the figure?\n\n- To computer $RHT(\\lambda)$ in equation (3), one needs to invert the matrix $S_n + \\lambda I_p$, which has size $p$ that is the dimension of the latent representation. What if $p$ grows to, say one million? Would it still be possible to compute the score? Also the paper does not seem to clearly state the runtime of the proposed algorithm.", "limitations": "N/A", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 2, "contribution": 3, "strengths": "- The idea of using Bayesian NN to generate an ensemble of latent representations, and then leveraging the ARHT score as a measure of uncertainty is novel, interesting, and useful for many practical applications\n\n- The paper is generally well written and easy to follow.", "weaknesses": "- A major weakness of this paper is that, for readers who do not have a statistical background, the ARHT score, i.e., equations (1)-(4), appear to come from nowhere. Particularly, I think the paper will be much easier to appreciate if comments and explanation could be made about:\n    - What is the intuitive explanation of the Hotelling's $T^2$ test statistic $T$? Why should we believe it is a good metric for separating in-distribution and OOD samples?\n    - What is the motivation of loading a scaled identity matrix to $T$? In the related work section (which appears at the end of the paper) you seem to state that was due to the potential singularity of the matrix $S_n$. I believe you should state this earlier when you present the equation (2) and (3).\n    - Why the ARHT score $T(\\lambda)$ satisfies a Gaussian distribution $\\mathcal{N}(0,1)$? This claim seems to come from reference [24]. I believe you need to briefly explain this to the reader.\n\n- Section 3.4 describes the B-H procedure without intuitive explanation and detailed derivation. I think more contents are need to explain this, at least in the supplementary materials.\n\n- There are many typos in the manuscript. The authors should carefully review the grammar if the paper was accepted.\n", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We greatly appreciate your positive and insightful comments on our manuscript.  We would address your comments as follows.\n\n>**Q1. More Explanation on ARHT.**\n\nWe understand the audience without a solid statistical background may find it difficult to understand the proposed ARHT. We provide more explanations of ARHT as follows and will revise the manuscript for a clearer explanation of key statistical components to the general audience.\n\n*  **Why ARHT?** One of our motivations is to formulate uncertainty estimation as a hypothesis testing problem, where we interpret high-dimensional test statistics as **distance measures**. ARHT can be viewed as a distance measure between each testing sample and the in-distribution sample, where a larger ARHT indicates the sample is more likely to be OOD. The detection of OOD is then determined by a threshold (we presented the Benjamini--Hochberg (BH) procedure to compute the optimal threshold). One advantage of ARHT is that it directly operates on the sampling distributions of the latent features, and hence it does not require parametric assumptions on the latent features or logits (e.g., Dirichlet distribution on class probabilities), which makes it a more robust metric for uncertainty estimation. \n\n* **Motivation of Loading $\\lambda I$.** This is a standard way to ensure the covariance matrix is positive definite (and thus invertible) and hence improve the numerical stability. We will state this earlier in the article to avoid confusion.\n\n* **Why ARHT follows standard normal?**  The major part of Li *et al.* is to prove why $T(\\lambda)$ follows the standard Gaussian distribution. The proof is complex and hence is not focused in this paper. Intuitively, $T(\\lambda)$ can be viewed as a ``standardized\" version of RHT (i.e., known as Mahalanobis distance) by its theoretical mean and SD (where the derivations of the theoretical mean and SD are also specified in detail by Li *et al.*\n\n* **Intuitive Explanation and detailed derivation of the BH procedure.**\n    We agree that the BH procedure may not be intuitive to the general audience although it is well-known in the statistics community (due to multiple testing). Intuitively, we consider the OOD detection procedure for each testing image as a single hypothesis testing problem. Then, such a procedure for the whole testing set can be viewed as a multiple-testing problem (i.g., conducting many tests). However, applying a universal threshold for all tests (e.g., $\\alpha =0.05$) is too conservative and leads to many false discoveries. Hence, the BH procedure is applied to assign a threshold adaptively to each sample according to the $p$-values of all tests such that the false discovery rate (FDR) can be minimized. \n\n>**Q2. Plot of $T(\\lambda)$.**\n\nYes, this observation is inconsistent with the theoretical property of $T(\\lambda)$. In fact, this plot is very similar to the $F$-distribution of Mahalanobis distance. We believe this should result from a partial violation of the assumption of ARHT (most likely the covariance scale is heterogeneous (i.e., unequal variance testing) between the training and testing distributions). However, other empirical evaluation shows that the violation of assumption is not significant on performance, and we believe this violation only affect the scale of the test statistic. We will further develop a variance-adjusted version of ARHT as an attempt to resolve this issue. \n\n>**Q3. Dimension of $p$.** \n\nSince we are focusing on testing on latent representation, it is uncommon that the dimension of latent representation is too large (say one million). Typical dimensions of embeddings range from 64 to 1024, and we have conducted ablation studies on how it affects performance. Indeed, the costs of inversion increase significantly with the increase in dimension. Therefore, we rely on the assumption that the encoder can generate good feature distributions such that our method is less sensitive to the feature dimension (i.e., a feature dimension of 128 can be sufficient). The runtime of the algorithm is majorly on computing the inverse of the sampled covariance matrix and the multiple forwards of the Bayesian Neural Network (i.e., getting distributions of latent representation). The inference runtime is around 20 seconds per batch (size: 1024) of samples when $n_2=200$ and $p=64$.\n\n>**Q4. Typos in the Manuscript.** \n\nThank you for pointing out the issues. We have conducted a thorough review of the typos and grammar and will update the typo-free manuscript at a later stage."}, {"review_id": "saoXjHRbPv", "reviewer": "Reviewer_HkqB", "summary": "The paper presents a new framework for uncertainty estimation in baysian neural networks. The core contribution is formulating uncertainty estimation as multiple high-dimensional hypothesis testing problem and deriving the test statistics necessary. The paper then present multiple empirical results, showing good performance in well established benchmarks and a excellent ablation study of relevant hyperparameters of their proposed method.", "questions": "* Have the authors any thoughts on the influence of n_1, e.g. the size of the training set? For all datasets tested in the paper this is fixed, but the number of samples in the training distribution compared to the test distribution seems to be important for this method to work.\n\n* Regarding Figure 5: Have the authors tried out this kind of ablation studies on other dataset combinations to see if they experience similar pattern? Mnist-FMnist is one of the easier cases for OOD and I wonder if this has something to do with the observed robustness of the method.\n\n* Regarding Figure 5: The results from varying n_2 is strange to me. I would assume as we sample more test datapoints we get more certain about the test distribution making it easier to distinguish for the test distribution, however this does not seem to be the case. Does the authors have an explanation for this? ", "limitations": "As the authors state in L300-302, BNNs are still hard to scale which seems to be the main limitation this line of work. That said, assuming that in future this gets solved this method seems very easy to apply.\n\nAnother limitation of the method, seems to be that it is limited to OOD, or at least tasks where distributions are compared. OOD is an important tasks, however just estimating the predictive uncertainty of a single sample is similarly important, which the framework does not seem to support. ", "rating": 6, "confidence": 4, "soundness": 4, "presentation": 3, "contribution": 3, "strengths": "Originality: \nThe core idea of the paper of formulating uncertainty estimation as hypothesis testing seems novel. The paper essentially combines already established methods, BNNs with hypothesis testing (both which are well know), into a new exiting direction for this line of work. \n\nQuality:\nThe paper is of high quality, both in outlining the method and their experimental section. For example, it is nice to see standard deviations added for nearly all results and a lot of relevant baselines to compare against. The inclusion of DRD datset, to test the method on a more \"real-life\" dataset is also a welcome addition and really shows the that the methods does not only work on benchmark datasets.\n\nClarity:\nThe paper is well written and easy to follow.\n\nSignificance:\nThe paper does open a new sub-direction within uncertainty estimation, regarding the use of hypothesis testing. Only time will tell how influential this will be. I am not truly convinced that the ARHT testing size is the correct way to go as it still involves an assumption of sub-Gaussuanity on its input.\n\nThe core strength of the paper is its section 5 regarding the ablation studies. The framework presented in the paper includes a lot of \"moving parts\" and therefore without a thoroughly investigation on which parts of this many layered method, it would be impossible to say which had a significant impact on the performance of the framework. The ablation study does a good job highlighting how each component feeds into the framework.  \n\nAlso, thanks to the authors for providing anonymised code, helped understand parts of the paper.", "weaknesses": "In L56-58 the authors claims that \"We formulate uncertainty estimation as a multiple high-dimensional hypothesis testing problem, and propose a Bayesian deep learning module to address better the aleatoric and epistemic uncertainties when learning feature distributions.\". While I agree with the first part of the sentence, I would say the second part is not a contribution as too my knowledge the BNN framework used in the paper is not novel, which there is nothing wrong with, but should not be listed as a contribution. \nIn that regard I think the authors could make it more explicit that the first part of their framework is not unique in any sense, and therefore could be any BNN. Regarding results, similarly the authors should be more honest about their results. L206-206 state that their method is \"superior\", however if accounting for standard deviations the results only seems significant in a single case.\nThus overall, authors should adjust the claims in their paper to better reflect the work presented. \n\nA small correction/question: From L130-139, the authors provide a bunch of equations, where the choice of parenthesises seems very arbitrarily. Sometimes {} is used, sometimes [] is used. sometimes () is used. It is confusing. Additionally in L139 there seems to be missing a \"/\" between what I assume is the nominator and denominator in a fraction. ", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We greatly appreciate your positive comments on our manuscript and your insightful summary of the impacts and novelty of our work. We take great pleasure to respond to several intriguing discussions you raised as follows.\n\n>**Q1. Improving Clarity of Claims.** \n\nThank you for your suggestions on improving the clarity of several critical claims in our manuscript. For the use of BNNs, we agree that our contribution is to adopt BNN to generate better latent distributions of samples (in contrast to conventional uncertainty estimation methods assuming parametric distributions), instead of proposing a new BNN learning framework. We will revise this claim and specify that our method adopts existing BNN advances instead of proposing a new BNN framework for better clarity. Also, we agree that the word \"superior\" may be inaccurate to describe the experiment results, and thus we will adjust the claims with a more careful choice of words (e.g., removing the \"superior\") in the future stage. \n\n>**Q2. Influence of $n_1$.** \n\nThank you for pointing this out and we think this is an interesting discussion on future designs of the sample sizes $n_1$ and $n_2$. We think this is also related to your question on the strange performance varying by $n_2$. The size $n_1$ is controlled by the hyperparameter $s$ in our framework. We have conducted experiments with $s$ ranging from 1 to 5. Please see Figure 1 in the rebuttal file for the results. The pattern shows that the performance is decreasing when $s$ is increasing (i.e., more embedding samples from the in-distribution dataset). This demonstrates that covariance structure affects ARHT more as $s$ increases, and the contribution of testing embeddings is less weighed, which leads to slightly decreasing performance. \n\n>**Q3. Influence of $n_2$.** \n\nFigure 2 in the rebuttal file presents the OOD detection results under a more complex setting (CIFAR10 to SVHN). We can observe a similar pattern as the one shown in the manuscript. This shows that the sample covariance is more influenced by the $n_1$ training/in-distribution samples, making the test statistics reflect more the training distribution (hence the overall consistent pattern). Future work on variance-adjusted test statistics may put more weight on the feature distributions of testing samples, where we may more easily observe improving performance as $n_2$ increases in this case.\n\n>**Q4. Support of Single-Sample Uncertainty.** \n\nSince the training set (as the in-distribution set) is available (at least training or fine-tuning the encoder) for most of the problems, one can use samples from training sets and the testing samples to compute ARHT. One significant exception is the zero-shot case when we only have the pre-trained encoder without the original data (i.e., in-distribution sample). In this case, most of the uncertainty estimation methods may not work since they require at least in-distribution data to fit their parametric assumptions (e.g., concentration rates of the Dirichlet distributions in classification problems). However, one may still obtain ARHT as an uncertainty estimate using methods to reconstruct/generate pseudo-training data from the pretrained models, which is not the focus of our work but an interesting direction in the future.\n\n>**Q5. Use of Brackets.** \n\nThank you for the suggestions. We will make the use of brackets consistent in the future stage given that it is not possible to update the manuscript at this stage. We have double-checked that the expression is correct for L139 (i.e., $\\hat{\\rho}_2(-\\lambda, \\gamma)$ is the product of two expressions $(1 + \\gamma \\hat{\\Theta}_1(\\lambda, \\gamma))(p^{-1}{\\rm tr} (\\boldsymbol{S_n})  - \\lambda \\hat{\\rho}_1(-\\lambda, \\gamma))$)."}]

Author rebuttal:
We thank all the reviewers for your time and efforts on our manuscript. According to the reviewers' comments, we conduct additional experiments to more extensively evaluate our method, including adding more baselines, experiments on more diverse datasets, and experiments with larger architectures. Experiment results are summarized in the rebuttal file and tables in respective threads. 

>**Q1. More realistic datasets (jk7P, vwXa).** 

We have conducted additional experiments on OOD detection, with CIFAR10 as the in-distribution dataset and TinyImageNet as the OOD dataset. The result is presented in Table 1 below and it shows that the uncertainty estimation performance is still satisfactory when being generalized to larger datasets.

Table 1: The OOD detection performance (in \%) of our method compared to various competitors, using the LeNet architecture. We use CIFAR 10 as the in-distribution dataset and TinyImageNet as the OOD dataset.
|  Model   | AUROC  | AUPR |
|  ----  | ----  | ---- |
| MC Dropuout | 66.98  | 64.46
| Deep Emnsembles | 66.41 | 63.97
|Kendall and Gal | 63.23 | 63.06
|EDL | 51.64 | 66.31
|DPN| 64.68 | 58.33
| BNN-ARHT (Ours)  | **67.77** | **66.74**

>**Q2. Scalability (jk7P, vwXa, HkqB).**

 We aim to use the Bayesian counterpart of a smaller architecture to demonstrate the capability of BNNs to generate latent feature distributions (for details please see the discussion section in the main text). Note that one can generate ideal feature distributions using very large frequentist vision models (e.g., ViT), which however induces larger complexity in training and inference. 

A related ablation experiment comparing the frequentist and Bayesian architecture is presented in the main text. We have additionally conducted an experiment with the Bayesian model architecture scaled up to ResNet50. Table 2 below presents the results and it shows that our method can still perform satisfactorily when scaled up to a larger architecture. We further conduct an example experiment using the frequentist ResNet50 (the hypothesis test reduces to a one-sample test) and the testing AUROC is 72.77. These results validate the scalability of our method to large and modern vision architectures. 

Table 2: The OOD detection performance (in \%) of our method compared with various competitors, using the ResNet50 architecture. We use CIFAR 10 as the in-distribution dataset and SVHN as the OOD dataset.
|  Model   | AUROC  | AUPR |
|  ----  | ----  | ---- |
| MC Dropuout | 68.32  | 78.24
| Deep Emnsembles | 65.13 | **82.19**
|Kendall and Gal | 72.24 | 81.43
|EDL | 51.21 | 73.78
|DPN| 62.33 | 79.11
|Detectron | 73.16 | 82.5
| BNN-ARHT (Ours)  | **73.46** | 78.27


Meta-review: This paper proposes a new method for uncertainty estimation by (1) mapping data into a latent feature space using Bayesian Neural Networks and (2) run an adaptable regularized Hotelling’s $T^2$ (ARHT) test for better consistency and robustness especially for relatively high latent dimension. The method was tested on OOD tasks and benefits were shown. 

The reviewers are generally in favor of the paper. They considered the idea novel and effective. Different concerns such as scalability, generalizability, experiment setting, etc. were raised but were addressed reasonably during rebuttal.
Decision: Accept (poster)