kernels: Kernel

kpolR Documentation

Kernel

Description

Functions building the Gram matrix for different kernels (e.g. Scholkopf & Smola 2002).

The user can build any other ad'hoc kernel function.

Usage


kpol(X, Y = NULL, degree = 1, scale = 1, offset = 0)

krbf(X, Y = NULL, sigma = 1)

ktanh(X, Y = NULL, scale = 1, offset = 0)

Arguments

X

A n x p matrix or data frame of variables.

Y

Optional (default to NULL). A m x p matrix or data frame of variables.

degree

See the code.

scale

See the code.

offset

See the code.

sigma

See the code.

Details

If Y = NULL, the function returns the n x n Gram matrix k(X, X). If not, the function returns the m x n Gram matrix k(Y, X).

Value

A function.

References

Scholkopf, B., Smola, A.J., 2002. Learning with kernels: support vector machines, regularization, optimization, and beyond, Adaptive computation and machine learning. MIT Press, Cambridge, Mass.

Examples


n <- 5
p <- 4
m <- 2
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10), ncol = p)
Xu <- matrix(rnorm(m * p, mean = 10), ncol = p)
set.seed(NULL)

kpol(X, degree = 2)
kpol(Xu, X, degree = 2)


mlesnoff/rnirs documentation built on April 24, 2023, 4:17 a.m.