Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Nani Harniawati
Nani Harniawati le 18 Juin 2016
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

Réponses (0)

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by