gpmp.kernel covariance helpers

Covariance functions and covariance-parameter initial guesses work with backend-native arrays and plain covariance-parameter vectors, independently from the optional gpmp.parameter display helpers.

Covariance functions

exponential_kernel, matern32_kernel, and maternp_kernel evaluate correlation kernels as functions of a scaled distance. maternp_covariance combines the Matern kernel with the GPmp covariance-parameter convention [log(sigma2), -log(rho_0), ...] and is the usual covariance function for anisotropic Matern models.

exponential_kernel

gpmp.kernel.exponential_kernel(h)[source]

Exponential kernel.

\[k(h) = \exp(-h)\]
Parameters:

h (gnp.array, shape (n,)) – Distances between points.

Returns:

Kernel values.

Return type:

gnp.array, shape (n,)

matern32_kernel

gpmp.kernel.matern32_kernel(h)[source]

Matérn 3/2 kernel.

\[K(h) = (1 + 2\sqrt{3/2}\,h) \exp(-2\sqrt{3/2}\,h)\]
Parameters:

h (gnp.array, shape (n,)) – Distances between points.

Returns:

Kernel values.

Return type:

gnp.array, shape (n,)

maternp_kernel

gpmp.kernel.maternp_kernel(p: int, h)[source]

Matérn kernel with half-integer regularity \(\nu = p + 1/2\).

Using the half-integer simplification (Watson 1922; Abramowitz & Stegun):

\[K(h) = \exp(-2\sqrt{\nu}\,h)\, \frac{\Gamma(p+1)}{\Gamma(2p+1)} \sum_{i=0}^{p} \frac{(p+i)!}{i!(p-i)!}\,(4\sqrt{\nu}h)^{\,p-i}\]
Parameters:
  • p (int) – Nonnegative integer with \(\nu = p+1/2\).

  • h (gnp.array) – Distances.

Returns:

Kernel values.

Return type:

gnp.array

maternp_covariance

gpmp.kernel.maternp_covariance(x, y, p, param, pairwise=False)[source]

Matérn covariance (\(\nu = p+1/2\)). Wrapper.

Parameters:
  • x (gnp.array, shape (nx, d))

  • y (gnp.array or None)

  • p (int)

  • param (gnp.array, shape (1 + d,))

  • pairwise (bool)

Return type:

gnp.array

Initial guesses

Initial-guess helpers construct a covariance-parameter vector from observation points and values. They are often used as covparam0 for selection procedures, or as a prior anchor for REMAP procedures.

anisotropic_parameters_initial_guess_zero_mean

gpmp.kernel.anisotropic_parameters_initial_guess_zero_mean(model, xi=None, zi=None, dataloader=None)[source]

Anisotropic initialization with zero mean.

anisotropic_parameters_initial_guess

gpmp.kernel.anisotropic_parameters_initial_guess(model, xi=None, zi=None, dataloader=None)[source]

Anisotropic initialization for general mean handling.