postnet_loss

probly.losses.torch.postnet_loss(alpha: Tensor, y: Tensor, entropy_weight: float = 1e-05, reduction: str = 'sum') Tensor[source]

Posterior Network classification loss from [CZugnerGunnemann20].

Implements the expected cross-entropy loss with an entropy regularizer for Posterior Networks (PostNet).

Parameters:
  • alpha – Dirichlet concentration parameters, shape (B, C).

  • y – Ground-truth class labels, shape (B,).

  • entropy_weight – Weight of the entropy regularization term. Defaults to 1e-5 as used in the original paper.

  • reduction – Specifies the reduction to apply to the output. Can be ‘mean’ or ‘sum’. Defaults to ‘sum’ to align with the implementation in the original paper.

Returns:

Scalar Posterior Networks loss averaged over the batch.

Examples using probly.losses.torch.postnet_loss

Natural Posterior Network on Two Moons

Natural Posterior Network on Two Moons

Natural Posterior Network on MNIST

Natural Posterior Network on MNIST

Posterior Network on Two Moons

Posterior Network on Two Moons

Posterior Network on MNIST

Posterior Network on MNIST