How can we define GroupTrain for different type of datasets in Multiclass classfication? I tried an online available code for fisheriris dataset. It shows an error that G1vAll must be either a vector or character array. Please point out to my error.

2 Ansichten (letzte 30 Tage)
%Editor window function [result] = multisvm(TrainingSet, GroupTrain, TestSet)
u = unique(GroupTrain);
numClasses = length(u);
result = zeros(length(TestSet(:,1)),1);
%bulid models
for k=1:numClasses
G1vAll=(GroupTrain==u(k));
models(k) = svmtrain(TrainingSet, G1vAll); %this line has error
end
%Following commands I used in Command window, if case I did anything wrong there:
load fisheriris; data = meas;
TrainingSet=[data(1:20,:);data(51:70,:);data(101:120,:)];
TestSet=[data(21:50,:);data(71:100,:);data(121:150,:)];
GroupTrain =[1:50,1; 51:100,1;101:150,1];
results = multisvm(TrainingSet, GroupTrain, TestSet);
disp('multi class problem');
disp(results);

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by