svmclassify - classperf - ground truth must be cell of strings

6 vues (au cours des 30 derniers jours)
Vivek Subramanian
Vivek Subramanian le 3 Juil 2011
Hi,
I'm getting an error using classperf which says "Ground truth must be a cell of strings or a numeric array." I'm not sure why I'm getting this as I'm pretty sure the vectors that are being used as parameters for classperf are cell string arrays. My code is:
load Experiment1.mat;
%%Training
clc; close all;
data1_train = N(1:100, :);
data2_train = NE(1:100, :);
group1_train = repmat('N', size(data1_train, 1), 1);
group2_train = repmat('S', size(data2_train, 1), 1);
data_train = [data1_train; data2_train];
group_train = [group1_train; group2_train];
svmstruct = svmtrain(data_train, group_train, 'showplot', true);
%%Testing
data1_test = N(101:200, :);
data2_test = NE(101:200, :);
group1_test = repmat('N', size(data1_test, 1), 1);
group2_test = repmat('S', size(data2_test, 1), 1);
data_test = [data1_test; data2_test];
group_test = [group1_test; group2_test];
cp = classperf(group_test);
classes = svmclassify(svmstruct, data_test, 'showplot', true);
classperf(cp, cellstr(classes), cellstr(group_test));
Could you please let me know what could be going wrong?
Thank you!

Réponses (0)

Catégories

En savoir plus sur Data Export to MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by