Kernel Functions
dots.Rd
Kernel functions provided in the R package kernlab
. Details can be seen in the reference below.
The Gaussian RBF kernel \(k(x,x') = \exp(-\sigma \|x - x'\|^2)\)
The Polynomial kernel \(k(x,x') = (scale <x, x'> + offset)^{degree}\)
The Linear kernel \(k(x,x') = <x, x'>\)
The Laplacian kernel \(k(x,x') = \exp(-\sigma \|x - x'\|)\)
The Bessel kernel \(k(x,x') = (- \mathrm{Bessel}_{(\nu+1)}^n \sigma \|x - x'\|^2)\)
The ANOVA RBF kernel \(k(x,x') = \sum_{1\leq i_1 \ldots < i_D \leq N}
\prod_{d=1}^D k(x_{id}, {x'}_{id})\) where k(x, x) is a Gaussian RBF kernel.
The Spline kernel \( \prod_{d=1}^D 1 + x_i x_j + x_i x_j \min(x_i,
x_j) - \frac{x_i + x_j}{2} \min(x_i,x_j)^2 +
\frac{\min(x_i,x_j)^3}{3}\).
The parameter sigma
used in rbfdot
can be selected by sigest()
.
Usage
rbfdot(sigma = 1)
polydot(degree = 1, scale = 1, offset = 1)
vanilladot()
laplacedot(sigma = 1)
besseldot(sigma = 1, order = 1, degree = 1)
anovadot(sigma = 1, degree = 1)
splinedot()
sigest(x)
Arguments
- sigma
The inverse kernel width used by the Gaussian, the Laplacian, the Bessel, and the ANOVA kernel.
- degree
The degree of the polynomial, bessel or ANOVA kernel function. This has to be an positive integer.
- scale
The scaling parameter of the polynomial kernel function.
- offset
The offset used in a polynomial kernel.
- order
The order of the Bessel function to be used as a kernel.
- x
The design matrix used in
lhsc
whensigest
is called to estimatesigma
inrbfdot()
.
Value
Return an S4 object of class kernel
which can be used as the argument of kern
when fitting a lhsc
model.
Examples
data(BUPA)
# generate a linear kernel
kfun = vanilladot()
# generate a Laplacian kernel function with sigma = 1
kfun = laplacedot(sigma=1)
# generate a Gaussian kernel function with sigma estimated by sigest()
kfun = rbfdot(sigma=sigest(BUPA$X))
# set kern=kfun when fitting a lhsc object
data(BUPA)
BUPA$X = scale(BUPA$X, center=TRUE, scale=TRUE)
lambda = 10^(seq(-3, 3, length.out=10))
m1 = lhsc(BUPA$X, BUPA$y, kern=kfun,
lambda=lambda, eps=1e-5, maxit=1e5)