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 Center および File ExchangeROC - AUC についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by