Uncertainty, structured prediction, and causal learning · Uncertainty, structured prediction, and causal learning · UNC010 · Model
Deep evidential regression (normal–inverse-gamma)
Predict parameters of a distribution over Gaussian mean and variance using one deterministic network pass. The resulting Student-t predictive distribution can express heavy tails.
In CodeSplash
Documented in the Academy only. There's no Set up button.
- Availability
- Explained here
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Predict parameters of a distribution over Gaussian mean and variance using one deterministic network pass. The resulting Student-t predictive distribution can express heavy tails. The frequently used aleatoric/epistemic decomposition is a model-derived summary with documented identifiability and calibration limitations; it is not a substitute for empirical uncertainty validation.
Question / hypotheses
Can the predictive distribution score new observations well, and do its reported evidence components have the intended meaning? Separate those questions: a satisfactory predictive distribution does not uniquely identify its decomposition into kinds of uncertainty.
Architecture / computational structure
A shared encoder feeds four outputs: location γ, positive ν, α greater than one, and positive β. They parameterize a normal–inverse-gamma distribution. A Student-t marginal-likelihood loss is combined with an error-dependent evidence penalty; softplus-like transforms enforce the constraints.
Assumptions
The assumed scalar likelihood is Gaussian conditional on mean and variance, with normal–inverse-gamma mixing. The evidence construction is not a posterior over all neural weights. Mean/variance shifts, multi-modal targets and output parameter non-identifiability complicate interpretation.
Formula / computational definition
and . Then . For , and . A common loss is . Here is squared Student-t scale, not its variance.
Parameters and notation
Learned: neural weights producing γ, ν, α and β. Hyperparameters: evidence-penalty weight λ, positive-parameter transforms/floors, architecture and optimizer. These are predicted distribution parameters rather than fixed prior hyperparameters shared across all inputs; distinguish their numerical roles explicitly.
Fitting, fine-tuning, and adaptation
Fine-tune encoder and output head on target labels with careful learning rates; freezing an encoder is an available baseline. Re-estimate any target-scale normalization and recalibrate after adaptation. Changing the evidence penalty can change the uncertainty allocation even when predictive fit barely changes.
How to use and calibrate
Evaluate Student-t NLL, interval coverage/width, error–uncertainty ranking and prescribed shifts. Perform sensitivity analysis over λ and output constraints. Compare with an ordinary heteroscedastic regressor and deep ensemble. Plot predictive total variance separately from the claimed evidence decomposition.
Example application
Predict a continuous image-derived measurement and compare predictive interval quality across image-quality levels. Explicitly inspect cases with large error but strong reported evidence.
Interpretation / pitfalls
Watch out
Several parameter combinations can yield the same predictive distribution while assigning different epistemic values. Primary follow-up work identifies foundational limitations. Do not describe the output as guaranteed Bayesian uncertainty or an automatic detector of every out-of-distribution input.
Python and R code examples
Scope: Scalar predictive-NLL, evidence penalty and variance-component calculation. It verifies the decomposition algebra for a fixed admissible output, not evidential network training or calibration.
Dependencies / validation: use the shared NumPy/SciPy or base-R setup above. Python executed successfully with assertions; R reviewed but not executed.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — Scalar predictive-NLL, evidence penalty and variance-component calculation. It verifies the decomposition algebra for a fixed admissible output, not evidential network training or calibration.
Shared setup for this chapter
import numpy as np
from scipy.special import logsumexp, gammaln
from scipy.linalg import expm
from itertools import product
def rbf(a, b, ell=1.0):
a, b = np.atleast_2d(a), np.atleast_2d(b)
return np.exp(-np.sum((a[:, None, :] - b[None, :, :])**2, axis=2)/(2*ell**2))
y,gamma,nu,alpha,beta = 1.4,1.0,2.0,3.0,1.2
Omega = 2*beta*(1+nu)
nll = .5*np.log(np.pi/nu)-alpha*np.log(Omega)+(alpha+.5)*np.log(nu*(y-gamma)**2+Omega)+gammaln(alpha)-gammaln(alpha+.5)
aleatoric = beta/(alpha-1); epistemic = beta/(nu*(alpha-1))
scale2 = beta*(1+nu)/(alpha*nu); predictive = scale2*(2*alpha)/(2*alpha-2)
penalty = .01*abs(y-gamma)*(2*nu+alpha)
assert np.isclose(predictive,aleatoric+epistemic)
print({'nll':float(nll),'loss':float(nll+penalty),'predictive_variance':predictive})
Component demo, not a trained model — Scalar predictive-NLL, evidence penalty and variance-component calculation. It verifies the decomposition algebra for a fixed admissible output, not evidential network training or calibration.
y <- 1.4; gamma <- 1; nu <- 2; alpha <- 3; beta <- 1.2
Omega <- 2*beta*(1+nu)
nll <- .5*log(pi/nu)-alpha*log(Omega)+(alpha+.5)*log(nu*(y-gamma)^2+Omega)+lgamma(alpha)-lgamma(alpha+.5)
aleatoric <- beta/(alpha-1); epistemic <- beta/(nu*(alpha-1))
scale2 <- beta*(1+nu)/(alpha*nu); predictive <- scale2*(2*alpha)/(2*alpha-2)
penalty <- .01*abs(y-gamma)*(2*nu+alpha)
stopifnot(abs(predictive-aleatoric-epistemic)<1e-12)
print(c(nll=nll,loss=nll+penalty,predictive_variance=predictive))
Sources
- Amini et al. deep evidential regressionarxiv.org
- Primary analysis of limitationsojs.aaai.org
- Identifiability and uncertainty critiqueproceedings.mlr.press
From the CodeSplash reference, entry UNC010.