How to input scores to the predict function

6 visualizaciones (últimos 30 días)
John
John el 3 de Jun. de 2015
Comentada: Ilya el 4 de Jun. de 2015
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);

Respuesta aceptada

Ilya
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
John
John el 3 de Jun. de 2015
Can you recommend some reference for understanding why the positive class probability is begin used only?
Ilya
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.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by