フィルターのクリア

How to input scores to the predict function

4 ビュー (過去 30 日間)
John
John 2015 年 6 月 3 日
コメント済み: Ilya 2015 年 6 月 4 日
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by