Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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

Risposte (0)

Categorie

Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by