Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

selecting c and gamma value

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

like image 460
pradeep deep Avatar asked Mar 18 '12 10:03

pradeep deep


People also ask

What is C value and gamma in SVM?

The gamma parameters can be seen as the inverse of the radius of influence of samples selected by the model as support vectors. The C parameter trades off correct classification of training examples against maximization of the decision function's margin.

What does high C mean in SVM?

I always think of c as the cost of misclassification (easy to remember by c in classification). In that way higher c means high cost of misclassification, leading to the algorithm trying to perfectly separate all data points.

What is C value in SVM?

C parameter in SVM is Penalty parameter of the error term. You can consider it as the degree of correct classification that the algorithm has to meet or the degree of optimization the the SVM has to meet. For greater values of C, there is no way that SVM optimizer can misclassify any single point.

What is the significance of gamma and regularization in SVM?

The gamma parameter defines how far the influence of a single training example reaches, with low values meaning 'far' and high values meaning 'close'. The lower values of gamma result in models with lower accuracy and the same as the higher values of gamma.


2 Answers

  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. 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).
  4. Return the best performing value pair for C, sigma by the scores you just computed.
like image 172
Fred Foo Avatar answered Sep 22 '22 20:09

Fred Foo


Read A Practical Guide to Support Vector Classication by Chih-Wei Hsu, Chih-Chung Chang, and Chih-Jen. They address this exact issue and explain methods for performing a grid-search for parameter selection. http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf

like image 34
karenu Avatar answered Sep 25 '22 20:09

karenu