9

When using libsvm, the parameter $\gamma$ is a parameter for the kernel function. Its default value is setup as $$\gamma = \frac{1}{\text{number of features.}}$$

Is there any theoretical guidance for setting up this parameter besides existing methods, e.g., grid search?

Pål GD
  • 87
  • 12
user3269
  • 4,622
  • 8
  • 43
  • 53

2 Answers2

8

I would suggest the following theoretical guidance. When you are using Gaussian RBF kernel, your separating surface will be based on a combination of bell-shaped surfaces centered at each support vector. The width of each bell-shaped surface will be inversely proportional to $\gamma$. If this width is smaller than the minimum pair-wise distance for your data, you essentially have overfitting. If this width is larger than the maximum pair-wise distance for your data, all your points fall into one class and you don't have good performance either. So the optimal width should be somewhere between these two extremes.

Leo
  • 2,484
  • 3
  • 22
  • 29
5

No, it is essentially data dependent. Grid search (over log-transformed hyper-parameters) is a very good method if you only have a small number of hyper-parameters to tune, but don't make the grid resolution too fine or you are likely to over-fit the tuning criterion. For problems with a larger number of kernel parameters, I find the Nelder-Mead simplex method works well.

Dikran Marsupial
  • 46,962
  • 5
  • 121
  • 178
  • Dikran, thanks for the answer. Can you elaborate more on the "data-dependent"? What's the relationship between r and a set of data? Or in other words, given a set of data, is there a way to define r based on these data? – user3269 Sep 20 '12 at 21:48
  • 1
    Essentially "data dependent" just means the best settings will vary according to the particular structure of the data and there isn't generally any better way to set them than minimising the cross-validation error. Kernel methods could really do with more theoretical analysis of how to go about learning the kernel, but unfortunately this is mathematically very difficult. – Dikran Marsupial Sep 21 '12 at 09:00