# How to plot ROC curves in multiclass classification?

In other words, instead of having a two class problem I am dealing with 4 classes and still would like to assess performance using AUC.

• Is dimension reduction an option? Commented Aug 27, 2010 at 1:59
• we have 4 classes, not really
– CLOCK
Commented Aug 27, 2010 at 3:03
• Weka does this perfectly, using the one against all class strategy.
– user14474
Commented Sep 28, 2012 at 20:45

It seems you are looking for multi-class ROC analysis, which is a kind of multi-objective optimization covered in a tutorial at ICML'04. As in several multi-class problem, the idea is generally to carry out pairwise comparison (one class vs. all other classes, one class vs. another class, see (1) or the Elements of Statistical Learning), and there is a recent paper by Landgrebe and Duin on that topic, Approximating the multiclass ROC by pairwise analysis, Pattern Recognition Letters 2007 28: 1747-1758. Now, for visualization purpose, I've seen some papers some time ago, most of them turning around volume under the ROC surface (VUS) or Cobweb diagram.

I don't know, however, if there exists an R implementation of these methods, although I think the stars() function might be used for cobweb plot. I just ran across a Matlab toolbox that seems to offer multi-class ROC analysis, PRSD Studio.

Other papers that may also be useful as a first start for visualization/computation:

References:
1. Allwein, E.L., Schapire, R.E. and Singer, Y. (2000). Reducing multiclass to binary: A unifying approach for margin classifiers. Journal of Machine Learning Research, 1:113–141.

I recently found this pROC package in R which plots a multiclass ROC using the technique specified by Hand and Till (2001). You can use the multiclass.roc function.

You need to specify your classifier to act as one-vs-rest, and then you can plot individual ROC curves. There's a handy library for doing it without much work in python called yellowbrick.

Check out the docs with a minimal reproducible example.

The result looks like this (source)

The answers here are pretty complete, but I still would like to add my 5 cents. In this question you can find an example of R code for producing ROC Curves using One-Vs-All Approach and the ROCR R library.

This is the plot from that answer:

While the math is beyond me this general review article has some references you will likely be interested in, and has a brief description of multi-class ROC graphs.

An introduction to ROC analysis by Tom Fawcett Pattern Recognition Letters Volume 27, Issue 8, June 2006, Pages 861-874

Link to pdf as provided by gd047- thanks

• I would say the same providing another link google.gr/… Commented Aug 27, 2010 at 6:40
• And here is another one, directly related to multi-class problem: Multi-class ROC analysis from a multi-objective optimisation perspective, Pattern Recognition Letters 2006 27(8): 918-927 (j.mp/9AMgzq).
– chl
Commented Aug 27, 2010 at 7:38
• Thanks for the other links, apparently that whole issue is popular, and its archive on science direct can be found here sciencedirect.com/… Commented Aug 27, 2010 at 13:17