Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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

Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by