disc_vbll_loss¶
- probly.losses.torch.disc_vbll_loss(layer: VBLLLayer, features: Tensor, targets: Tensor, regularization_weight: float) Tensor[source]¶
Negative discriminative VBLL ELBO from [HWS24].
Implements the discriminative classification objective of a
VBLLLayer: the closed-form double-Jensen lower bound on the expected log-likelihood, regularized by the weight-posteriorkl_divergenceand a Wishart term on the learnable noise precision. Both ingredients of the bound - the logit mean and the logit variancephi^T S_k phi + sigma_k^2- are exactly the(mean, var)returned by the layer’s forward pass.- Parameters:
layer – The variational Bayesian last layer to fit.
features – Backbone features feeding the layer, shape
(batch, in_features).targets – Integer class labels, shape
(batch,).regularization_weight – Weight on the regularization terms (typically
1 / dataset_size).
- Returns:
A scalar tensor with the negative ELBO to minimize.