How to plot ROC for multi class?

조회 수: 1 (최근 30일)
tejasvee
tejasvee 2017년 6월 19일
답변: Abhipsa 2025년 2월 20일
I have 5 class and want to plot ROC for it and i am able to plot for binary class but not for 5 class.Please guide me to plot ROC for 5 classes.Many places i have read that ROC is not for multi class if yes then what is for multi class.

답변 (1개)

Abhipsa
Abhipsa 2025년 2월 20일
You are correct that ROC curves are commonly used for evaluating the performance of binary classification models. For multi-class classification, ROC analysis can be extended using methods like One-vs-Rest (OvR) or One-vs-One (OvO).
You can refer to the attached “roc.m” file for a complete working example.
The below figure is the output of “roc.m”:
The zest of this example lies in using a loop which iterates over each class in a multi-class classification problem to compute and plot ROC curves using the “One-vs-Rest” approach. For each class, it creates a binary label vector where the current class is treated as the "positive" class. It then uses the “perfcurve” function to calculate the False Positive Rate and True Positive Rate for the class, based on the predicted scores.
You can read more about “perfcurve” by using the MATLAB command
>> doc perfcurve
Moreover, if you are using MATLAB R2022a or any later release, then you can use “rocmetrices” to plot ROC curve for multi-class classification.
You can refer to the following documentation for more details about “rocmetrices”:
For an example, you can use the MATLAB command :
openExample('stats/PlotROCCurveForMulticlassClassificationExample')
I hope this helps!

카테고리

Help CenterFile Exchange에서 ROC - AUC에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by