3
$\begingroup$

Suppose I have a softmax distribution produced by a classifier. There are four labels, and so the sum of the softmax probabilities over the four labels will be 1.0.

I am looking for a measurement of how "certain" or "confident" the classifier's prediction is.

For example, suppose for two data instances, the softmax distributions are:

outcome1 = [0.25, 0.25, 0.20, 0.30]
outcome2 = [0.02, 0.94, 0.02, 0.02]

It's clear that the classifier is more confident in outcome2 since there is a large probability mass (0.94) on one of the labels. On the other hand, the classifier is less confident in outcome1 since the probabilities are fairly equal.

So I'm looking for a way to quantify this degree of "certainty" in a classifier's prediction.

One thing I was thinking of was computing the Shannon entropy of each outcome:

from scipy.stats import entropy
print(entropy(outcome1, base=2)) # 1.9854752972273344
print(entropy(outcome2, base=2)) # 0.4225426691977457

Can I say that the classifier is 1.98 / 0.42 = 4.7 times more confident in outcome2 versus outcome1?

$\endgroup$

1 Answer 1

2
$\begingroup$

Confidence and certainty are different concepts, though strongly linked. There are two important properties for use cases such as decision making. We look for classifiers that are certain about their outcome (they rely on clues that lead to actually correct outcomes), and confident (among all possible answers, the selected answer is deemed as much more likely to be true, with his own probability estimates).

To give a particular example: neural networks are prone to be overconfident (even when giving a wrong answer, the preferred answer has a much higher score than the rest). They are confident, but not certain (see On Calibration of Modern Neural Networks for a description of this issue). I would like to have a classifier that I can rely on, whenever he says is confident about an answer.

Confidence, thus, refers to how "sure" a classifier is about its outcome. In your example, the classifier is much more confident in his second prediction. But that does not mean it is certain. Entropy gives you a measure of how confident the predictions are, but not of how certain. Confidence is about the distributions of the outcome probabilities.

Certainty is more about being calibrated (the classifier estimates reflect the actual chances of something actually happening). Again, refer to the article.

$\endgroup$
2
  • $\begingroup$ Thanks for the answer. I was unaware that there were formal definitions of certainty and confidence. Given your explanation of certainty (that lead to actually correct outcomes), I suppose I can measure that with accuracy, F1, etc. I'm less conversant with confidence. I'll take a look at that paper you mentioned. $\endgroup$ Dec 31, 2020 at 19:47
  • $\begingroup$ Note that, AFAIK, there is no accepted definition of certainty. But when we use the word "certain" about a prediction, usually in the setting of decision making, we refer to the idea of being able to say what the chances are of being right/accurate. Like in weather predictions, tomorrow there is a 70% chance of raining. Which leads to the concept of calibration. $\endgroup$
    – jpmuc
    Jan 3, 2021 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.