geometric_kernels.frontends.gpflow

GPflow kernel wrapper.

A tutorial on how to use this wrapper to run Gaussian process regression on a geometric space is available in the frontends/GPflow.ipynb notebook.

Module Contents

class geometric_kernels.frontends.gpflow.DefaultFloatZeroMeanFunction(output_dim=1)[source]

Bases: gpflow.mean_functions.Constant

Zero mean function. The default GPflow’s ZeroMeanFunction uses the input’s dtype as output type, this minor adaptation uses GPflow’s default_float instead. This is to allow integer-valued inputs, like in the case of Graph and Mesh.

Parameters:

output_dim (int)

class geometric_kernels.frontends.gpflow.GPflowGeometricKernel(base_kernel, active_dims=None, name=None, lengthscales=None, nu=None, variance=1.0, trainable_nu=False)[source]

Bases: gpflow.kernels.Kernel

GPflow wrapper for BaseGeometricKernel.

A tutorial on how to use this wrapper to run Gaussian process regression on a geometric space is available in the frontends/GPflow.ipynb notebook.

Note

Remember that the base_kernel itself does not store any of its hyperparameters (like lengthscale and nu). If you do not set them manually—when initializing the object or after, by setting the properties—this wrapper will use the values provided by base_kernel.init_params.

Note

As customary in GPflow, this wrapper calls the length scale parameter lengthscales (plural), as opposed to the convention used by GeometricKernels, where we call it lengthscale (singular).

Parameters:
  • base_kernel (geometric_kernels.kernels.BaseGeometricKernel) – The kernel to wrap.

  • active_dims (beartype.typing.Optional[gpflow.kernels.base.ActiveDims]) – Active dimensions, either a slice or list of indices into the columns of X (inherited from gpflow.kernels.base.Kernel).

  • name (beartype.typing.Optional[str]) – Optional kernel name (inherited from gpflow.kernels.base.Kernel).

  • lengthscales (beartype.typing.Union[float, gpflow.base.TensorType, numpy.ndarray]) –

    Initial value of the length scale. Note s in lengthscales.

    If not given or set to None, uses the default value of the base_kernel, as provided by its init_params method.

  • nu (beartype.typing.Union[float, gpflow.base.TensorType, numpy.ndarray]) –

    Initial value of the smoothness parameter nu.

    If not given or set to None, uses the default value of the base_kernel, as provided by its init_params method.

  • variance (beartype.typing.Union[float, gpflow.base.TensorType, numpy.ndarray]) –

    Initial value of the variance (outputscale) parameter.

    Defaults to 1.0.

  • trainable_nu (bool) –

    Whether or not the parameter nu is to be optimized over.

    Cannot be True if nu is equal to infinity. You cannot change this parameter after constructing the object. Defaults to False.

Raises:

ValueError – If trying to set nu = infinity together with trainable_nu = True.

K(X, X2=None)[source]

Evaluate the covariance matrix K(X, X2) (or K(X, X) if X2=None).

Parameters:
  • X (gpflow.base.TensorType)

  • X2 (beartype.typing.Optional[gpflow.base.TensorType])

Return type:

gpflow.base.TensorType

K_diag(X)[source]

Evaluate the diagonal of the covariance matrix K(X, X).

Parameters:

X (gpflow.base.TensorType)

Return type:

gpflow.base.TensorType

property space: beartype.typing.Union[geometric_kernels.spaces.Space, beartype.typing.List[geometric_kernels.spaces.Space]]

Alias to the base_kernels space property.

Return type:

beartype.typing.Union[geometric_kernels.spaces.Space, beartype.typing.List[geometric_kernels.spaces.Space]]