Effacer les filtres
Effacer les filtres

Plotting ROC Curve for Multiclass

8 vues (au cours des 30 derniers jours)
Gorkem Akgul
Gorkem Akgul le 14 Mai 2021
Hi, I'm trying to make a multiclass ROC Curve and i think i'm close to it but it doesn't work. I've spent quite a while to figure out where the problem is, yet it came to nothing. I'm curious could someone who had done it before can help me ?
Firstly I have the classes below.
template=templateSVM('Standardize',true,'KernelFunction','gaussian')
MultiClassSVM=fitcecoc(winedataset,'quality','Learners',template,'FitPosterior',true)
yPredicted=predict(MultiClassSVM,winedataset)
fprintf(sprintf('Training accuracy: %0.2f%%', 100*mean(yPredicted==winedataset.quality)));
confusionchart(winedataset.quality,yPredicted,'RowSummary','row-normalized')
MultiClassSVM.ClassNames
ans =
3
4
5
6
7
8
This is my confusion matrix. Furthermore, I'm using the code below to create a ROC curve.
[~,score_svm] = resubPredict(MultiClassSVM);
diffscore=zeros;
for i=1:size(score_svm,1)
temp=score_svm(i,:);
diffscore(i,:)=temp(2)-max([temp(1),temp(3),temp(4),temp(5),temp(6)]);
end
[X,Y,T,~,OPTROCPT,suby,subnames] = perfcurve(winedataset.quality,diffscore,4)
plot(X,Y)
hold on
plot(OPTROCPT(1),OPTROCPT(2),'ro')
xlabel('False positive rate')
ylabel('True positive rate')
title('ROC for Classification by SVM')
fprintf("Area Under the Curve (AUC) = %f",AUCsvm)
hold off
Well the curve is supposed to have a value like 0.94 yet it shows 1. I probably made a mistake while calculating diffscore but i'm not quite sure of it. I would appreciate if anyone who has done it before could help.

Réponses (0)

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by