svmclassify - classperf - ground truth must be cell of strings

조회 수: 8 (최근 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 CenterFile Exchange에서 Data Export to MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by