MaxSoftmaxCriterion#

class torch_uncertainty.ood_criteria.MaxSoftmaxCriterion[source]#

OOD criterion based on maximum softmax probability.

This criterion computes the negative of the highest softmax probability. Lower maximum probabilities indicate greater uncertainty. Probabilities are also called* likelihoods in a more formal context.

\[\text{score} = -\max_{i}(p_i)\]

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

Variables:

input_type (OODCriterionInputType) – Expected input type is probabilities.

forward(inputs)[source]#

Compute the negative of the maximum softmax probability.

Parameters:

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

Returns:

Negative of the highest softmax probability for each sample.

Return type:

Tensor