MATLAB: How to define a kernel for the support vector machine using the BioInformatics Toolbox in MATLAB 7.8 (R2009a)

Bioinformatics Toolboxkernelmachinesupportvector

I am trying to define a kernel for my support vector machine, but I do not understand the documentation. For example, the kernel function must have inputs u and v, but I do not know what these inputs are.

Best Answer

In the kernel function, u and v can be thought of as vectors from the vector space of the data. The kernel function defines an inner product on that vector space. When the kernel function is called during SVMTRAIN, the entire set of training data is passed as an MXN matrix. Here, M is the number of data points, and N is the length of a single data vector. The returned matrix is an MXM matrix for which the (i,jth) element of that matrix gives the inner product between the ith and jth training vector. So for example, to let the kernel be the L2-norm, one could use:
function y = kfun(u,v)
y = u*v';