ConflictualLoss#
- class torch_uncertainty.losses.ConflictualLoss(reg_weight=1, reduction='mean')[source]#
The Conflictual Loss.
Combines the standard cross-entropy with a conflictual regulariser that encourages the model to assign non-negligible probability to a uniformly random class \(c^\star\):
\[\mathcal{L} = \text{CE}(\mathbf{z}, y) - \lambda \log p_{c^\star}, \quad c^\star \sim \mathrm{Uniform}(1, C).\]This counteracts the natural tendency of cross-entropy to collapse all probability mass on a single class and improves the calibration of epistemic uncertainty estimates.
- Parameters:
reg_weight (
float) – The weight \(\lambda\) of the regularization term.reduction (
str|None) – Specifies the reduction to apply to the output:'none'|'mean'|'sum'.
References