Confidence Scores

class moval.models.Confidence(score_type: str, negative_score: bool, normalization: bool)

Bases: ABC

Base model for confidence calculation.

Confidence scores can be computed by calling the __call__() method. This class should not be directly instaniated, and instead used as the base class for confidence scores calculation.

Atrributes:
score_type (str):

The name of confidence scores.

negative_score (bool):

A boolean that indicates if original confidence score is negative correlated to the classification correctness.

normalization (bool):

A boolean that indicates if original confidence score needs normalization before usage.

cal_func (:py:func):

The function to calculate the corresponding confidence scores.

reshape_inp(inp: ndarray) Tuple[ndarray, ndarray]

Reshape the input from arbitrary shape to (n, d).

Args:

inp: The network output (logits) of shape (n, d, H, W, (D)).

Returns:

inp: Reshaped network output of shape (n, d). inp_shape: The shape of original network output.

class moval.models.maxclassprobabilityConfidence

Bases: Confidence

Confidence scores based on max class probability.

Note:

The maximum class probability ([0, 1]) is high is the model is confident.

class moval.models.energyConfidence

Bases: Confidence

Confidence scores based on energy.

Note:

Energy is low is the model is confident, we should calculate negative energy. Original engergy is unbounded, we should normalize by finding the max/min value later.

class moval.models.entropyConfidence

Bases: Confidence

Confidence scores based on entropy.

Note:

Entropy is low is the model is confident, we should calculate negative entropy. We should also choose the base as class number to ensure that the largest entropy is 1.

class moval.models.doctorConfidence

Bases: Confidence

MOVAL model with doctor confidence.