probly.train.evidential.torch.natpn_loss¶
- probly.train.evidential.torch.natpn_loss(alpha: Tensor, y: Tensor, entropy_weight: float = 0.0001) Tensor[source]¶
Natural Posterior Network (NatPN) classification loss.
Implements the Dirichlet-Categorical Bayesian loss with an entropy regularizer as proposed by Charpentier et al. (2022).
- Reference:
Charpentier et al., “Natural Posterior Network”, NeurIPS 2022. https://arxiv.org/abs/2105.04471
- Parameters:
alpha – Posterior Dirichlet concentration parameters, shape (B, C).
y – Ground-truth class labels, shape (B,) with values in [0, C-1].
entropy_weight – Weight controlling the strength of the entropy regularization term.
- Returns:
Scalar NatPN loss averaged over the batch.