How to customize SVM kernel parameters in Matlab

Hi
I want to ask about how to customize SVM kernel parameters in Matlab.
For ex: I have linear kernel, polynomial kernel, and RBF kernel with:
C = 0.2;
gamma = 0.8;
r = 0.05;
d = 3;
My question is how do I customize it using svmstruct.
1. linear: ??
2. polynomial: ??
3. RBF:
svmstruct = svmtrain(data, groups, 'Kernel_Function', 'rbf', 'RBF_Sigma', 0.2, 'BoxConstraint', 0.8);
CMIIW about how to customize RBF kernel.
I'd really appreciate if anybody could help my research. Thanks.
Regards
Ikra

回答 (2 件)

Ikra89
Ikra89 2013 年 6 月 10 日

0 投票

anybody can help? :)
Ahmed
Ahmed 2013 年 6 月 10 日

0 投票

Documentation given by
help svmtrain
should give you all information you need. What is the meaning of your variable r?
1. the linear kernel has only parameter C
svmstruct = svmtrain(data, groups, 'Kernel_Function', 'linear', 'BoxConstraint', 0.2);
2. polynomial has parameters C and polyorder
svmstruct = svmtrain(data, groups, 'Kernel_Function', 'polynomial', 'polyorder',3,'BoxConstraint', 0.2);
3. RBF
you might have mixed up the constants C and gamma in your code

6 件のコメント

Ikra89
Ikra89 2013 年 6 月 10 日
and what about "r parameter" ?
as i know:
linear has C parameter
polynomial has C, gamma, r, d
rbf has C and gamma
Ahmed
Ahmed 2013 年 6 月 10 日
It looks like Matlab's svmtrain function only supports homogeneous polynomial kernels. You can however, define an arbitrary kernel function and pass a handle of it to svmtrain. See section kernel_function -> @kfun in the documentation for description and example.
Ikra89
Ikra89 2013 年 6 月 12 日
can you give me an example how to use @kfun
i have tried many times but still error
Ahmed
Ahmed 2013 年 7 月 6 日
Using an anonymous function of a linear kernel would be:
svmstruct = svmtrain(data, groups, ...
'Kernel_Function',@(x1,x2) x1*x2','BoxConstraint', 0.2);
Note, that your kernel function must lead to a valid kernel.
behruz
behruz 2015 年 7 月 4 日
hi the combination of C and gamma how is implemented? in fitcsvnm or svmtrain we dont have any gamma factor how is the impact of it apllied to svm?
behruz
behruz 2015 年 7 月 5 日
any comment?

サインインしてコメントする。

製品

質問済み:

2013 年 6 月 9 日

コメント済み:

2015 年 7 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by