svmpath (version 0.970)

radial.kernel: compute the kernel matrix for svmpath

Description

compute the kernel matrix for svmpath

Usage

radial.kernel(x, y=x, param.kernel = 1/p,...)
poly.kernel(x, y=x, param.kernel = 1,...)

Arguments

x

an n x p matrix of features

y

an m x p matrix of features (if omitted, it defaults to x)

param.kernel

the parameter(s) for the kernel. For this radial kernel, the parameter is known in the fields as "gamma". For the polynomial kernel, it is the "degree"

unused

Value

An n x m matrix.

Details

For the radial kernel, this computes the function \(\exp(-\gamma||x-y||^2)\) for each pair of rows x,y from the input matrices. Here g is param.kernel. For the polynomial kernel, it computes \((xy^T+1)^d\), where d is param.kernel.

References

The paper http://www-stat.stanford.edu/~hastie/Papers/svmpath.pdf, as well as the talk http://www-stat.stanford.edu/~hastie/TALKS/svmpathtalk.pdf.

See Also

svmpath

Examples

Run this code
# NOT RUN {
data(svmpath)
attach(balanced.overlap)
fit<-svmpath(x,y,kernel=radial.kernel)
detach(2)
# }

Run the code above in your browser using DataLab