Hello,
I am using the command
cl = fitcsvm(X,Y,'KernelFunction','rbf',...
'BoxConstraint',Inf,'ClassNames',[-1,1]);
in my program. How do I go about changing the 'rbf'?

 Réponse acceptée

Walter Roberson
Walter Roberson le 23 Oct 2016

1 vote

6 commentaires

monkey_matlab
monkey_matlab le 23 Oct 2016
I tried
cl = fitcsvm(X,Y,'KernelFunction',2, 'BoxConstraint',Inf,'ClassNames',[-1,1]);
but I got the error:
Error using classreg.learning.modelparams.SVMParams.make (line 217) You must pass 'KernelFunction' as a string.
Walter Roberson
Walter Roberson le 24 Oct 2016
That is correct, the parameter you give after the 'KernelFunction' keyword needs to be a string naming the function that will be called by the kernel.
What function are you trying to use as your kernel?
monkey_matlab
monkey_matlab le 24 Oct 2016
Hello, I wanted to use 'rbf' with different sigma values. I also tried:
cl = fitcsvm(X,Y,'KernelFunction','rbf', 'rbf_Sigma',2, 'BoxConstraint',Inf,'ClassNames',[-1,1]);
but that also did not work.
Thanks for your time and help!
monkey_matlab
monkey_matlab le 24 Oct 2016
Hello, the fitcsvm help does not tell me how to vary the sigma. I tried
cl3 = fitcsvm(X,Y,'KernelFunction','rbf', ...
'Standardize',true,'BoxConstraint',10,'ClassNames',[-1,1]);
but do not yet know how to add and then vary sigma. Thanks!
Walter Roberson
Walter Roberson le 24 Oct 2016
Create your own RBF routine that has a sigma built in to it.
Or possibly the KernelScaling might be what is needed, but the documentation for how that all worked is long and it was not clear to me how the various aspects work together.
Hassan Raza
Hassan Raza le 15 Nov 2023
How to make the code implementation Multiquadric RBF on 1d heat equation.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by