natpn_loss¶
- probly.losses.torch.natpn_loss(alpha: Tensor, y: Tensor, entropy_weight: float = 0.0001) Tensor[source]¶
Natural Posterior Network loss from [CBZugner+22].
Implements the Dirichlet-Categorical Bayesian loss with an entropy regularizer for Natural Posterior Network (NatPN) classification.
- 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.