ashwani
ashwani

Reputation: 19

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)

i want to ask what should be optimal C & gamma for this data set

Upvotes: 1

Views: 345

Answers (1)

lennon310
lennon310

Reputation: 12689

Use grid search method, although the speed may be an issue.

If you are using Matlab, the following code from the FAQ page may work:

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

If you are using Python, check this page with the usage on gridrepression.py.

Upvotes: 4

Related Questions