Does the Statistics Toolbox support hybrid kernels to train Support Vector Machines in MATLAB?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 24 Apr 2014
Answered: MathWorks Support Team
on 24 Apr 2014
I see that the Statistics Toolbox R2014a provides a function called "svmtrain" to train an SVM. What kernels can I use to train it on my data? Can I use a hybrid kernel, i.e. a kernel made by mixing, for example, a linear kernel and a polynomial kernel?
Thanks!
Accepted Answer
MathWorks Support Team
on 24 Apr 2014
The Statistics Toolbox R2014a offers the following kernels with the "svmtrain" function:
- Linear
- Quadratic
- Polynomial
- Gaussian Radial Basis Function
- Multilayer Perceptron
Hybrid kernels are not readily available. However, there is an option to provide a custom kernel function using a function handle.
To train an SVM using a hybrid kernel, you would have to write the code for the hybrid kernel function. The kernel function must be of the form:
function K = kfun(U,V)
where the returned value, "K", is a matrix of size M-by-N, and "U" and "V" have "M" and "N" rows respectively.
You could use the custom kernel "kfun" by specifying the "kernel_function" argument as follows:
load fisheriris
xdata = meas(51:end,3:4);
group = species(51:end);
svmStruct = svmtrain(xdata,group,'ShowPlot',true,'kernel_function',@kfun);
Here is an example of a hyperbolic tangent kernel that could be used with "svmtrain":
function K = kfun(U,V)
K = tanh(U*V');
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!