18
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ You forgot to mention what you want to achieve with any of these curves. $\endgroup$ Commented Mar 20, 2014 at 21:25
  • 1
    $\begingroup$ Note: it seems you want to choose between ROC curves (TPR as a function of FPR over the entire operating range) and PR curves (precision versus recall over the entire operating range). Terminology like "AUC-ROC of precision and recall" is very misleading, so I've edited this. Please revert it if I misunderstood. $\endgroup$ Commented Mar 20, 2014 at 21:37

3 Answers 3

36
$\begingroup$

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 = \frac{FP}{FP+TN}, \quad TPR=\frac{TP}{TP+FN}.$$ PR curves plot precision versus recall (FPR), or more explicitly: $$recall = \frac{TP}{TP+FN} = TPR,\quad precision = \frac{TP}{TP+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.

$\endgroup$
7
  • $\begingroup$ Thanks for the explanation. The question now, why PR curves are more informative for imbalanced data? For me, ROC should be more informative because it considers both TPR and FPR. $\endgroup$
    – M.M
    Commented Mar 21, 2014 at 0:59
  • $\begingroup$ In addition, these two articles make me more confused! onlinelibrary.wiley.com/doi/10.1111/j.1466-8238.2007.00358.x/… riceanalytics.com/db3/00232/riceanalytics.com/_download/… $\endgroup$
    – M.M
    Commented Mar 21, 2014 at 1:02
  • 1
    $\begingroup$ @M.A edited my answer to clarify. $\endgroup$ Commented Mar 21, 2014 at 7:37
  • 1
    $\begingroup$ I think there is a mixup in the equation for recall between TPR and FPR, no? $\endgroup$ Commented Nov 7, 2016 at 15:40
  • $\begingroup$ You're right, it should be: recall = ... = TPR, not FPR. @Marc Claesen, I think only you can change that, because when I try to do it, I'm informed that: "Edits should have at least 6 characters", so it's impossible to correct small typos, such as this one. $\endgroup$
    – ponadto
    Commented Dec 9, 2016 at 6:37
6
$\begingroup$

ROC curves plot TPR on the y-axis and FPR on the x-axis, but it depends on what you want to portray. Unless there is some reason to plot it differently in your area of study, TPR/FPR ROC curves are the standard for showing operating tradeoffs and I believe they would be most well received.

Precision and Recall alone can be misleading because it does not account for true negatives.

$\endgroup$
0
3
$\begingroup$

I consider the largest difference in ROC and PR AUC the fact the ROC is determining how well your model can "calculate" the positive class AND the negative class where as the PR AUC is really only looking at your positive class. So in a balanced class situation and where you care about both negative and positive classes, the ROC AUC metric works great. When you have an imbalanced situation, it is preferred to use the PR AUC, but keep in mind it is only determining how well your model can "calculate" the positive class!

$\endgroup$

Your Answer

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

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