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.
조회 수: 1 (최근 30일)
이전 댓글 표시
%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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Classification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!