kernels {bases} | R Documentation |
Kernel functions
Description
These functions return vectorized kernel functions that can be used to
calculate kernel matrices, or provided directly to other basis functions.
These functions are designed to take a maximum value of one when identical
inputs are provided. Kernels can be combined with arithmetic expressions; see
?kernel-arith
.
Usage
k_rbf(scale = 1)
k_lapl(scale = 1)
k_rq(scale = 1, alpha = 2)
k_matern(scale = 1, nu = 1.5)
k_per(scale = 1, period = 1)
Arguments
scale |
The kernel length scale. |
alpha |
The shape/df parameter. |
nu |
The smoothness parameter. |
period |
The period, in the same units as |
Value
A function which calculates a kernel matrix for vector arguments x
and y
. The function has class c("kernel", "function")
.
Functions
-
k_rbf()
: Radial basis function kernel -
k_lapl()
: Laplace kernel -
k_rq()
: Rational quadratic kernel. -
k_matern()
: Matérn kernel. -
k_per()
: Periodic (exp-sine-squared) kernel.
Examples
k = k_rbf()
x = seq(-1, 1, 0.5)
k(0, 0)
k(0, x)
k(x, x)
k = k_per(scale=0.2, period=0.3)
round(k(x, x))