1
votes

I'm building a model with adaboost and trying to the roc plot to work. here's my codes:

ens=fitensemble(X,y,'AdaBoostM1',100,'Tree');

[ytest, scores] = predict(ens,Xtest);

figure
[xx,yy] = perfcurve(label, scores(:,2),'yes');
plot(xx,yy)
xlabel('FPR')
ylabel('TPR')
title('ROC');

However, this is giving me an error:

Error using perfcurve>membership (line 693)
Positive class is not found in the input data.

my training data size is 1000x19 and testing data size is 100x19.

Here's the source from matlab: https://www.mathworks.com/matlabcentral/fileexchange/42744-machine-learning-with-matlab?focused=6797233&tab=example

1

1 Answers

0
votes

Solved it. had to change the label format from logical to numeric, since my label are 0s and 1s.

Here's the corrected code:

ens=fitensemble(X,y,'AdaBoostM1',100,'Tree');

[ytest, scores] = predict(ens,Xtest);

figure
[xx,yy] = perfcurve(label, scores(:,2),1);
plot(xx,yy)
xlabel('FPR')
ylabel('TPR')
title('ROC');