Uncertainty Quantification using Deep Evidential Regression
This is a follow-up article from Amitesh's post on Evidential Learning, which covers uncertainty quantification (UQ) for discrete classification tasks. It's a great pre-read.
Citing from the same, imagine an image classification model trained on car vs. truck tasks, but which is being inferred for, let's say, a horse image. The model's softmax would still output something like [0.6, 0.4] and is incapable of saying that it doesn't know because this example doesn't match anything it was trained on. This is the main motivator behind UQ: to give the model the capability of expressing its uncertainty.
In this article, we will review the Deep Evidential Regression paper by A. Amini [1]. It's a workaround of the original Evidential Deep Learning paper by Sensoy [2], to enable UQ on regression tasks.
Epistemic uncertainty is: "How much does the model not know about the true function at this point?" It can be both high in the In-Distribution (ID) region and low in the Out-Of-Distribution (OOD) region. While ID/OOD is a statement about the data distribution, epistemic uncertainty is a statement about model knowledge.
Precise and calibrated uncertainty estimates are useful for interpreting confidence, capturing domain shift of out-of-distribution (OOD) test samples, and recognizing when the model is likely to fail.
There are two axes of NN uncertainty that can be modeled:
- Uncertainty in the data, called aleatoric uncertainty.
- Uncertainty in the prediction, called epistemic uncertainty.
There exist several approaches for estimating epistemic uncertainty, such as Bayesian NNs, which place probabilistic priors over network weights and use sampling to approximate output variance [3]. However, Bayesian NNs face several limitations, including the intractability of directly inferring the posterior distribution of the weights given data, the requirement and computational expense of sampling during inference (this refers to multiple inference runs on the same input but with different weights based on the approximate posterior), and the question of how to choose a weight prior.
Instead of placing priors on network weights, as is done in Bayesian NNs, evidential approaches place priors directly over the likelihood function. By training a neural network to output the hyperparameters of the higher-order evidential distribution, a grounded representation of both epistemic and aleatoric uncertainty can then be learned without the need for sampling.
The Evidential Regression Framework
We consider the problem where the observed targets, , are drawn i.i.d. from a Gaussian distribution, as in standard MLE, but now with unknown mean and variance , which we seek to also probabilistically estimate. Here the paper actually proposed a vague definition as given below:
Here it's saying that all targets are sampled from a common normal distribution, but this is vague, because each task output is dependent on the corresponding . So the paper is being slightly loose. It really means:
- Independent : yes, strictly speaking.
- Identically distributed : only in the sense that the same network generates all , not that every sample comes from the literal same Gaussian.
A better setting would have been: where and
In standard MLE, and are fixed but unknown constants. The network learns single fixed values for them.
Now the paper says: what if and are not fixed? What if we are also uncertain about what the true and are?
In a crux, instead of saying:
- "yᵢ comes from a Gaussian with fixed μᵢ, σᵢ²"
We say:
- "yᵢ comes from a Gaussian, but we don't even know μᵢ and σᵢ² exactly, they are themselves random variables."
This embeds the learning of epistemic uncertainty into the learning of the model.
NOTE: In the normal MLE settings, the model would have learnt which only covers the aleatoric uncertainty, i.e., .
Again, the paper does its sloppy act and talks of computing a posterior over and given the examples. This didn't make sense to me, so I reasoned a lot with Claude over this and we came to a common decision.
CLAUDE's response on Posterior Framing
The notation is problematic for two reasons:
Reason 1: Which ? As you correctly identified — in heteroscedastic regression each input has its own . So asking for a posterior over a single given all observations makes no sense. It would need to be a per-input posterior conditioned on that specific observation and input, not a global posterior over all points.
Reason 2: are outputs, not parameters A posterior is meaningful when you are being uncertain about parameters — like weights in a Bayesian NN. But here are deterministic outputs of the network given . There is nothing to put a posterior over in the traditional sense.
What the paper is really doing is placing a prior over for each input and then maximizing the marginal likelihood — not computing any posterior at all.
Bottom line: The posterior framing in Section 3.1 is largely cosmetic. The paper never computes a posterior, never uses the posterior, and the notation is technically incoherent given the heteroscedastic setup. It is misleading framing dressed up to sound Bayesian.
So for now, you can settle on the fact that we have designed the prior over and as a Normal Inverse-Gamma (NIG) distribution.
The NIG prior factorizes as:
where:
Multiplying these two densities gives the NIG distribution:
From the paper:
A popular interpretation of the parameters of this conjugate prior distribution is in terms of "virtual observations" in support of a given property. For example, the mean of a NIG distribution can be intuitively interpreted as being estimated from virtual-observations with sample mean , while its variance is estimated from virtual-observations with sample mean and sum of squared deviations . Following from this interpretation, we define the total evidence, , of our evidential distributions as the sum of all inferred virtual-observations counts: .
"In this work, we use neural networks to infer, given an input, the hyperparameters, , of this higher-order, evidential distribution." (Amini et al., p. 4)
"Third, we can effectively estimate the epistemic or model uncertainty associated with the network's prediction by simply evaluating the variance of our inferred evidential distribution." (Amini et al., p. 4)
This is the term representing the epistemic uncertainty, how much certain is the the model of the prediction. A lower variance of means the model is more certain of the prediction.
Remember: The virtual observation interpretation says: higher means more evidence, meaning the model has "seen more support" for its prediction. The implicit promise is that evidence should grow as the model sees more of a particular input region.
Learning the evidential distribution
"For clarity, we structure the learning process as a multi-task learning problem, with two distinct parts: (1) acquiring or maximizing model evidence in support of our observations and (2) minimizing evidence or inflating uncertainty when the prediction is wrong." (Amini et al., p. 4)
The regularizer specifically targets this — it says: if you are wrong, you must be uncertain.
(1) Maximizing the model fit using Maximum Marginal Likelihood Estimate
Ignore the middle part, then it's simply a weighted average over the probability distribution. In Maximum Likelihood Estimate, we use the point estimate:
But since now we have a distribution over and as well, we use a weighted average. We know is Gaussian and we chose as NIG, and so this intractable solution becomes tractable as:
where is the Student-t distribution evaluated at with location , scale , and degrees of freedom.
Applying NLL on this gives:
In this section our aim is to design an objective using which the model learns to output correct predictions for the training data points. Without any constraints the model can just learn to be highly confident everywhere, because these NN's can span any function and it would be easy for them to just overfit on the training examples atleat in terms of its certainty. This is not what we want, so we add a regularization term.
(2) Minimizing evidence on errors
Next, we describe how to regularize training by applying an incorrect evidence penalty (i.e., high uncertainty prior) to try to minimize evidence on incorrect predictions.
This has been demonstrated with success in the classification setting where non-misleading evidence is removed from the posterior, and the uncertain prior is set to a uniform Dirichlet [2]. The analogous minimization in the regression setting involves , where are the parameters of the uncertain NIG prior with zero evidence (i.e., ). Unfortunately, the KL between any NIG and the zero evidence NIG prior is undefined.
To address these challenges in the regression setting, the authors formulate a novel evidence regularizer:
This loss imposes a penalty whenever there is an error in the prediction and scales with the total evidence of our inferred posterior.
NOTE: This is the most important part because it is here that we can design the objective or what being uncertain means for us. So, in the paper they have used the heuristic that uncertainty should be high when the prediction is wrong. This intuitively seems right as well but there can be other ways to define this as well. We can design a method which assigns uncertainty based on the density of training examples it has seen in that region. Remember we defined Evidential learning to be evidence acquisition process which actually should be framed with how many examples the model has seen that are similar to the present one. I am open to discussing more on this, so please feel free to reach out to me on my mail or x.
The total loss, , consists of the two loss terms for maximizing and regularizing evidence, scaled by a regularization coefficient, :
Loophole: The regularizer mixes two fundamentally different failure modes: prediction error due to in-distribution data noise, and prediction error due to out-of-distribution inputs. For in-distribution training points where the model errs, the NLL loss and the regularizer send contradictory signals simultaneously: the former pushes the predicted mean toward the target while the latter penalizes evidence, effectively teaching the model to be uncertain in a region where it has already learned or has evidence to be certain. A principled regularizer would need to distinguish between these two cases rather than treating prediction error as a uniform proxy for epistemic uncertainty.
- amini2020: Amini, A., Schwarting, W., Soleimany, A., & Rus, D. "Deep Evidential Regression." Advances in Neural Information Processing Systems, 2020. Link
- sensoy2018: Sensoy, M., Kaplan, L., & Kandemir, M. "Evidential Deep Learning to Quantify Classification Uncertainty." Advances in Neural Information Processing Systems, 2018. Link
- blundell2015: Blundell, C., Cornebise, J., Kavukcuoglu, K., & Wierstra, D. "Weight Uncertainty in Neural Networks." ICML, 2015.
Use of AI: Yes, I used a lot of AI to understand and used some sentences where I found it did a really good job explaining the objective, but overall this is my review with my findings and shortcomings, so enjoy learning!