How to input scores to the predict function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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);
0 comentarios
Respuesta aceptada
Ilya
el 3 de Jun. de 2015
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 comentarios
Ilya
el 4 de Jun. de 2015
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre ROC - AUC en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!