Area under the ROC curve or area under the PR curve for imbalanced data?

I have some doubts about which performance measure to use, area under the ROC curve (TPR as a function of FPR) or area under the precision-recall curve (precision as a function of recall).

My data is imbalanced, i.e., the number of negative instances is much larger than positive instances.

I am using the output prediction of weka, a sample is:

inst#,actual,predicted,prediction
1,2:0,2:0,0.873
2,2:0,2:0,0.972
3,2:0,2:0,0.97
4,2:0,2:0,0.97
5,2:0,2:0,0.97
6,2:0,2:0,0.896
7,2:0,2:0,0.973

And I am using pROC and ROCR r libraries.

Answer

The question is quite vague so I am going to assume you want to choose an appropriate performance measure to compare different models. For a good overview of the key differences between ROC and PR curves, you can refer to the following paper: The Relationship Between Precision-Recall and ROC Curves by Davis and Goadrich.

To quote Davis and Goadrich:

However, when dealing with highly skewed datasets, Precision-Recall (PR) curves give a more informative picture of an algorithm’s performance.

ROC curves plot FPR vs TPR. To be more explicit:
FPR=FPFP+TN,TPR=TPTP+FN.
PR curves plot precision versus recall (FPR), or more explicitly:
recall=TPTP+FN=TPR,precision=TPTP+FP

Precision is directly influenced by class (im)balance since FP is affected, whereas TPR only depends on positives. This is why ROC curves do not capture such effects.

Precision-recall curves are better to highlight differences between models for highly imbalanced data sets. If you want to compare different models in imbalanced settings, area under the PR curve will likely exhibit larger differences than area under the ROC curve.

That said, ROC curves are much more common (even if they are less suited). Depending on your audience, ROC curves may be the lingua franca so using those is probably the safer choice. If one model completely dominates another in PR space (e.g. always have higher precision over the entire recall range), it will also dominate in ROC space. If the curves cross in either space they will also cross in the other. In other words, the main conclusions will be similar no matter which curve you use.


Shameless advertisement. As an additional example, you could have a look at one of my papers in which I report both ROC and PR curves in an imbalanced setting. Figure 3 contains ROC and PR curves for identical models, clearly showing the difference between the two. To compare area under the PR versus area under ROC you can compare tables 1-2 (AUPR) and tables 3-4 (AUROC) where you can see that AUPR shows much larger differences between individual models than AUROC. This emphasizes the suitability of PR curves once more.

Attribution
Source : Link , Question Author : M.M , Answer Author : Community

Leave a Comment