MATLAB Answers

What "Kernel Scale" in svm really is?

133 views (last 30 days)
Zeynab Mousavikhamene
Zeynab Mousavikhamene on 9 Apr 2020
Commented: Hiro on 24 Aug 2020
I checked several places in matlab tutorial but did not find explicit definition of "kernel scale". According to question like this or this or this that they are constants of kernels. Based on the definition of kernel from matlab it should be sigma which is "the width of kernel". So kernel scake is ONLY applied to RBF not to linear or polynomial. Am I right?
And what is the default value of kernel scale? According to this question the default value for kernel scale is 1. But according to here, it uses heuristic to determine the kernel scale.
I would appreciate your thoughts.


Sign in to comment.

Answers (1)

Hiro on 21 Apr 2020
This gives you a clearer view for you:
Let me answer you questions.
  • Kernel scale is just for RBF kernel? Yes, you're right. This is a hyper parameter.
  • use 'KernelScale' to apply a kernel scale of your choice. The option 'auto' evokes the heuristic method.
  • according to the documentation, the default value for the kernel scale is 1.
It does not elaborate on the heuristic method but I bet it will use a method like cross validation.
I would optimize the parameter via hyper parameter tuning, e.g., bayes optimization.


Zeynab Mousavikhamene
Zeynab Mousavikhamene on 20 Aug 2020
I dont think kernel scale is ONLY applied to RBF kernel.
For example:
classificationSVM = fitcsvm(...
predictors, ...
response, ...
'KernelFunction', 'polynomial', ...
'PolynomialOrder', 2, ...
'BoxConstraint', 1, ...
'KernelScale', 'auto',...
'Standardize', true, ...
'ClassNames', categorical(classnames_fitcsvm));
Here the kernel is quadratic polynomial and kernel scale is used. I tried running the code with and without the kernel scale and the result was different.
Hiro on 24 Aug 2020
Hi, let me take back what I wrote before.
Looing into the documentation, I found the KernelScale not to be what I thought it would be. I thought it was one of the parameters used for RBF kernel.
Kernelscale is literally a scaling parameter for the input data.
The input data is recommended to be scaled with respect to a feature before being applied to the Kernel function. When the absolute values of some features range widely or can be large, their inner product can be dominant in the Kernel calculation. So this kernelScale can be used to prevent this from happening. It also helps maintain the information.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by