1
$\begingroup$

I am using LIBSVM for regression problem. Based on the codes provides in their FAQ, the grid search is like this:

bestcv = 0;
for log2c = -1:3,
  for log2g = -4:1,
    cmd = ['-v 5 -c ', num2str(2^log2c), ' -g ', num2str(2^log2g)];
    cv = svmtrain(heart_scale_label, heart_scale_inst, cmd);
    if (cv >= bestcv),
      bestcv = cv; bestc = 2^log2c; bestg = 2^log2g;
    end
    fprintf('%g %g %g (best c=%g, g=%g, rate=%g)\n', log2c, log2g, cv, bestc, bestg, bestcv);
  end
end

with the codes above I always got the worst results, then I changed to the following and everthing works well.

bestcv = inf;...

if (cv <= bestcv)...

In my sense cv is a score, more is better, and should be less than 1(100%). But in my case cv becomes like error, less is better, and some are bigger than 1. It's so weird, maybe I did something wrong? or can I keep my codes and results like mine?

$\endgroup$
0
0
$\begingroup$

Problem solved! I checked svmtrain.c, in case of regression problem, cv is error(MSE), lower the better. And in case of classification problem, cv is accuracy, higher the better. Therefore I did everything right.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.