Solved – Decision threshold for a 3-class Naive Bayes ROC curve

aucclassificationmachine learningnaive bayesroc

I have some doubts regarding how a ROC curve for a 3-class classifier (Naive Bayes) can be built.

Basically, given some test data, the classifier outputs the probabilities for each of the 3 possible classes. In order to generate points for plotting the ROC curves, I am increasing a decision threshold th from 0.1 to 1.0 and computing FPR,TPR for each one of the 3 classes (using a one-vs-rest approach, since ROC curve is used for binary classification).

The problem is: suppose that, under a decision threshold of 0.5, we get data from class 1, and the classifier outputs class probabilities of 0.3, 0.4 and 0.3, respectively. Since there is not any probability over the decision threshold, should I leave this data unclassified? Should I classify this data to the class with greatest probability, even if such class probability is lower than the threshold?

And a last question: should naive bayes probabilities be calibrated before computing ROC points?

Best Answer

As I see it, the possibility to refuse classification as "too uncertain" is the whole point of choosing a threshold (as opposed to assigning the class with highest predicted probability).

Of course, you should have some justification for putting the threshold to 0.5: you may also put it up to 0.9 or any other value that is reasonable.

You describe a setup with mutually exclusive classes (closed-world problem). "No class reaches the threshold" can always happen as soon as that threshold is higher than 1/$n_{classes}$, i.e. the same problem occurs in a 2-class problem with threshold, say, 0.9. For threshold = 1/$n_{classes}$ it could happen in theory, but in practice it is highly unlikely.

So your problem is not related (just more pronounced) to the 3-class set-up.

To your second question: you can compute ROC curves for any kind of continuous output scores, they don't even need to claim that they are probabilities. Personally, I don't calibrate, because I don't want to waste another test set on that (I work with very restricted sample sizes). The shape of the ROC anyways won't change.

Answer to your comment: The ROC conceptually belongs to a set-up that in my field is called single-class classification: does a patient have a particular disease or not. From that point of view, you can assign a 10% probability that the patient does have the disease. But this does not imply that with 90% probability he has something defined - the complementary 90% actually belong to a "dummy" class: not having that disease. For some diseases & tests, finding everyone may be so important that you set your working point at a threshold of 0.1. Textbook example where you choose an extreme working point is HIV test in blood donations.

So for constucting the ROC for class A (you'd say: the patient is A positive), you look at class A posterior probabilities only. For binary classification with probability (not A) = 1 - probability (A), you don't need to plot the second ROC as it does not contain any information that is not readily accessible from the first one.

In your 3 class set up you can plot a ROC for each class. Depending on how you choose your threshold, no classification, exactly one class, or more than one class assigned can result. What is sensible depends on your problem. E.g. if the classes are "Hepatitis", "HIV", and "broken arm", then this policy is appropriate as a patient may have none or all of these.