aux.kernelcov | R Documentation |
From the celebrated Mercer's Theorem, we know that for a mapping φ, there exists a kernel function - or, symmetric bilinear form, K such that
K(x,y) = <φ(x),φ(y)>
where <,> is
standard inner product. aux.kernelcov
is a collection of 20 such positive definite kernel functions, as
well as centering of such kernel since covariance requires a mean to be subtracted and
a set of transformed values φ(x_i),i=1,2,…,n are not centered after transformation.
Since some kernels require parameters - up to 2, its usage will be listed in arguments section.
aux.kernelcov(X, ktype)
X |
an (n\times p) data matrix |
ktype |
a vector containing the type of kernel and parameters involved. Below the usage is consistent with description
|
There are 20 kernels supported. Belows are the kernels when given two vectors x,y, K(x,y)
=<x,y>+c
=(<x,y>+c)^d
=exp(-c\|x-y\|^2), c>0
=exp(-c\|x-y\|), c>0
=∑_k exp(-c(x_k-y_k)^2)^d, c>0,d≥ 1
=tanh(a<x,y>+b)
=1-(\|x-y\|^2)/(\|x-y\|^2+c)
=√{\|x-y\|^2 + c^2}
=1/(\|x-y\|^2+c^2)
=1/√{\|x-y\|^2+c^2}
= \frac{2}{π} arccos(-\frac{\|x-y\|}{c}) - \frac{2}{π} \frac{\|x-y\|}{c}√{1-(\|x-y\|/c)^2} , c>0
= 1-1.5\frac{\|x-y\|}{c}+0.5(\|x-y\|/c)^3 , c>0
=-\|x-y\|^d, d≥ 1
=-\log (\|x-y\|^d+1)
= ∏_i ( 1+x_i y_i(1+min(x_i,y_i)) - \frac{x_i + y_i}{2} min(x_i,y_i)^2 + \frac{min(x_i,y_i)^3}{3} )
=\frac{c^2}{c^2+\|x-y\|^2}
=∑_i \frac{2x_i y_i}{x_i+y_i}
=∑_i min(x_i,y_i)
=sum_i min( |x_i|^c,|y_i|^d )
=1/(1+\|x-y\|^d), d≥ 1
a named list containing
a (p\times p) kernelizd gram matrix.
a (p\times p) centered version of K
.
Kisung You
Hofmann, T., Scholkopf, B., and Smola, A.J. (2008) Kernel methods in machine learning. arXiv:math/0701907.
## generate a toy data set.seed(100) X = aux.gensamples(n=100) ## compute a few kernels Klin = aux.kernelcov(X, ktype=c("linear",0)) Kgau = aux.kernelcov(X, ktype=c("gaussian",1)) Klap = aux.kernelcov(X, ktype=c("laplacian",1)) ## visualize opar <- par(no.readonly=TRUE) par(mfrow=c(1,3), pty="s") image(Klin$K, main="kernel=linear") image(Kgau$K, main="kernel=gaussian") image(Klap$K, main="kernel=laplacian") par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.