DECLoss#
- class torch_uncertainty.losses.DECLoss(annealing_step=None, reg_weight=None, loss_type='log', reduction='mean')[source]#
The Deep Evidential Classification (DEC) loss.
Trains a classifier to output Dirichlet evidence \(\mathbf{e} \in \mathbb{R}_{\geq 0}^C\) instead of class probabilities. The Dirichlet parameters are \(\boldsymbol{\alpha} = \mathbf{e} + 1\) and the total evidence \(S = \sum_c \alpha_c\) controls the predictive uncertainty (smaller \(S\) ⇒ more uncertainty). The full loss is the sum of an expected cross-entropy term (selected by
loss_type) and a KL regulariser that pushes evidence on incorrect classes towards zero, annealed by either a constantreg_weightor a linear schedule of lengthannealing_step.- Parameters:
annealing_step (
int|None) – Annealing step for the weight of the regularization term. Defaults toNone.reg_weight (
float|None) – Fixed weight of the regularization term. Defaults toNone.loss_type (
str) – Specifies the loss type to apply to the Dirichlet parameters:'mse'|'log'|'digamma'.reduction (
str|None) – Specifies the reduction to apply to the output:'none'|'mean'|'sum'.
References