EntropyCriterion#

class torch_uncertainty.ood_criteria.EntropyCriterion[source]#

OOD criterion based on entropy.

This criterion computes the mean entropy of the predicted probability distribution. Higher entropy values indicate greater uncertainty.

\[H(\mathbf{p}) = -\sum_{i=1}^{C} p_i \log(p_i)\]

where \(\mathbf{p} = [p_1, p_2, \dots, p_C]\) is the probability vector.

Variables:

input_type (OODCriterionInputType) – Expected input type is estimated probabilities.

forward(inputs)[source]#

Compute the entropy of the predicted probability distribution.

Parameters:

inputs (Tensor) – Tensor of estimated probabilities with shape (batch_size, num_classes).

Returns:

Mean entropy value for each sample.

Return type:

Tensor