E VIDENTIAL T URING P ROCESSES
A BSTRACT
A probabilistic classiﬁer with reliable predictive uncertainties i) ﬁts successfully to the target domain data, ii) provides calibrated class probabilities in difﬁcult regions of the target domain (e.g. class overlap), and iii) accurately identiﬁes queries coming out of the target domain and rejects them.
We introduce an original combination of Evidential Deep Learning, Neural Processes, and Neural Turing
Machines capable of providing all three essential properties mentioned above for total uncertainty quantiﬁcation.
We observe our method on ﬁve classiﬁcation tasks to be the only one that can excel all three aspects of total calibration with a single standalone predictor.
Our uniﬁed solution delivers an implementation-friendly and compute efﬁcient recipe for safety clearance and provides intellectual economy to an investigation of algorithmic roots of epistemic awareness in deep neural nets.
I NTRODUCTION
The applicability of deep neural nets to safety-critical use cases such as autonomous driving or medical diagnostics is an active matter of fundamental research (Schwalbe & Schels, 2020).
Key challenges in the development of total safety in deep learning are at least three-fold: i) evaluation of model ﬁt, ii) risk assessment in difﬁcult regions of the target domain (e.g. class overlap) based on which safety-preserving fallback functions can be deployed, and iii) rejection of inputs that do not belong to the target domain, such as an image of a cat presented to a character recognition system.
The attention of the machine learning community to each of these critical safety elements is in steady increase (Naeini et al., 2015; Guo et al., 2017; Kuleshov et al., 2018).
However, the developments often follow isolated directions and the proposed solutions are largely fragmented.
Calibration of neural net probabilities focuses primarily on post-hoc adjustment algorithms trained on validation sets from in-domain data (Guo et al., 2017), ignoring the out-of-domain detection and model ﬁt evaluation aspects.
On the other hand, recent advances in out-of-domain detection build on strong penalization of divergence from the probability mass observed in the target domain (Sensoy et al., 2018; Malinin & Gales, 2018), distorting the quality of class probability scores.
Such fragmentation of best practices not only hinders their accessibility by real-world applications but also complicates the scientiﬁc inquiry of the underlying reasons behind the sub-optimality of neural net uncertainties.
We aim to identify the guiding principles for Bayesian modeling that could deliver the most complete set of uncertainty quantiﬁcation capabilities in one single model.
We ﬁrst characterize Bayesian models with respect to the relationship of their global and local variables: (a) Parametric Bayesian
Models comprise a likelihood function that maps inputs to outputs via probabilistic global parameters, (b) Evidential Bayesian Models apply an uninformative prior distribution on the parameters of the likelihood function and infer the prior hyperparameters by amortizing on an input observation.
Investigating the decomposition of the predictive distribution variance, we ﬁnd out that
the
[Figure]
uncertainty characteristics of these two approaches exhibit complementary strengths.
We introduce a third approach that employs a prior on the likelihood parameters that both conditions on the input observations on the true model and amortizes on them during inference.
The mapping from the input observations to the prior hyperparameters is governed by a random set of global parameters.
We refer to the resulting approach as a (c) Complete Bayesian Model , since its predictive distribution variance combines the favorable properties of Parametric and Evidential Bayesian Models.
Figure 1 gives an overview of the relationship between these three Bayesian modeling approaches.
The advantages of the Complete Bayesian Models come with the challenge of choosing an inputdependent prior.
We introduce a new stochastic process construction that addresses this problem by accumulating observations from a context set during training time into the parameters of a global hyperprior variable by an explicitly designed update rule.
We design the input-speciﬁc prior on the likelihood parameters by conditioning it on both the hyperprior and the input observation.
As conditioning via explicit parameter updates amounts to maintaining an external memory that can be queried by the prior distribution, we refer to the eventual stochastic process as a Turing Process with inspiration from the earlier work on Neural Turing Machines (Graves et al., 2014) and Neural
Processes (Garnelo et al., 2018b).
We arrive at our target Bayesian design that is equipped with the complete set of uncertainty quantiﬁcation capabilities by incorporating the Turing Process design into a Complete Bayesian Model.
We refer to the resulting approach as an Evidential Turing Process .
We observe on ﬁve real-world classiﬁcation tasks that the Evidential Turing Process is the only model that excels simultaneously at model ﬁt, class overlap quantiﬁcation, and out-of-domain detection.
P ROBLEM S TATEMENT : T OTAL C ALIBRATION
Consider the following data generating process with K modes
[Equation]
where C at ( y |· ) is a categorical distribution, I u is the indicator function for predicate u , and p ( x | y ) is the class-conditional density function on input observation x .
For any prior class distribution π , the classiﬁcation problem can be cast as identifying the class probabilities for observed patterns
Pr [ y | x, π ] =
C at ( y
| f πtrue ( x )) where f πtrue ( x ) is a K − dimensional vector with the k -th element
[Equation]
In many real-world cases f π true is not known and should be identiﬁed from a hypothesis space h π ∈ H π via inference given a set of samples D = { ( x n , y n ) | n = 1 , . . .
, N } obtained from the true distribution.
The risk of the Bayes classiﬁer arg max y C at ( y |
h π ( x )) for a given input x is
[Equation]
For the whole data distribution, we have R ( h π ) =
E x | π [ R ( h π ( x ))] .
The optimal case is when h π ( x ) =
f πtrue ( x ) , which brings about the irreducible Bayes risk resulting from class overlap:
[Equation]
Total Calibration.
Given a set of test samples D
ts coming from the true data generating process in
Eq. 1, we deﬁne Total Calibration as the capability of a discriminative predictor h π ( x ) to quantify the following three types of uncertainty simultaneously: i) Model misﬁt evaluated by the similarity of h π ( x ) and f πtrue ( x ) measurable directly via
[Equation]
where KL( ·||· ) denotes the Kullback-Leibler divergence.
Since E p ( x ) [log C at ( y | f πtrue ( x ))] is a constant with respect to h π ( x ) , an unbiased estimator of the relative goodness of an inferred model is the negative test log-likelihood NLL ( h π ( x ))
= −
[Equation]
/ |
[Equation]
ts |
[Equation]
x,y
[Equation]
∈D ts log C at ( y | h π ( x )) .
ii) Class overlap evaluated by R ∗ ( f πtrue ( x )) .
As there is no way to measure this quantity from D ts , it is approximated indirectly via Expected Calibration Error (ECE)
[Equation]
where B m = { ( n |
h
π
( x n ) ∈
[( m − 1) /M, m/M ] } are M bins that partition the test set D ts into
D ts = B 1 ∪ · · · ∪ B M and are characterized by their accuracy and conﬁdence scores
[Equation]
iii)
Domain mismatch deﬁnes the rarity of an input pattern x ∗ for the target task, that is
Pr [ p ( x = x ∗ ) < (cid:15) ] for small (cid:15) .
This quantity cannot be measured since p ( x ) is unknown.
It is approximated indirectly as the success of discriminating between samples x ∗ coming from a different data distribution and those in D ts by calculating the Area Under ROC (AUROC) curve w.r.t.
h π ( x ) .
U NCERTAINTY Q UANTIFICATION WITH P ARAMETRIC AND E VIDENTIAL B AYESIAN M ODELS
Parametric Bayesian Models.
A commonplace design choice is to build the hypothesis space by equipping the hypothesis function with a global parameter θ that takes values from a feasible set Θ , that is H π
= { h θπ ( x ) | θ ∈ Θ } .
Parametric Bayesian Models (PBMs) employ a prior belief θ ∼ p ( θ ) , which is updated via Bayesian inference on a training set D tr as p ( θ |D tr ) =
(cid:81) ( x,y ) ∈D tr C at ( y
| h θπ ( x )) p ( θ ) /p
( D tr ) .
Consider the update on the posterior belief p
[Equation]
after a new observation ( x ∗ , y ∗ ) where the normalizer can be expressed as
[Equation]
with L ( θ ) =
(cid:81) ( x,y ) ∈D tr C at ( y
| h θπ ( x )) .
This can be seen as an inner product between the functions
C at ( y ∗ | h θπ ( x ∗ )) and L ( θ ) on an embedding space modulated by p ( θ ) .
As the sample size grows, the high-density regions of C at ( y ∗ |
h θπ ( x ∗ )) and L ( θ ) will superpose with higher probability, causing Z to increase, making p ( θ |D tr ∪ ( x ∗ , y ∗ )) increasingly more peaked, and consequently we will have
[Equation]
This conjecture depends on the assumption that a single random variable θ modulates all samples.
The variance of a prediction in favor of a class k decomposes according to the law of total variance
V
[Equation]
Due to the Eq. 8, the ﬁrst term on the r.h.s.
vanishes in the large sample regime and the second one coincides with the asymptotic solution of the maximum likelihood estimator θ MLE .
In cases when
H π contains f πtrue ( x ) , an ideal inference scheme has the potential to recover it and we get
[Equation]
The simple proposition below sheds light on the meaning of this result.
It points to the fact that the
Bayes risk of a classiﬁer (Eq. 4) and the second component of its predictive variance (Eq 9) are proportional.
This gives a mechanistic explanation for why the second term on the r.h.s.
of Eq.quantiﬁes class overlap.
Despite the commonplace allocation of the wording data uncertainty for this term, we are not aware of prior work that derives it formally from basic learning-theoretic concepts.
Proposition.
The following inequality holds for any π, π (cid:48) ∈ [0 . 5 , 1] pair min(1 − π, π ) ≥ min(1 − π (cid:48) , π (cid:48) )
⇒ (1 − π ) π ≥ (1 − π (cid:48) ) π (cid:48) .
Proof.
Deﬁne π = 0 .
5+ (cid:15) and π (cid:48)
= 0 .
5+ (cid:15) (cid:48) for (cid:15), (cid:15) (cid:48) > 0 .
As min(1 − π, π ) ≥ min(1 − π (cid:48) , π (cid:48) ) ⇒ (cid:15) ≤ (cid:15) (cid:48) , we get (1 − π ) π
= (1 − 0 .
5 − (cid:15) )
5+ (cid:15) )
= 0 .
25 − 0 .
25 (cid:15) − (cid:15) 2 ≥ 0 .
25 − 0 .
25 (cid:15) (cid:48) − (cid:15) (cid:48)
= (1 − π (cid:48) ) π (cid:48) (cid:3)
The conclusion is that (1 − f πtrue ( x ))
f πtrue ( x ) ∝ R ∗ ( f πtrue ( x )) .
Hence, the second term on the r.h.s.
of Eq.
9 is caused by the class overlap and it can be used to approximate the Bayes risk.
Put together, the ﬁrst term of the decomposition reﬂects the missing knowledge on the optimal value of θ that can be reduced by increasing the training set size, while the second reﬂects the uncertainty stemming from the properties of the true data distribution.
Hence we refer to the ﬁrst term as the reducible model uncertainty and the second the data uncertainty .
Evidential Bayesian Models.
In all the analysis above, we assumed a ﬁxed and unknown π that modulates the whole process and cannot be identiﬁed by the learning scheme.
When we characterize the uncertainty on the class distribution by a prior belief π ∼ p ( π ) , we attain the joint p ( y, π | x ) =
Pr [ y | x, π ] p ( π | x ) .
The variance of the Bayes optimal classiﬁer that averages over this uncertainty Pr [ y | x ] =
[Equation]
Pr [ y | x, π ]
[Equation]
| x ) dπ decomposes as
[Equation]
The main source of uncertainty p ( π | x ) is not a posterior this time but an empirical prior on a single observation x , hence its variance will not shrink as |D tr | → + ∞ .
Therefore, the ﬁrst term on the r.h.s.
reﬂects the irreducible model uncertainty caused by the missing knowledge about π .
The second term indicates data uncertainty as in PBMs, but accounts for the local uncertainty at x caused by π .
Evidential Bayesian Models (EBMs) (Sensoy et al., 2018; Malinin & Gales, 2018) suggest
[Equation]
where q ψ ( π | x ) is a density function parameterized by ψ and the dependency of the class-conditional on the input is dropped.
Note that the resultant model employs uncertainty on individual data points via π , but it does not have any global random variables.
The standard evidential model training is performed by maximizing the expected likelihood subject to a regularizer that penalizes the divergence of q ψ ( π | x ) from the prior belief
[Equation]
Although presented in the original work as as-hoc design choices, such a training objective can alternatively be viewed as β -regularized
(Higgins et al., 2017) variational inference of Pr [ y | π ] p ( π | x ) with the approximate posterior q ψ ( π | x ) (Chen et al., 2019).
C OMPLETE B AYESIAN M ODELS : B EST OF B OTH W ORLDS
The uncertainty decomposition characteristics of PBMs and EBMs provide complementary strengths towards quantiﬁcation of the three uncertainty types that constitute total calibration.
i) Model misﬁt:
The PBM is favorable since it provides shrinking posterior variance with growing training set size (Eq.
8) and the recovery of θ MLE which inherits the consistency
guarantees
the frequentist approach.
Since the uncertainty on the local variable π does not shrink for large
samples
, NLL would measure how well ψ can capture the regularities of heteroscedastic noise across individual
samples
, which is a more difﬁcult task than quantifying the ﬁt of
a parametric model
. ii) Class overlap: The EBM is favorable since
its data uncertainty term E π ∼ p ( π | x ∗ )
[(1 − h θπ,
k
( x ∗ ))
h θπ
,k
( x ∗ )]
is
likely to have less estimator variance than E θ ∼ p ( θ |D tr )
[(1 − h θπ,k
( x ∗ ))
h θπ,k
( x ∗ )] and calculating p ( π | x ∗ ) does not require approximate inference as for p ( θ |D tr )
iii)
Domain mismatch: The PBM is favorable since the effect of the modulation of a global θ
on
the variance of Z applies also to the posterior predictive distribution with the only difference that x ∗ is a test sample.
When the test sample is away from the training set, i.e. min x
∈D tr |
| x ∗
−
x || is large, then p ( y ∗ | x ∗ , θ ) is less likely to superpose with those regions of θ where L ( θ ) is pronounced, hence will be ﬂattened out leading to a higher variance posterior predictive for samples coming from another domain.
Since EBM has only
local random variables
, the variance
of
its posterior is less likely to build a similar discriminative property for domain
detection.
Main Hypothesis.
A model that inherits the model uncertainty of PBM and data uncertainty of EBM can simultaneously quantify: i) model misﬁt, ii) class overlap, and iii) domain mismatch.
Guided by our main hypothesis, we combine the PBM and EBM designs within a uniﬁed framework that inherits the desirable uncertainty quantiﬁcation properties of each individual approach
[Equation]
which we refer to as a Complete Bayesian Model (CBM) hinting to its capability to solve the total calibration problem.
The model simply introduces a global random variable θ into the empirical prior p ( π | θ, x ) of the EBM.
The variance of the posterior predictive of the resultant model decomposes as
[Equation]
where the r.h.s.
of the decomposition has the following desirable properties: i)
The ﬁrst term recovers the form of the reducible model uncertainty term of PBM when π is marginalized
V ar p ( θ |D )
[ E p ( π | x,θ )
[ E [ y | π, x ]]]
= V ar p ( θ |D )
[ E [ y | θ, x ]] ; ii)
The second term is the irreducible model uncertainty term of EBM averaged over the uncertainty on the newly introduced global variable θ .
It quantiﬁes the portion of uncertainty stemming from heteroscedastic noise, which is not explicit in the decomposition of PBM; iii)
The third term recovers the data uncertainty term of EBM when θ is marginalized: E p ( θ |D )
[ E p ( π | x,θ )
[ V ar [ y | π ]] =
E p ( π | x ) [ V ar [ y | π ]] .
T HE E VIDENTIAL T URING P ROCESS : A N E FFECTIVE CBM R EALIZATION
Equipping the empirical prior p ( π | θ, x ) of CBM with the capability of learning to generate accurate prior beliefs on individual samples is the key for total calibration.
We adopt the following two guiding principles to obtain highly expressive empirical priors: i)
The existence of a global random variable θ can be exploited to express complex reducible model uncertainties using the Neural Processes (Garnelo et al., 2018b) framework, ii) The conditioning of p ( π | θ, x ) on a global variable θ and an individual observation x can be exploited with an attention mechanism where θ is a memory and x is a query.
Dependency on a context set during test time can be lifted using the Neural Turing Machine
(Graves et al., 2014) design, which maintains an external memory that is updated by a rule detached from the optimization scheme of the main loss function.
We extend the stochastic process derivation of the Neural Processes by marginalizing out a local variable from a PBM with an external memory that follows the Neural Turing Machine design and arrive at a new family of stochastic processes called a Turing Process, formally deﬁned as below.
Deﬁnition 1.
A Turing Process is a collection of random variables Y =
{ y i | i ∈ I} for an index set I = { 1 , . . .
, K } with arbitrary K ∈ N + that satisfy the two properties
[Equation]
for another random variable collection Y (cid:48) of arbitrary size that lives in the same probability space as Y , a probability measure p M ( θ ) with free parameters M , and some function M (cid:48)
=
r ( M, Y (cid:48) ) .
The Turing Process can express all stochastic processes since property (i) is sufﬁcient to satisfy
Kolmogorov’s Extension Theorem (Øksendal, 1992) and choosing r simply to be an identity mapping would revert us back to the generic deﬁnition of a stochastic process.
The Turing Process goes further by permitting to explicitly specify how information accumulates within the prior.
This is a different approach from the Neural Process that performs conditioning p ( Y | Y (cid:48) ) by applying an amortized posterior q ( θ | Y (cid:48) ) on a plain stochastic process that satisﬁes only Property (i), hence maintains a data-agnostic prior p ( θ ) and depends on a context set also at the prediction time.
Given a disjoint partitioning of the data D = D C ∪ D T into a context set ( x (cid:48) , y (cid:48) )
∈ D C and a target set ( x, y ) ∈ D T , we propose the data generating process on the target set below
[Equation]
We decouple the global parameters θ = { w, Z } into a w that parameterizes a map from the input to the hyperparameter space and an external memory Z = { z 1 , . . .
, z R } governed by the distribution p M ( Z ) parameterized by M that embeds the context data during training.
The memory variable
Z updates its belief conditioned on the context set D C by updating its parameters with an explicit rule p M ( Z |D C ) ← p E
Z ∼ pM ( Z ) [ r ( Z, D C )] ( Z ) .
The hyperpriors of p ( π | Z, w, x ) are then determined by querying the memory Z for each input observation x using an attention mechanism, for instance a transformer network (Vaswani et al., 2017).
Choosing the variational distribution as q λ ( θ, π | x )
=
q λ ( w ) p M
( Z ) q ( π | Z, w, x ) , we attain the variational free energy formula for our target model
[Equation]
[Equation]
The learning procedure will then alternate between updating the variational parameters λ via gradientdescent on F ETP ( λ ) and updating the parameters of the memory variable Z via an external update rule as summarized in Figure 2b.
ETP can predict a test sample ( x ∗ , y ∗ ) by only querying the input x ∗ on the memory Z and evaluating the prior p ( π ∗ | Z, w, x ∗ ) without need for any context set as
[Equation]
[Equation]
M OST I MPORTANT S PECIAL C ASES OF THE E VIDENTIAL T URING P ROCESS
As we build the design of the Evidential Turing Process (ETP) on the CBM framework that overarches the prevalent parametric and evidential approaches, its ablation amounts to recovering many state-of-the-art modeling approaches as listed in Table 1 and detailed below.
Bayesian Neural Net (BNN) (Neal, 1995; MacKay, 1992; 1995) is the most characteristic PBM example that parameterize a likelihood p ( y | θ, x ) with a neural network f θ ( · ) whose weights follow a distribution θ ∼ p
( θ ) .
In the experiments we assume as a prior θ ∼ N ( θ | 0 , β − 1 I ) and infer its posterior by mean-ﬁeld variational posterior q λ ( θ ) applying the reparameterization trick (Kingma et al., 2015; Molchanov et al., 2017).
M
Z π w x y x (cid:48) y (cid:48)
r ( x,y ) ∈ D T ( x (cid:48) ,y (cid:48) )
[Figure]
D
[Figure]
(a) ETP Plate diagram while Model not converged do for D batch ⊂ D do Choose D C ⊂ D batch
M ← E
Z ∼ p M
( Z ) [ r ( Z, D C )]
λ ← λ − ∇ λ F ETP ( λ ) end end (b) ETP Training
Model
[Table]
Compare
[Table]
et
[Table]
2018b)
[Table]
(Sensoy et al., 2018)
[Table]
BNN (Molchanov et al., 2017)
[Table]
Demand
[Table]
context data
[Table]
test
[Table]
Evidential Deep Learning (EDL) (Sensoy et al., 2018) introduces the characteristic example of EBMs.
EDL employs an uninformative Dirichlet prior on the class probabilities, which then set the mean of a normal distribution on the one-hot-coded class labels y, π ∼
D ir ( π | 1 , . . .
, 1) N ( y | π, 0 .
5 I K ) .
EDL links the input observations to the distribution of class probabilities by performing amortized variational inference with the approximate distribution q λ ( π ; x ) =
D ir ( π |
α λ ( x )) .
Neural Processes (NP) (Garnelo et al., 2018a;b) is a PBM used to generate stochastic processes from neural networks by integrating out the global parameters θ as in Property (i) of Deﬁnition 1.
NPs differ from PBMs by amortizing an arbitrary sized context set D C on the global parameters q ( θ |D C ) via an aggregator network during inference.
NPs can be viewed as Turing Processes with an identity map r .
Follow-up work equipped NPs with attention (Kim et al., 2019), translation equivariance (Gordon et al., 2020;
Foong et al., 2020), and sequential prediction (Singh et al., 2019; Yoon et al., 2020).
All of these NP variants assume prediction-time access to context, making them suitable for interpolation tasks such as image in-painting but not for generic prediction problems.
Evidential Neural Process (ENP) is the EBM variant of a neural process we introduce to bring together best practices of EDL and NPs and make the strongest possible baseline for ETP, deﬁned as p ( y,
[Equation] [Equation]
at
[Equation] [Equation]
=
[Equation] [Equation]
[Equation] [Equation]
[Equation] [Equation]
[Equation]
, (15) with an aggregation rule r ( · ) , an encoder net h θ ( · , · ) , and a neural net α θ ( · ) mapping the global variable Z to the class probability simplex.
We further improve upon ENP with an attentive NP approach (Kim et al., 2019) by replacing the ﬁxed aggregation rule r with an attention mechanism, thereby allowing the model to switch focus depending on the target.
At the prediction time, we use
Z ∼ N ( Z | 1 , κ 2 I ) for small κ to induce an uninformative prior on π in the absence of a context set.
C ASE S TUDY : C LASSIFICATION WITH E VIDENTIAL T URING P ROCESSES
We demonstrate a realization of an Evidential Turing Process to a classiﬁcation problem below y
[Equation] [Equation]
The global variable Z is parameterized by the memory M =
( m 1 , . . .
, m R ) consisting of R cells m r ∈ R K .
The input data x is mapped to the same space via an encoding neural net v w ( · ) parameterizing a Dirichlet distribution over the class probabilities π via an attention mechanism a ( v w , z )
= (cid:80) z (cid:
) ∈
Z φ ( v w ( x ) , z (cid:48) )
z , where φ ( v w ( x ) , z ) =
softmax( { k ψ ( z ) (cid:62) v w ( x ) / √ K | z ∈ Z } ) .
The function k ψ ( · ) is the key generator network operating on the embedding space.
We update the memory cells as a weighted average between remembering and updating m ← E Z ∼ p
( Z | M )
[Equation]
where γ ∈ (0 , 1) is a ﬁxed scaling factor controlling the relative importance.
The second term adds new information to the cell as a weighted sum over all pairs ( x, y ) , taking both the true label (via onehot ( y ) ) as well as the uncertainty in the prediction (via soft ( v w ( x )) ) into account.
The ﬁnal tanh( · ) transformation ensures that the memory content remains in a ﬁxed range across updates, as practised in LSTMs (Hochreiter & Schmidhuber, 1997).
E XPERIMENTS
We benchmark ETP against the state of the art as addressed in the ablation plan in Table 1 according to the total calibration criteria developed in Sec. 2 on ﬁve real-world data sets.
See the Appendix B for full details on the experimental setup in each case and for the hyperparameters used throughout.
We provide a reference implementation of the proposed model and the experimental pipeline.
[Figure]
Total calibration.
Table 2 reports the prediction error and the three performance scores introduced in Sec. 2 that constitute total calibration.
We perform the out-of-domain detection task as in Malinin & Gales (2018) and classify the test split of the target domain and a data set from another domain based on the predictive entropy.
ETP is the only method that consistently ranks among top performers in all data sets with respect to all performance scores, which supports our main hypothesis that CBM should outperform PBM and EBM in total calibration.
Response to gradual domain shift.
In order to assess how well models can cope with a gradual transition from their native domain, we evaluate their ECE performance on data perturbed by 19 types of corruption (Hendrycks & Dietterich, 2019) at ﬁve different severity levels.
Figure 3 depicts the performance of models averaged across all corruptions.
ETP gives the best performance nearly in all data sets and distortion severity levels (see Appendix B.3 Table 4 for a tabular version of these results).
Computational cost.
We measured the average wall-clock time per epoch in CIFAR10 to be 10 .
8 ± 0 .
1 seconds for ETP, 8 . 2 ± 0 .
1 seconds for BNN, 8 . 6 ± 0 .
1 seconds for EDL, and 9 .
5 ± 0 .seconds for ENP.
The relative standings of the models remain unchanged in all the other data sets.
[Table]
C ONCLUSION
Summary.
We initially develop the ﬁrst formal deﬁnition of total calibration.
Then we analyze how the design of two mainstream Bayesian modeling approaches affect their uncertainty characteristics.
Next we introduce Complete Bayesian Models as a unifying framework that inherits the complementary strengths existing ones.
We develop the Evidential Turing Process as an optimal realization of Complete Bayesian Models.
We derive an experiment setup from our formal deﬁnition of total calibration and a systematic ablation of our target model into the strongest representatives of the state of the art.
We observe in ﬁve real-world tasks that the Evidential Turing Process is the only model that can excel all three aspects of total calibration simulatenously.
Broad impact.
Our work delivers evidence for the claim that epistemic awareness of a Bayesian model is indeed a capability learnable only from in-domain data, as appears in biological intelligence via closed-loop interactions of neuronal systems with stimuli.
The implications of our work could follow up in interdisciplinary venues, with focus on the relation of associative memory and attention to the neuroscientiﬁc roots of epistemic awareness (Lorenz, 1978).
Limitations and ethical concerns.
While we observed ETP to outperform BNN variants in our experiments, whether BNNs could bridge the gap after further improvements in the approximate inference remains an open question.
The attention mechanism of ETP could also be improved, for instance to transformer nets (Vaswani et al., 2017).
The explainability of the memory content of ETP deserves further investigation.
The generalizeability of our results to very deep architectures, such as
ResNet 152 or DenseNet 161 could be a topic of a separate large-scale empirical study.
ETP does not improve the explainability and fairness of the decisions made by the underlying design choices, such as the architecture of the used neural nets in the pipeline.
Potential negative societal impacts of deep neural net classiﬁers stemming from these two factors need to be circumvented separately before the real-world deployment of our work.
A F URTHER ANALYTICAL RESULTS AND DERIVATIONS A. K ULLBACK L EIBLER BETWEEN TWO D IRICHLET D ISTRIBUTIONS
As both our ETP and and the EDL baseline use the Kullback-Leibler divergence between two
Dirichlet distributions, we give the full details of its calculation here.
For two distributions over a
K -dimensional probability π , D ir ( π | α ) and D ir ( π | β ) , parameterized by α, β ∈ R K
+ , the following identity holds
[Equation]
where Γ( · ) and ψ ( a ) := dda log Γ( a ) are the gamma and digamma functions (Abramowitz & Stegun, 1965).
A. T HE E VIDENTIAL D EEP L EARNING O BJECTIVE
The analytical expression of the Evidential Deep Learning (Sensoy et al., 2018) loss as deﬁned in the main paper can be computed as follows.
For a single K -dimensional observation y , dropping the n from the notation and instead using the index for the dimensionality throughout the following equations, we have
[Equation]
with the tractable expectation and variance of a Dirichlet distributed π .
The Kullback-Leibler term is between two Dirichlet distributions and given (see the general form in A.1) as
[Equation]
A. E VIDENTIAL D EEP L EARNING AS A LATENT VARIABLE MODEL
As discussed in the main paper for a set of N observations D = { ( x
[Equation]
y 1 )
[Equation] [Equation]
( x N
[Equation]
y N ) }
[Equation]
the EDL objective minimizes is given as
[Equation]
where p ( π n | x n ) =
D ir ( π | α θ ( x n )) .
We can instead assume the following generative model
[Equation]
Approximating the intractable posterior p ( π | y ) where π = ( π 1 , . . .
, π n ) ,
y =
( y 1 , ..., y n ) , with an amortized variational posterior q ( π n ; x n ) =
D ir ( π n | α θ ( x n )) , where α θ ( · ) is the same architecture as in the EDL model, we have as the evidence lower bound (ELBO) to be maximized
N
[Equation]
=
[Equation]
that is the negative ELBO is equal to the EDL loss up to an additive constant.
A. P OSTERIOR P REDICTIVE
For a new input observation x ∗
[Equation]
the corresponding posterior predictive distribution on the output y ∗ can be computed as
[Equation]
where h kθ = h θ ( v θ ( x ∗ ) , a ( v θ ( x ∗ ); Z ))
k .
That is, we can compute it analytically up to a samplingbased evaluation of the expectation over p ( Z | M ) .
B E XPERIMENTAL D ETAILS B. S YNTHETIC 1 D TWO - CLASS CLASSIFICATION
[Figure]
D e n s i t y − −
[Figure]
M e m o r y
E v i d e n c e
We illustrate the qualitative behaviour of
ETP on a synthetic 1d two-class classiﬁcation task.
The data consist of observations (20 per class) from two highly overlapping Gaussian distributions.
The neural net, a simple one hidden layer architecture, can learn the task with high accuracy.
Figure 4 shows the raw data and underlying distributions as well as the learned memory evidence.
The model learns to place more evidence on the correct class further away from the decision boundary while also becoming more varied with increasing distance.
Within the high-density region, the asymmetry in how the speciﬁc observations are spread out leads to an asymmetry in the memory evidence.
Below zero, the blue points are clearly separated, leading to a quick emphasis on that class as we move towards the left.
Above zero, however, some blue observations in the orange region prevent the model from rapidly developing over-conﬁdence.
This synthetic data set consisting of two classes with 20 observations each sampled from standard normal distributions centered at ± 1 respectively.
The encoding function v φ ( · ) consists of a multi-layer perceptron with a single hidden layer consisting of 32 neurons and a ReLU activation function.
It is optimized for 400 epochs with the Adam optimizer (Kingma & Ba, 2015) using the PyTorch (Paszke et al., 2019) default parameters and a learning rate of 0 .
In order to keep the model as simple
[Figure]
e
[Figure]
o r y
E v i d e n c e as possible, the key generator function k λ ( · ) is constrained to being the identity function, while h ξ (cid:0) v ( x ) , a ( v ( x ); Z ) (cid:1) =
v ( x ) + tanh( a ( v ( x ); Z ) .
The memory update is simpliﬁed to dropping the tanh( · ) rescaling.
B. I RIS 2 D THREE - CLASS CLASSIFICATION
The data set used in this experiment is the classical Iris data set 3 consisting of 150 samples of three iris species (50 per class), with four features measured per sample.
We ﬁrst map the data to the ﬁrst two principal components for visualization and also use this modiﬁed version as the training data.
This gives an interpretable toy learning setup where one class is clearly separated from the other two overlapping classes.
The encoding function v φ ( · ) consists of an MLP with two hidden layers ofneurons each and ReLU activation functions.
We train it for 400 epochs with the Adam optimizer using the PyTorch default parameters and a learning rate of 0 .
In order to keep the model as simple as possible, we constrain the key generator function k λ ( · ) to the identity function while setting h ξ (cid:0) v ( x ) , a ( v ( x ); Z ) (cid:1) = v ( x ) + tanh( a ( v ( x ); Z ) .
We simplify the memory update by dropping the tanh( · ) rescaling.
Figure 5 shows the varying importance the model assigns to different parts of the input space depending on the class under consideration.
For the separate blue class, the model is signiﬁcantly more conﬁdent in relative terms and absolute values.
B. E XPERIMENTS ON R EAL D ATA
All experiments are implemented in PyTorch (Paszke et al., 2019) version 1.7.1 and trained on a
TITAN RTX.
They have been replicated ten times over random initial seeds.
Fashion MNIST (FMNIST).
We use a LeNet5-sized architecture (see Table 3).
The out-ofdistribution data is the MNIST (LeCun et al., 2010) data set.
We z-score normalize all data sets with the in-domain mean and standard deviations.
We train each model for 50 epochs with the Adam optimizer (Kingma & Ba, 2015) using a learning rate of 0 .
[Table]
CIFAR10 (C10).
We use a LeNet5-sized architecture (see Table 3).
The out-of-distribution data is the SVHN (Netzer et al., 2011).
We z-score normalize all data sets with the in-domain mean and standard deviations.
We further rely on data augmentation for the in domain data using random crops with 32 pixels and four pixel padding as well as horizontal ﬂips.
We train each model for 100 epochs using the Adam optimizer (Kingma & Ba, 2015) with a learning rate of 0 . 0001 .
SVHN.
We use a LeNet5-sized architecture (see Table 3).
The out-of-distribution data is the
CIFAR10 data set.
We z-score normalize all data sets with the in-domain mean and standard deviations.
We train each model for 100 epochs using the Adam optimizer (Kingma & Ba, 2015) with a learning rate of 0 . 0001 .
IMDB Sentiment Classiﬁcation.
We use a LSTM architecture with 64 embedding dimensions and 2 layers with 256 hidden dimensions.
We generate the out-of-distribution data by sampling values from the [1 , 1000] interval uniformly at random.
We train each model for 20 epochs using the
SGD optimizer (Robbins & Monro, 1951) with a learning rate of 0 . 05 and 0 .
9 momentum.
For data preparation, we follow the source code of the original work 4 .
Shared Details and Observations.
In all experiments, we train the BNN models with a crossentropy loss using softmax as the squashing function to calculate class probabilities.
The EDL model is trained with the original loss (Sensoy et al., 2018).
We make our predictions with the mean of the Dirichlet distribution as in the original work.
For all models, we use entropy as the criterion for detecting out-of-distribution instances.
[Table]
Robustness against perturbations.
We use the CIFAR10-C dataset in the same setup as in original work tHendrycks & Dietterich (2019).
As FMNIST-C and SVHN-C are not available, we create them following the same procedure as in the original work.
For FMNIST we adapt the procedure to gray-scale images by replicating the image three times for each channel.
After applying the distortions, we map it back to the gray scale.
Table 4 gives the numerical results used to create Figure 3 in the main paper.