PostProcessingCriterion#

class torch_uncertainty.ood_criteria.PostProcessingCriterion[source]#

OOD criterion based on the Maximum Softmax Probability (MSP) baseline of Hendrycks & Gimpel (ICLR 2017).

Defined as the negative of the maximum predicted class probability:

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

where \(\mathbf{p} = [p_1, \dots, p_C]\) is the predictive distribution. Lower maximum probabilities indicate greater uncertainty.

Variables:

input_type – Expected input type is probabilities.

forward(inputs)#

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