How to input scores to the predict function

2 次查看(过去 30 天)
Code for calculating performance of classifier model is below. An error is received in the perfcurve function:
Error using perfcurve>preparedata (line 1244) You must pass scores as a vector of floating-point values.
Error in perfcurve (line 381) [scores,labels,weights,ncv] = preparedata(scores,labels,weights);
The output of checking the class of vector scores: whos scores Name Size Bytes Class Attributes
scores 4916x2 78656 double
length(scores)==length(labels)
Any ideas of what is causing the error?
% load classifier model
load baggedTrees3
% read predictor data in
readData3 = xlsread('featureMatrix3');
[n,m] = size(readData3);
predictorData3 = readData3(:,1:m-1); %
% calculate labels and scores
[labels,scores] = predict(baggedTrees3,predictorData3);
% calculate ROC and AUROC
posclass = true;
[X,Y,T,AUC] = perfcurve(labels,scores,posclass);

采纳的回答

Ilya
Ilya 2015-6-3
The error message says "You must pass scores as a vector..." You are passing it as a matrix with two columns. How would perfcurve know which column represents scores for the positive class?
  4 个评论
John
John 2015-6-3
Can you recommend some reference for understanding why the positive class probability is begin used only?
Ilya
Ilya 2015-6-4
The doc page http://www.mathworks.com/help/stats/perfcurve.html has a few references at the bottom. The top two would have good introductory material.
In your case, you have two classes. Since class probabilities add up to one, you only need one of them.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 ROC - AUC 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by