probly.train.evidential.torch.lp_fn

probly.train.evidential.torch.lp_fn(alpha: Tensor, y: Tensor, p: float = 2.0) Tensor[source]

Lp calibration loss for predictive uncertainty estimation.

Implements the Lp calibration loss proposed by Tsiligkaridis (2019) for Information Robust Dirichlet Networks.

Reference:

Tsiligkaridis, “Information Robust Dirichlet Networks for Predictive Uncertainty Estimation”, 2019. https://arxiv.org/abs/1910.04819

The loss is computed using the expectation-based formulation:

F_i = ( E[(1 - p_c)^p] + Σ_{j≠c} E[p_j^p] )^(1/p)

Parameters:
  • alpha – Dirichlet concentration parameters, shape (B, K), must be > 0.

  • y – One-hot encoded class labels, shape (B, K).

  • p – Lp norm exponent controlling calibration strength (default: 2.0).

Returns:

Scalar Lp calibration loss summed over the batch.

Raises:

ValueError – If alpha contains non-positive values or if shapes do not match.