필터 지우기
필터 지우기

how to get accuracy using K-fold cross validation with multiclass svm?

조회 수: 1 (최근 30일)
Nani Harniawati
Nani Harniawati 2016년 6월 18일
Please help me, I want to know accuracy from my classification using K-fold cross validation with multiclass svm. this is my code
if true %please delete this code
load trainingData
[g, gn] = grp2idx(Group);
TrainingSet=Data;
GroupTrain=g;
TestSet=Data;
end %please delete this code
u=unique(GroupTrain);
numClasses=length(u);
result = zeros(length(TestSet(:,1)),1);
for k=1:numClasses
%Vectorized statement that binarizes Group
%where 1 is the current class and 0 is all other classes
G1vAll=(GroupTrain==u(k))
models(k) = svmtrain(TrainingSet,G1vAll, ...
'Autoscale',true, 'Showplot',false, 'Method','QP', ...
'BoxConstraint',2e-1, 'Kernel_Function','rbf', 'RBF_Sigma',1)
end
for j=1:size(TestSet,1)
for k=1:numClasses
if(svmclassify(models(k),TestSet(j,:)))
break;
end
end
result(j) = k;
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by