ROC Curve – How to Draw for a Multi-Class Dataset

classificationmachine learningmulti-classroc

I have a multi-class confusion matrix as below and would like to draw its associated ROC curve for one of its classes (e.g. class 1).
I know the "one-VS-all others" theory should be used in this case, but I want to know how exactly we need to change the threshold to obtain different pairs of TP and corresponding FP rates.enter image description here

Best Answer

I assume you use something like softmax to get probability estimates for each class. So, let's say we want to calculate the ROC curve for class $c$. For each sample, you'll get $P(y=c|x)$ from the softmax, and one minus this is the probability of "others", i.e. in this case it can be referred as negative, which means the class $c$ samples are positive. Then, by changing the threshold in the range $[0,1]$, you'll obtain the number of TP and FP for each threshold, which you can directly plot.