Solved – The relation between a confusion matrix and a ROC curve

confusion matrixrroc

As an example I have a confusion matrix that shows good accuracy but poor performance on sensitivity because of imbalanced classes. I made this fictive table for a presentation.

                actual          actual
               positive        negative
pred. positive      6              20
pred. negative      6              986

I have two questions:

First, is it possible to draw a ROC curve that matches with this confusion matrix and how to do this without having the original data? Is there an easy/short way or should I somehow reconstruct some "fictive" data.

Second, could different ROC curves potentially match with the same confusion matrix? I thought that classification thresholds may differ and therefore may result in different ROC curves with similar confusion matrix (see Fawcett 2006.

For implementation I am using the ROCR package in R.

Best Answer

This matrix is just a point on your ROC curve obtained for the threshold you picked. You can compute a value of sensitivity and specificity with your matrix, this is where you point is. $$sensitivity=6/12=1/2$$ $$1-specificity=986/1006=0.98$$ Many different ROC curves could then cross this point. If you can move this threshold, you can draw your ROC curve.

The whole point of ROC curves is to see how sensitivity and specificity vary across various threshold.

Related Question