'Empty' ROC curve for decision tree

I created a spam/ham filters for emails with Matlab (data from UCI Machine Learning Repository: SMS Spam Collection Data Set). I used both Naive Bayes and Decision tree. I wanted to plot in a single graph the ROC curve. Following MathWorks I was able to build one ROC for Naive Bayes. However, with Decision Tree I have a few problems. This is the code I tried:
[respDT,scores] = resubPredict(Mdl);
diffscores= scores(:,2) - scores(:,1)
[X,Y,T,~,OPTROCPT,suby,subnames] = perfcurve(respDT,diffscores,1);
plot(X,Y)
hold on
plot(OPTROCPT(1),OPTROCPT(2),'ro')
xlabel('False positive rate')
ylabel('True positive rate')
And this is the image I get:
Now, as for the variables:
  • Mdl = fitctree(X,Y) and its accuracy is more or less 94%
  • Mdl.ClassNames is [0, 1]
  • respDT is a vector with 0 (ham) and 1 (spam), 5417x1 double
  • scores is 5417x2 double
  • I created diffscores following https://uk.mathworks.com/help/stats/perfcurve.html
I am completely new to Matlab. Thank you for your help!

Réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by