Learn R Programming

kernlab (version 0.1-4)

dots: Kernel Functions

Description

The kernel generating functions provided in kernlab. The Gaussian kernel $k(x,x') = \exp(-\sigma \|x - x'\|^2)$ the Polynomial kernel $k(x,x') = (scale + offset)^degree$. the Linear kernel $k(x,x') = $ and the Hyperbolic tangent kernel $k(x, x') = \tanh(scale + offset)$

Usage

rbfdot(sigma = 1)

polydot(degree = 1, scale = 1, offset = 1)

tanhdot(scale = 1, offset = 1)

vanilladot()

Arguments

sigma
The inverse kernel width used by the Gaussian kernel
degree
The degree of the polynomial kernel. This has to be an integer.
scale
The scaling parameter is a convenient way of normalizing patterns without the need to modify the data itself
offset
The offset used in a polynomial or hyperbolic tangent kernel

Value

  • Return an S4 object of class kernel which extents the function class. The resulting function implements the given kernel calculating the inner (dot) product between two vectors.
  • kpara list containing the kernel parameters (hyperparameters) used.
  • the kernel parameters can be accessed by the kpar function.

Details

The kernel generating function are used to initialize a kernel function which calculates the dot (inner) product between two feature vectors in a Hilbert Space. These functions can be based as a kernel argument on almost all functions in kernlab (eg. ksvm, kpca etc). Although using one of the above mentioned existing kernel functions as a kernel argument in various functions in kernlab has the advantage that use of optimize kernel utilities methods are used any other function implementing a dot product of class kernel can also be used as a kernel argument. This allows the user to use test an develop special kernels for a given data set and algorithm.

See Also

kernelMatrix, kernelMult, kernelPol

Examples

Run this code
rbfkernel <- rbfdot(sigma = 0.1)
rbfkernel

kpar(rbfkernel)

## create two vectors
x <- rnorm(10)
y <- rnorm(10)

## calculate dot product
rbfkernel(x,y)

Run the code above in your browser using DataLab