Missing a claas during classification of SVM

e= load('data')
k=5; f=12;
n=e.n(:,1:12);
data=n(randsample(1:length(n),length(n)),:);
truth=n(:,features+1);
c = cvpartition(truth,'KFold',k)
for i= 1:k
trIdx = c.training(i);
teIdx = c.test(i);
Model = fitcecoc(data(trIdx,:),truth(trIdx,:))
[class,s]= predict (Model,data(teIdx,:));
end
the bold line afte rthe for loop completes the Model misses on of the class during any iteration i.e
during 1st iteration model have 4 class names (as my data originaly ha)
but in 2nd iteration or may be other iteration the classifier misses or ignores one class i.e gives [1 3 4] instead of [1 2 3 4]

Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Asked:

on 10 Mar 2020

Edited:

on 10 Mar 2020

Community Treasure Hunt

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

Start Hunting!