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)
Ältere Kommentare anzeigen
%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);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Classification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!