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和伽马

最佳答案

使用网格搜索方法,尽管速度可能会成为问题。

如果您使用的是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一起检查。

关于python - 高斯SVM参数C和 Gamma ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20718724/

10-12 16:43