- 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.
HOW TO CALCULATE AUROC VALUE FOR ANY CLASSIFICATION MODEL?
3 views (last 30 days)
Show older comments
Tholkappian R
on 21 Jul 2022
Answered: Ayush Aniket
on 28 Sep 2023
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?
0 Comments
Accepted Answer
Ayush Aniket
on 28 Sep 2023
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:
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 Comments
More Answers (0)
See Also
Categories
Find more on ROC - AUC in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!