After training heart.scale data set using RBF kernel, to find number of support vectors in each class I am writing following code. Am I doing any thing wrong ? as I am getting the same number of support vectors in each class.

supp_vect_index=model.sv_indices;

nt=size(supp_vect_index,1);

numTrain=size(train_labels);

for i=1:nt

for j=1:numTrain

if(supp_vect_index(i)==j)

supp_labels(i)=train_labels(j);

end

end

for i=1:nc

n(i)=0;

end

for i=1:nt

if(supp_labels(i)==1)

n(1)=n(1)+1;

elseif(supp_labels(i)==-1)

n(2)=n(2)+1;

end

end

More Krupal Parikh's questions See All
Similar questions and discussions