runlmc.kern.stationary_kern module

This file contains StationaryKern, the kernel base class.

Note this class does not accomplish as much as the corresponding one does in GPy. See the class documentation for details.

Note that the corresponding GPy versions of these kernels have a scaling parameter that’s avoided inthe LMC case because it would be redundant with the coregionalization constants.

class runlmc.kern.stationary_kern.StationaryKern(name, active_dims=None)[source]

Bases: runlmc.parameterization.parameterized.Parameterized

The StationaryKern defines a stationary kernel.

It is a light wrapper around the mathematical definition of a kernel, which includes its parameters. A kernel object never contains any data, as a parameterized object its gradients can be changed according to whatever data it’s being tuned to.

A stationary kernel is a function \(k(r)\) defined on \(\mathbb{R}_+\) such that a matrix \(K\) of entries \(k(\|\textbf{x}_i-\textbf{x}_j\|)\) is positive semi-definite. Moreover, if \(\{\textbf{x}_i\}_i\) lie on a grid then \(K\) will be block-Toeplitz of Toeplitz blocks. If further \(\textbf{x}_i\in\mathbb{R}\) then \(K\) will be Toeplitz.

Parameters:
  • name
  • active_dims – active dimensions (from which Euclidean distances fed into the kernel as inputs are computed). I.e., if data for a problem are 3D \((x, y, t)\) with \(x,y\) spatial coordinates and \(t\) time then the default active_dims setting of None would evaluate the kernel \(k\) between two points as \(k(\|(x_1-x_2,y_1-y_2,t_1-t_2)\|)\), which doesn’t make much sense. In this case you might want to use active_dims to specify a sum kernel of two kernels, one over the \((x,y)\) values alone and the other over the \(t\) values alone.
from_dist(dists)[source]
Parameters:distsN-size numpy array of positive (Euclidean) distances.
Returns:kernel value at each of the given distances
kernel_gradient(dists)[source]

Let this kernel be parameterized by some parameters \(\boldsymbol\theta\in\mathbb{R}^p\). For every \(\theta_j\in\boldsymbol\theta\), at any given distance \(d\), we can compute the derivative \(\partial_{\theta_j}k(d)\). For the evaluation of this partial derivative at multiple places, \(\textbf{d}\), we call the vector of partial derivatives \(\partial_{\theta_j}k(\textbf{d})\).

Parameters:dists – a one-dimensional array of distances corresponding to \(\textbf{d}\), above.
Returns:An iterable whose \(j\)-th entry is \(\partial_{\theta_j}k(\textbf{d})\).
to_gpy()[source]
Returns:GPy version of this kernel.
update_gradient(grad)[source]
Parameters:grad – a one-dimensional array, representing the gradient vector \(\nabla_{\boldsymbol\theta}L\) for the likelihood with respect to this kernel’s parameters, in the same order of parameters as the row order returned by kernel_gradient().