高斯SVM参数C和gamma

时间:2013-12-21 11:56:14

标签: machine-learning svm gamma

I am using rbf,Support Vector machine for  large training set=1135x9 matrix and test set{95x9}.

I am using C=20  and gamma=0.0001
'the result are as follows
optimization finished, iter = 3904
nu = 0.187228
obj = -2499.485353, rho = -0.072050
nSV = 852, nBSV = 48
Total nSV = 852
<Accuracy = 63.1579% (60/95) (classification)

我想问一下什么应该是最佳C&amp;此数据集的gamma值

1 个答案:

答案 0 :(得分:4)

使用网格搜索方法,虽然速度可能是个问题。

如果您使用的是Matlab,FAQ page中的以下代码可能有效:

bestcv = 0;
for log2c = -1:3,
  for log2g = -4:1,
    cmd = ['-v 5 -c ', num2str(2^log2c), ' -g ', num2str(2^log2g)];
    cv = svmtrain(label, training_set, 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

如果您使用的是Python,请使用page上的用法检查此gridrepression.py