簡體   English   中英

高斯 SVM 參數 C 和 gamma

[英]Gaussian SVM parameters C and 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 & gamma 應該是什么

使用網格搜索方法,雖然速度可能是一個問題。

如果您使用的是 Matlab,常見問題頁面中的以下代碼可能會起作用:

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,請使用gridrepression.py上的用法檢查此頁面

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM