HOW TO CALCULATE AUROC VALUE FOR ANY CLASSIFICATION MODEL?

조회 수: 1 (최근 30일)
Tholkappian R
Tholkappian R 2022년 7월 21일
답변: Ayush Aniket 2023년 9월 28일
Hi, MATLAB community. Can anyone please help me in calculating AUROC value of SVM classification problem.I have calculated up to ROC plot. The problem starts when i start to working with perfcurve and its input like labels,scores and posclass. And it is also very helpful if anyone say ,how to convert double array to vector of floating points?

채택된 답변

Ayush Aniket
Ayush Aniket 2023년 9월 28일
As per my understanding you have trained your SVM classification model and want to compute the AUROC value using ‘perfcurve’. The inputs to the `perfcurve` function are as follows:
  • The first input is the true labels of your data,
  • The second input is the scores (probabilities) predicted by your model, and
  • 'positive' indicates the class with respect to which the output is calculated.
So, if your data has two labels, you must mention which one corresponds to the ‘positive’ level in the third parameter. For better understanding you can refer to the example using the following link:
In the example, ‘fisheriris’ dataset is being used, where ‘true labels’ called species, have two values: ‘versicolor’ and ‘virginica’. When computing the AUC, the labels that corresponds to the ‘positive’ class must be mentioned if it's not already in a binary form (1 and 0) as shown below:
[X,Y,T,AUC] = perfcurve(species(51:end,:),scores,'virginica');
Regarding your second query, in MATLAB, a double array is already a floating-point array. If you have a multi-dimensional double array and you want to convert it into a single-dimensional (vector) array, you can use the `(:)` operator to achieve this as shown below:
vector = doubleArray(:);
This will convert your 2D or multi-dimensional double array into a single-dimensional vector, preserving the floating-point nature of the values. You can read more about how MATLAB stores floating point numbers by referring to the following link:
Hope it helps.

추가 답변 (0개)

카테고리

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