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 constant reg_weight or a linear schedule of length annealing_step.

Parameters:
  • annealing_step (int | None) – Annealing step for the weight of the regularization term. Defaults to None.

  • reg_weight (float | None) – Fixed weight of the regularization term. Defaults to None.

  • 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

[1] Sensoy, M., Kaplan, L., & Kandemir, M. (2018). Evidential deep learning to quantify classification uncertainty. NeurIPS 2018.