ird_loss¶
- probly.losses.torch.ird_loss(alpha: Tensor, y: Tensor, adversarial_alpha: Tensor | None = None, p: float = 2.0, lam: float = 1.0, gamma: float = 1.0, normalize: bool = True) Tensor[source]¶
Information Robust Dirichlet loss from [Tsi19].
Implements the Information Robust Dirichlet (IRD) loss, combining an Lp calibration term, a trigamma-based regularization term, and an optional entropy-based adversarial regularizer.
- Parameters:
alpha – Dirichlet concentration parameters, shape (B, K).
y – One-hot encoded class labels, shape (B, K).
adversarial_alpha – Dirichlet concentration parameters for adversarial inputs, shape (B_a, K).
p – Lp norm exponent controlling calibration strength.
lam – Weight of the regularization term.
gamma – Weight of the entropy regularization term.
normalize – Whether to normalize loss terms by batch size.
- Returns:
Scalar IRD loss summed over all input examples.