15 / 15 · Scalable Inference
Bayesian deep learning
Why put a distribution over the weights of a neural network, and four practical ways to approximate it: Bayes by Backprop, MC dropout, deep ensembles and the Laplace approximation.
Black-box variational inference and the VAE · The Laplace approximation and Bayesian classification · Neural networks
On this page 10
Take 40 points on and 40 on , with plus noise of standard deviation , and fit a network with ReLU units by Adam on the squared error. Its only notion of uncertainty is the standard deviation of its residuals, , and it attaches that number to every input.
In the gap, at , it predicts where , five of its standard deviations away. Beyond the data it is worse. At it predicts where , and at it predicts where . A ReLU network continues linearly outside its training range, and nothing in its output says that it is guessing.
How can a network report that it does not know? Black-box variational inference fitted posteriors over latent variables with a network inside the likelihood; here the unknowns are the weights of the network itself.
Why put uncertainty in the weights#
Let be the network with weights , trained on data . Many weight vectors fit 80 points equally well; they agree where there are data and disagree in the gap. The Bayesian answer keeps all of them, weighted by the posterior, and averages their predictions:
where are samples from , an approximation of the posterior. For regression with noise variance , , and the law of total variance splits the predictive variance in two:
with both moments under the posterior. The first term, the noise, is aleatoric uncertainty and does not shrink with more data. The second, epistemic uncertainty, is the disagreement between plausible networks. It should be small near the training data and large where there are none, and it should shrink as data accumulate.
Bayesian linear regression and Gaussian processes compute this term exactly. For a network, the posterior over weights, with in the millions, has no closed form and many modes. Some are copies: permuting the hidden units of a layer together with their weights computes the same function, so every mode of our network is one of relabelled copies. Even Hamiltonian Monte Carlo (HMC), the reference method since Neal (1996), is affordable only for small networks: each of its leapfrog steps needs a gradient over the whole data set, and a chain needs thousands of them.
A predictive distribution from samples of the weights
In the figure, the five members of an ensemble predict between and at . Their variance, , dwarfs the noise variance, , and the predictive standard deviation is , four times that of the single network.
The posterior matters only through this integral. Wilson and Izmailov (2020) point out that two weight settings that compute almost the same function add almost nothing to the average. A good approximation for prediction is one whose samples differ as functions.
The deep generative models of the next course put their uncertainty elsewhere. The VAE integrates over the latent code of each example through its encoder, and a diffusion model over the chain of noisy images between the data and pure noise. Both fit their network weights by maximizing a lower bound on , which returns a single : the latents are averaged over, the weights are a point estimate. Neither model says how uncertain its own weights are; the methods below would be needed for that.
Bayes by Backprop#
Bayes by Backprop (Blundell et al., 2015) is black-box variational inference with the reparameterization gradient, applied to the weights; Murphy (2023, Section 17.3.3) calls it stochastic variational inference with a network as the likelihood. The family is a diagonal Gaussian, , with , so that the standard deviation stays positive for any real . The loss is the negative ELBO,
estimated with one draw , . Write for the sampled loss and for its ordinary backpropagation gradient. The chain rule gives the gradients of the variational parameters (their equations 3 and 4):
The first terms carry back through the sample:
The second terms differentiate the explicit dependence of on and at fixed . One backward pass serves both gradients; the price is twice the parameters and a noisy gradient.
Worked example. One weight with and has . The draw gives , and the factor in is . Against the prior , by the closed form derived in the VAE note, this weight costs
A network with a million such weights pays millions of nats of KL, which the likelihood of the data has to justify; weights the data do not need are pushed back towards the prior.
The prior matters in practice. Blundell et al. use a scale mixture of two zero-mean Gaussians per weight, with and : a heavy tail with a spike near zero. Its KL has no closed form and is estimated from the same samples. They found that fitting the prior’s parameters to the data made results worse, so they fixed them by validation.
With mini-batches per epoch, each batch loss carries a share of the KL, for example , so that the losses of an epoch sum to (their Section 3.4): for independent examples , and the shares of the KL add up to one KL. One weight sample per mini-batch is shared by all its examples, which correlates their gradients. The local reparameterization trick (Kingma, Salimans and Welling, 2015) samples the pre-activations of each example instead. A pre-activation is a linear combination of independent Gaussian weights, so can be drawn directly, with fresh noise for every example; Kingma et al. show that this lowers the variance of the gradient at no extra cost.
On MNIST with two hidden layers of 1200 ReLU units, Blundell et al. report these test errors (their Table 1):
| Method | Test error |
|---|---|
| SGD | |
| SGD with dropout | |
| Bayes by Backprop, Gaussian prior | |
| Bayes by Backprop, scale-mixture prior |
With a plain Gaussian prior, Bayes by Backprop was worse than unregularized SGD; the prior made the difference. Each iteration was about twice as slow as dropout. Dropping the 95% of weights with the smallest ratio left the error at (their Table 2).
MC dropout as approximate variational inference#
Dropout zeroes each unit with probability during training. Gal and Ghahramani (2016) read it as variational inference. Their family sets the weight matrix of layer to , where is a learned matrix and the entries of are independent Bernoulli variables that keep a unit with probability . A draw from is a network with some input units of each layer removed.
They show that the dropout loss with L2 weight decay equals, up to a constant factor, a one-sample Monte Carlo estimate of the negative ELBO for this under a Gaussian prior. The model precision is then for a prior length-scale ; their equation 7 writes the same with the keep probability.
The correspondence is easy to see in outline. Drawing a mask is drawing a weight matrix from , so the dropout loss on one mask is a one-sample, reparameterized estimate of . The KL term to the Gaussian prior is not finite for this ; the authors replace each Bernoulli component by a narrow Gaussian and, for many hidden units, the KL becomes a squared-norm penalty on weighted by the keep probability, which is weight decay. The full argument is in the appendix of Gal and Ghahramani (2016), and the next subsection discusses its weak points.
The practical consequence is MC dropout, short for Monte Carlo dropout: keep dropout on at test time, run stochastic forward passes, and use their mean and variance,
The second formula is the law of total variance again: noise plus the spread of the sampled networks. MC dropout costs nothing at training time and forward passes at test time. In the experiment, with and 500 passes, its predictive standard deviation, with the residual noise variance of the fit in place of , grows from on the data to in the gap and to beyond the data.
The debate#
Optional depth: why MC dropout is an approximate posterior only in a weak sense. The rest of the note does not depend on it.
The variational objective is not well defined. A whose draws set whole columns of exactly to zero puts its mass on a set of measure zero under a Gaussian prior, so is infinite. The finite KL of the derivation comes from a limit with a small Gaussian around each mixture component. Hron, Matthews and Ghahramani (2018) make this precise and propose a quasi-KL divergence that stays finite.
The approximation also does not concentrate. The dropout rate is a hyperparameter fixed before training, and the data never change it. Osband, Aslanides and Cassirer (2018), Lemma 1, observe that the trained dropout distribution is unchanged when every data point is duplicated, whereas a posterior from twice the data would be narrower. Murphy (2023, Section 17.3.1) adds that as the data grow, a true posterior collapses to a point while the dropout distribution keeps dropping units with the same probability. Learning the rate, as in concrete dropout (Gal, Hron and Kendall, 2017), addresses this only partly.
Used as a heuristic, MC dropout still widens predictions where the data are thin, at almost no cost. In a large comparison under dataset shift, Ovadia et al. (2019) found it ahead of temperature scaling and of last-layer methods on CIFAR-10 and ImageNet, and consistently behind deep ensembles.
Deep ensembles#
A deep ensemble (Lakshminarayanan, Pritzel and Blundell, 2017) trains networks independently, from different random initializations and with different shuffling of the data, and treats them as a uniform mixture. For regression each network may output a mean and a variance , trained by the Gaussian negative log-likelihood, a proper scoring rule. The mixture is summarized by its mean and its variance, which is the second moment minus the squared mean; each member’s second moment is :
The recommended default is . Adversarial training is optional, and training on bootstrap samples, as in bagging, made results worse than random initialization alone: each member then sees only about 63% of the distinct points, since a point is missed by all draws with probability (bagging note).
Ensembles are not derived from a posterior, yet Wilson and Izmailov (2020) argue that they approximate Bayesian model averaging better than most methods that are. Each member sits in a different basin of the loss, and members from different basins compute different functions, which is what the average needs. A diagonal Gaussian or a Laplace approximation describes one basin, where the networks are often nearly redundant. MultiSWAG, their refinement, also fits a Gaussian within each member’s basin, so that the average runs both across and within basins.
The costs are trainings and forward passes, which can be reduced afterwards by distilling the ensemble into one network. In the experiment, five networks trained on the squared error have a predictive standard deviation of on the data and in the gap, the widest of the three models there.
The Laplace approximation for networks#
The Laplace approximation of the course fits a Gaussian at the mode: , with the Hessian of the negative log posterior at the MAP weights. For networks it goes back to MacKay (1992), who also used the evidence of this Gaussian to choose the weight decay. Two obstacles made it unpopular, and both have been worked around (Daxberger et al., 2021).
The Hessian is . It is replaced by a positive semidefinite approximation, the generalized Gauss–Newton matrix or the Fisher, with diagonal or Kronecker-factored structure (KFAC, Ritter, Botev and Barber, 2018). Or it is computed only for the last layer, where it is small: with the other layers frozen as features, the last-layer Laplace approximation of a regression network is Bayesian linear regression on those features. There it is exact: the output is linear in the last-layer weights, so with a Gaussian likelihood and a Gaussian prior the log posterior is quadratic, and a Gaussian fitted at its mode is the posterior itself.
Sampling weights and pushing them through the network predicts poorly with these approximations. The reason is that the Gauss–Newton matrix is the exact Hessian of the network linearized at , so the Gaussian is a posterior for that linear model, not for the network (Immer, Korzepa and Bauer, 2021). A linearized predictive uses the matching model. With the Jacobian at and ,
because a linear map of a Gaussian is Gaussian. For the last layer the expansion is exact.
Its main practical advantage is that it is post hoc: a network trained in the usual way gets uncertainty afterwards, at the cost of one curvature computation. Like Bayes by Backprop, it describes one mode.
Sampling the weights with noisy gradients#
The methods so far approximate the posterior by a fixed family. Sampling avoids that, at the price of time. Stochastic-gradient Langevin dynamics (SGLD) of Welling and Teh (2011) adds Gaussian noise to stochastic gradient ascent on the log posterior:
It is the Langevin update with a mini-batch gradient scaled by , as in SVI. Why the mini-batch noise stops mattering: the gradient error enters the step multiplied by , so its variance scales as , while the injected noise has variance ; their ratio goes to zero with the step. As the steps shrink, the discretization error of the Langevin update shrinks too, and Welling and Teh argue that the Metropolis–Hastings acceptance rate tends to one, so the correction can be dropped. The precise statement: with steps meeting the Robbins–Monro conditions, a smooth log posterior and bounded moments of the iterates, step-weighted averages of a test function along the chain converge to its posterior expectation (Teh, Thiery and Vollmer, 2016). The HSE course derives it from Langevin dynamics; Murphy (2023, Section 12.7) covers the preconditioned variants used for networks. Its samples are correlated and cover the modes slowly, and the predictive averages over many saved weight vectors.
Calibration and inputs far from the data#
A classifier is calibrated when, among the inputs to which it assigns probability , a share of belongs to the class; the logistic regression note defines the reliability diagram and the expected calibration error. Modern networks are often overconfident: on CIFAR-100, the average confidence of a 110-layer ResNet is well above its accuracy, while that of a 5-layer LeNet matches it (Guo et al., 2017, Figure 1). Within the training distribution one scalar fixes most of this: temperature scaling divides the logits by a fitted on validation data. It cannot single out inputs unlike the training data: one rescales every logit vector alike, and it never changes which class wins. That is where averaging over weights is supposed to help.
Far from the data, single networks are confidently wrong. A ReLU network is piecewise linear with finitely many linear pieces, so a ray eventually stays in one piece, where the logits are for a fixed matrix and vector . If one component of exceeds the others, its softmax probability tends to 1 as . So almost every ReLU classifier becomes arbitrarily confident far enough from its training data (Hein, Andriushchenko and Bitterwolf, 2019, Lemma 3.1 and Theorem 3.1). The regression shows the same mechanism in one dimension.
Uncertainty where there are no data
Predictive standard deviations, and the error of the mean at in units of the model’s own standard deviation:
| Model | On the data | In the gap | At | At | Error at |
|---|---|---|---|---|---|
| deterministic network | , 25 std | ||||
| MC dropout | , 7 std | ||||
| deep ensemble | , 17 std |
Both approximations widen their bands where the data end, the ensemble four times in the gap, but not nearly enough beyond the data: all three means extrapolate linearly, and every model is wrong at by many of its own standard deviations. The approximations are better than one network and still overconfident out of distribution. Large studies tell the same story at scale: under increasing dataset shift, calibration degrades for every method, and deep ensembles degrade the least (Ovadia et al., 2019). The table describes one small run; on other problems the order can differ.
The true posterior of a network can be checked only on small problems with long HMC runs, so an approximation is judged by its predictions: calibration, held-out likelihood, behaviour under shift. And an isotropic Gaussian prior on the weights induces a prior over functions that is poorly understood, while the predictive depends on it.
Choosing an approximation#
| Bayes by Backprop | MC dropout | Deep ensemble | Laplace | |
|---|---|---|---|---|
| Distribution over weights | diagonal Gaussian | Bernoulli masks of trained weights | trained networks | Gaussian at the MAP |
| Extra training cost | about 2× per step, 2× parameters | none | trainings | one curvature computation |
| Prediction cost | passes | passes | passes | linearized, or passes |
| Modes covered | one | one | several | one |
Of the four, only the Laplace approximation can be added to a network that was trained in the usual way without dropout. When training several times is affordable, the ensemble was the most reliable under dataset shift among the methods Ovadia et al. compared, which did not include the Laplace approximation.
What you should remember#
- Predictive variance = noise + spread of plausible networks; only the spread grows where the data end.
- Bayes by Backprop: BBVI with reparameterization on a diagonal Gaussian over weights, ; its prior matters.
- MC dropout: dropout on at test time, passes; cheap, useful, and a posterior only in a weak sense.
- Deep ensembles: networks from different initializations cover several modes; the strongest under shift.
- Laplace: a Gaussian at the trained weights, post hoc, with a structured Hessian and a linearized predictive.
- All of them remain overconfident far from the data.
Code#
One weight of Bayes by Backprop, then the experiment: a deterministic network, MC dropout and a deep ensemble on the regression with a gap, with a small network, backpropagation and Adam written in NumPy. It prints the predictive mean and standard deviation on the data (), in the gap () and beyond the data ( and ). Seeds are fixed; exact numbers can vary across platforms and library versions. The script runs in about 5 seconds.
import numpy as np
# 0. one weight of Bayes by Backprop: sigma = softplus(rho), a reparameterized draw, and its KL to the prior N(0, 1)
mu_w, rho_w, eps_w = 0.3, -3.0, 0.5
sigma_w = np.log1p(np.exp(rho_w))
kl = np.log(1 / sigma_w) + (sigma_w ** 2 + mu_w ** 2) / 2 - 0.5
print(round(sigma_w, 4), round(mu_w + sigma_w * eps_w, 4), round(eps_w / (1 + np.exp(-rho_w)), 4), round(kl, 3))
# 0.0486 0.3243 0.0237 2.571
# 1. data with a gap: 40 points on [-4, -1] and 40 on [1, 4], y = sin(x) + noise of standard deviation 0.1
rng = np.random.default_rng(0)
x = np.concatenate([rng.uniform(-4, -1, 40), rng.uniform(1, 4, 40)])
y = np.sin(x) + 0.1 * rng.normal(size=x.size)
X, Y = x[:, None], y[:, None]
grid = np.linspace(-7, 7, 57)[:, None] # step 0.25, the grid of the figure
at = [18, 38, 28, 52, 0] # the printed points: x = -2.5, 2.5, 0, 6, -7
XG = np.vstack([X, grid]) # predictions on the training points and on the grid
# 2. a 1 -> 128 -> 128 -> 1 ReLU network, with optional (inverted) dropout after each hidden layer
def init(seed, sizes=(1, 128, 128, 1)): # uniform in +-1/sqrt(fan_in) for weights and biases
r = np.random.default_rng(seed)
return [r.uniform(-1, 1, s) / np.sqrt(m) for m, n in zip(sizes[:-1], sizes[1:]) for s in ((m, n), (n,))]
def forward(w, x, p=0.0, r=None):
"""Returns the output, the input of every layer and the ReLU-and-dropout mask of every hidden layer."""
hs, masks = [x], []
for i in range(0, len(w) - 2, 2):
z = hs[-1] @ w[i] + w[i + 1]
mask = (z > 0) * ((r.random(z.shape) >= p) / (1 - p) if p else 1.0) # ReLU, then dropout
masks.append(mask); hs.append(z * mask)
return hs[-1] @ w[-2] + w[-1], (hs, masks)
def grad(w, x, y, p=0.0, r=None):
"""Gradient of the mean squared error by backpropagation, last layer first."""
out, (hs, masks) = forward(w, x, p, r)
g, grads = 2 * (out - y) / len(x), []
for j in range(len(hs) - 1, -1, -1): # layer j has input hs[j] and weights w[2j], w[2j + 1]
grads = [hs[j].T @ g, g.sum(0)] + grads
if j:
g = (g @ w[2 * j].T) * masks[j - 1]
return grads
def train(seed, p=0.0, weight_decay=0.0, steps=3000, lr=3e-3):
"""Full-batch Adam on the squared error; weight decay is added to the gradient, as an L2 penalty."""
w, r = init(seed), np.random.default_rng(seed + 100)
m1, m2 = [np.zeros_like(a) for a in w], [np.zeros_like(a) for a in w]
for t in range(1, steps + 1):
grads = grad(w, X, Y, p, r)
for k, a in enumerate(w):
gk = grads[k] + weight_decay * a
m1[k] = 0.9 * m1[k] + 0.1 * gk; m2[k] = 0.999 * m2[k] + 0.001 * gk ** 2
a -= lr * (m1[k] / (1 - 0.9 ** t)) / (np.sqrt(m2[k] / (1 - 0.999 ** t)) + 1e-8)
return w
def report(name, mean, var_model, noise_var):
std = np.sqrt(var_model + noise_var).ravel()
print(f'{name:13}', 'mean', np.round(mean.ravel()[at], 2), 'std', np.round(std[at], 3))
print('sin(x) ', np.round(np.sin(grid.ravel()[at]), 2))
n = len(X)
# 3. a deterministic network: its only uncertainty is the noise variance estimated from its residuals
det = forward(train(0), XG)[0]
report('deterministic', det[n:], 0 * det[n:], ((det[:n] - Y) ** 2).mean())
# 4. MC dropout, p = 0.1: dropout stays on at test time; 500 stochastic passes give the mean and the model variance
w_mc, r = train(0, p=0.1, weight_decay=1e-4), np.random.default_rng(7)
S = np.stack([forward(w_mc, XG, 0.1, r)[0] for _ in range(500)])
noise = ((S[:, :n].mean(0) - Y) ** 2).mean() # noise variance from the training residuals of the mean
report('MC dropout', S[:, n:].mean(0), S[:, n:].var(0), noise)
# 5. a deep ensemble: five networks from different random initializations; var(0) is the 1/M of the mixture
P = np.stack([forward(train(k), XG)[0] for k in range(1, 6)])
report('ensemble', P[:, n:].mean(0), P[:, n:].var(0), ((P[:, :n].mean(0) - Y) ** 2).mean())
print('members at x = 0:', np.round(P[:, n + 28, 0], 2), 'variance', round(P[:, n + 28, 0].var(), 4),
'noise', round(((P[:, :n].mean(0) - Y) ** 2).mean(), 4))
# sin(x) [-0.6 0.6 0. -0.28 -0.66]
# deterministic mean [-0.57 0.56 0.4 -2.31 4.22] std [0.08 0.08 0.08 0.08 0.08]
# MC dropout mean [-0.58 0.59 0.12 -1.64 2.01] std [0.104 0.102 0.136 0.203 0.245]
# ensemble mean [-0.57 0.57 0.21 -2.32 3.82] std [0.078 0.077 0.336 0.123 0.509]
# members at x = 0: [-0.28 0.58 0.07 0.58 0.11] variance 0.107 noise 0.0057
The course in one paragraph#
Bayesian methods treat everything unknown as a random variable and answer every question with a distribution. The course followed what that costs and how to pay it, one section at a time.
The first section, Bayesian Modelling, set up the approach: the posterior as prior times likelihood, conjugate priors that keep it in closed form, and the evidence that compares models without a validation set.
The second, Bayesian Linear Models, applied it to linear models: Bayesian linear regression with its predictive variance, the relevance vector machine whose priors switch features off, and the Laplace approximation for classification, where conjugacy ends.
The third, Latent Variables and Approximate Inference, met posteriors without formulas: EM and Bayesian PCA for latent variables, variational inference that optimizes a lower bound, and Gibbs sampling that samples instead.
The fourth, Nonparametric and Topic Models, let the model grow with the data: Gaussian processes over functions and Dirichlet processes over partitions, and LDA, a topic model fitted by both of the previous section’s methods.
The fifth, Scalable Inference, made inference fit large data and any model: stochastic variational inference with mini-batches and natural gradients, black-box variational inference with Monte Carlo gradients and the VAE, and this note’s approximate posteriors over the weights of networks.
The Generative Models course builds on exactly these tools. The variational autoencoder and its variants are amortized variational inference, HMC and NUTS are the samplers that Gibbs sampling led to, and diffusion models are trained with an evidence lower bound on a chain of latent variables.
References#
- C. Blundell, J. Cornebise, K. Kavukcuoglu, D. Wierstra. Weight uncertainty in neural networks. ICML, 2015. Section 3.2 (Gaussian posterior, equations 3 and 4), Section 3.3 (scale-mixture prior), Section 3.4 (mini-batches and KL re-weighting), Tables 1 and 2.
- Y. Gal, Z. Ghahramani. Dropout as a Bayesian approximation: representing model uncertainty in deep learning. ICML, 2016. Section 3 (dropout as approximate inference), Section 4 (model uncertainty, equation 7).
- J. Hron, A. G. de G. Matthews, Z. Ghahramani. Variational Bayesian dropout: pitfalls and fixes. ICML, 2018.
- I. Osband, J. Aslanides, A. Cassirer. Randomized prior functions for deep reinforcement learning. NeurIPS, 2018. Section 2.1, Lemma 1.
- Y. Gal, J. Hron, A. Kendall. Concrete dropout. NeurIPS, 2017.
- B. Lakshminarayanan, A. Pritzel, C. Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. NeurIPS, 2017.
- A. G. Wilson, P. Izmailov. Bayesian deep learning and a probabilistic perspective of generalization. NeurIPS, 2020. Section 3.2 (the predictive integral and functional diversity), Section 3.3 (deep ensembles as Bayesian model averaging), MultiSWAG.
- M. Welling, Y. W. Teh. Bayesian learning via stochastic gradient Langevin dynamics. ICML, 2011.
- Y. W. Teh, A. H. Thiery, S. J. Vollmer. Consistency and fluctuations for stochastic gradient Langevin dynamics. Journal of Machine Learning Research, 17(7):1–33, 2016.
- A. Immer, M. Korzepa, M. Bauer. Improving predictions of Bayesian neural nets via local linearization. AISTATS, 2021.
- D. J. C. MacKay. A practical Bayesian framework for backpropagation networks. Neural Computation, 4(3):448–472, 1992.
- H. Ritter, A. Botev, D. Barber. A scalable Laplace approximation for neural networks. ICLR, 2018.
- E. Daxberger, A. Kristiadi, A. Immer, R. Eschenhagen, M. Bauer, P. Hennig. Laplace redux: effortless Bayesian deep learning. NeurIPS, 2021.
- D. P. Kingma, T. Salimans, M. Welling. Variational dropout and the local reparameterization trick. NeurIPS, 2015.
- C. Guo, G. Pleiss, Y. Sun, K. Q. Weinberger. On calibration of modern neural networks. ICML, 2017. Figure 1, Section 4.2 (temperature scaling).
- M. Hein, M. Andriushchenko, J. Bitterwolf. Why ReLU networks yield high-confidence predictions far away from the training data and how to mitigate the problem. CVPR, 2019.
- Y. Ovadia, E. Fertig, J. Ren, Z. Nado, D. Sculley, S. Nowozin, J. V. Dillon, B. Lakshminarayanan, J. Snoek. Can you trust your model’s uncertainty? Evaluating predictive uncertainty under dataset shift. NeurIPS, 2019.
- R. M. Neal. Bayesian Learning for Neural Networks. Lecture Notes in Statistics 118, Springer, 1996.
- K. P. Murphy. Probabilistic Machine Learning: Advanced Topics. MIT Press, 2023. Section 12.7 (stochastic-gradient MCMC), Chapter 17 (Bayesian neural networks: 17.3.1 MC dropout, 17.3.3 variational inference, 17.3.9 deep ensembles).
- «Байесовские методы машинного обучения», HSE Faculty of Computer Science, course page, 2021, with D. P. Vetrov’s lecture notes; lectures 9a and 9b (Hamiltonian Monte Carlo, Langevin dynamics and their stochastic-gradient versions).