以下代码引发错误:您必须将分数作为浮点值的向量传递。
[Yhat scores] = predict(svmModel, meas );
[X,Y,T,AUC] = perfcurve(Yhat ,scores,'1');
有人可以帮忙吗?
答案 0 :(得分:0)
I can't provide deep help since I don't know what do you want to achieve exactly. BTW, I found you make a fundamental mistake by using single quotation with number one '1' since it recognized as charter not number. Therefore, it can match nothing with the array of numbers Yhat
.
You can't use scores
with two columns since the perfcurve(_)
accept such a parameter with a single column only.
The code after apply the previous comments
% On full data
[Yhat, scores] = predict(svmModel, meas );
[X,Y,T,AUC] = perfcurve(Yhat ,abs(scores(:,2)),1);
plot(X,Y,'LineWidth',3)
xlabel('False positive rate')
ylabel('True positive rate')
title('ROC for Classification ')
The above code may not solve your issue but it will guide you to figure out your mistakes.