I am using libsvm in MATLAB to do binary classification.
I was doing cross validation with different parameters but all parameters seem to give me the same accuracy and results.
Also I am getting number of support vectors as zero for all my parameters.
Here is what I tried:
folds = 5;
[C,gam] = meshgrid(-5:2:15, -15:2:3);
cv_acc = zeros(numel(C),1);
for ii = 1:numel(C)
cv_acc(ii) = svmtrain(class, data, ...
sprintf('-c %f -g %f -v %d ',...
2^C(ii), 2^gam(ii), folds)
);
end
But I'm getting the same result for all my iterations and parameter values, which look as follows:
optimization finished, #iter = 1
nu = -1.#IND00
obj = -1.#IND00, rho = -1.#IND00
nSV = 0, nBSV = 0
Total nSV = 0
I can't find out the error with my code. Any help will be deeply appreciated.
Looks like you have a problem with your data. Compare your code with this example: