lp_fn¶
- probly.losses.torch.lp_fn(alpha: Tensor, y: Tensor, p: float = 2.0) Tensor[source]¶
Lp calibration loss from [Tsi19].
Implements the Lp calibration loss for predictive uncertainty estimation in Information Robust Dirichlet Networks.
- 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
alphacontains non-positive values or if shapes do not match.