Computes a periodic kernel with a shared period and either an isotropic length scale or one ARD length scale per input dimension.
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.
- period
Positive period shared across input dimensions.
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
periodic_kernel() creates the same kernel as a reusable
specification, which can be combined, optimized, and used in models.
Examples
x <- c(0, 0.25, 1, 2)
covariance <- kernel_periodic(x, length_scale = 0.8, period = 1)
# Inputs a whole number of periods apart are perfectly correlated.
covariance[1, ]
#> [1] 1.0000000 0.2096114 1.0000000 1.0000000