Computes Matérn kernels for smoothness parameters \(\nu = 1/2\), \(3/2\), and \(5/2\). A scalar length scale gives an isotropic distance; one length scale per input dimension gives ARD.
Usage
kernel_matern12(x, y = NULL, variance = 1, length_scale = 1)
kernel_matern32(x, y = NULL, variance = 1, length_scale = 1)
kernel_matern52(x, y = NULL, variance = 1, length_scale = 1)Arguments
- x
Numeric vector or matrix. Matrix rows are observations and columns are input dimensions.
- y
Optional numeric vector or matrix with the same number of input dimensions as
x. IfNULL, computes the covariance ofxwith itself.- variance
Positive marginal variance.
- length_scale
Positive scalar or numeric vector with one value per input dimension. A vector enables ARD.
Stability
Stable: from version 1.0.0 this interface changes incompatibly only in a major release, after a deprecation period. Results and options that concern an experimental model class, kernel, or argument follow that interface's tier. See gaussianprocesses-package for the policy.
See also
matern_kernel_specs for the same kernels as reusable specifications, which can be combined, optimized, and used in models.
Examples
x <- seq(0, 2, by = 0.5)
# Smoothness increases from nu = 1/2 to nu = 5/2.
kernel_matern12(x, length_scale = 0.7)[1, ]
#> [1] 1.00000000 0.48954166 0.23965104 0.11731917 0.05743262
kernel_matern32(x, length_scale = 0.7)[1, ]
#> [1] 1.00000000 0.64923315 0.29260009 0.11514960 0.04219131
kernel_matern52(x, length_scale = 0.7)[1, ]
#> [1] 1.00000000 0.69800227 0.31136332 0.11158216 0.03527718