码迷,mamicode.com
首页 > 其他好文 > 详细

Q: How could I use MATLAB interface for parameter selection?

时间:2015-11-24 06:18:00      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!