本文介绍了选择c和gamma值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SMO进行SVM分类,我的内核是RBF,现在我想使用网格搜索和交叉验证来选择 c sigma 值,我是内核功能的新手,请逐步进行帮助

Hi I am performing SVM classification using SMO, in which my kernel is RBF, now I want to select c and sigma values, using grid search and cross validation, I am new to kernel functions, please help, in step by step process

推荐答案

  1. 选择一些您认为有趣的C和sigma值.例如,C = {1,10,100,1000}和sigma = {.01,.1,1}(我只是在弥补这些问题).
  2. 将训练集划分为 k 个(例如10个)部分,最好在分层方式.
  3. 遍历所有对C和sigma值.
  1. Pick some values for C and sigma that you think are interesting. E.g., C = {1, 10, 100, 1000} and sigma = {.01, .1, 1} (I'm just making these up).
  2. Divide the training set into k (e.g. 10) parts, preferably in a stratified way.
  3. Loop over all pairs of C and sigma values.
  1. 遍历训练集的所有 k 部分.保留第 k 个部分.在所有其他结合的零件上训练分类器,然后对伸出的零件进行测试.
  2. 跟踪某些分数(准确性,F1或您要优化的任何分数).
  1. Loop over all k parts of your training set. Hold the k'th part out. Train a classifier on all of the other parts combined, then test on the held out part.
  2. Keep track of some score (accuracy, F1, or whatever you want to optimize).

  • 通过您刚刚计算出的分数返回C的最佳性能值对,即sigma.
  • 这篇关于选择c和gamma值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-15 04:51