svmclassify - classperf - ground truth must be cell of strings

2 ビュー (過去 30 日間)
Vivek Subramanian
Vivek Subramanian 2011 年 7 月 3 日
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!

回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics and Visualization についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by