フィルターのクリア

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 Center および File ExchangeStatistics 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