Q: How could I use MATLAB interface for parameter selection?
One can do this by a simple loop. See the following example:
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
You may adjust the parameter range in the above loops.
http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html
Q: How could I use MATLAB interface for parameter selection?
原文:http://www.cnblogs.com/huadongw/p/4990414.html