CovarianceFunction: Covariance Function Class

Description Details Public fields Methods

Description

This provides a parent class for all covariance function classes for gpmss.

Details

"A Gaussian process is completely specified by its mean function and covariance function" (Rasmussen and Williams 2006, 13). The covariance function gives the prior covariance between function outputs given two sets of input values. A valid covariance function must be a positive semi-definite kernel; see Rasmussen and Williams (2006), Chapter 4 for details.

We implement the following covariance functions:

CovSEiso

The isometric squared exponential covariance function. This is also sometimes called the Gaussian kernel, the squared exponential kernel, or the radial basis function.

CovSEard

The squared exponential covariance function with automatic relevance determination. This is also sometimes called the anisotropic squared exponential kernel or covariance function.

Users may also define their own covariance functions for use with gpmss functions. A covariance function class must provide a cov() method, a parameter_derivative() method, and a input_derivative() method. It must have data members hypers and name.

The cov() method is used to actually call the covariance function. The first argument should be X, the first set of inputs. The second argument should be Z, the second set of inputs; its default value should be X. The third argument should be hypers, a numeric vector giving all the hyperparameters of the covariance function; its default value should be NULL, in which case, the data member hypers is utilized. (We allow passing different hypers for convenience in hyperparameter optimization).

The parameter_derivative() method is used to obtain the partial derivatives of the covariance function with respect to each of its hyperparameters. (This is useful for optimization). Its arguments should be the same as the cov() method, with one additional argument, param, giving the index of hypers of the parameter with respect to which the derivative should be taken.

The input_derivative() method is used to obtain the partial derivatives of the covariance function with respect to its inputs. (This is useful for obtaining marginal effects). Its arguments should be the same as the cov() method, with two additional arguments: dimension, an integer vector of length one giving the dimension of X with respect to which the derivative is being taken; and order, an integer vector of length one giving the order of partial derivative desired.

Its constructor should take at least one argument, hypers, which will be stored as the data member hypers. This should have a sane default, as many users may pass the class generator to the constructor for a GPModel without explicitly specifying hyperparameters. This should not cause much difficulty if the user optimizes the hyperparameters, but a sane default should be provided nonetheless. The data member hypers should be a public member so that it can be accessed and modified directly.

The data member name should be hard-coded within the class definition; it is used for printing purposes (potentially in other functions). It should be a public member so that it can be accessed directly.

Public fields

name

A character vector of length one giving the covariance function's name

hypers

A numeric vector giving the covariance function's hyperparameters

Methods

Public methods


Method cov()

Compute function covariance

Usage
CovarianceFunction$cov(X, Z = X, hypers = NULL)
Arguments
X

The first set of input values (should be a numeric matrix)

Z

The second set of input values (should be a numeric matrix); The default is Z = X.

hypers

A numeric vector giving hyperparameters for the covariance function. If NULL (the default), the hypers data member is used.


Method parameter_derivative()

Compute partial derivatives of covariance function with respect to its hyperparameters

Usage
CovarianceFunction$parameter_derivative(X, Z = X, hypers = NULL, param = 1)
Arguments
X

The first set of input values (should be a numeric matrix)

Z

The second set of input values (should be a numeric matrix); The default is Z = X.

hypers

A numeric vector giving hyperparameters for the covariance function. If NULL (the default), the hypers data member is used.

param

An integer vector of length one; which element of hypers should the derivative be taken with respect to? The default is 1


Method input_derivative()

Compute partial derivatives of covariance function with respect to its inputs

Usage
CovarianceFunction$input_derivative(
  X,
  Z = X,
  hypers = NULL,
  dimension = 1,
  order = 1
)
Arguments
X

The first set of input values (should be a numeric matrix)

Z

The second set of input values (should be a numeric matrix); The default is Z = X.

hypers

A numeric vector giving hyperparameters for the covariance function. If NULL (the default), the hypers data member is used.

dimension

an integer vector of length one giving the dimension of X with respect to which the derivative is being taken; the default is 1

order

An integer vector of length one indicating whether the first partial derivative (order = 1) is desired, or the cross partial (order = 2); the default is 1


Method new()

Create a new CovarianceFunction object

Usage
CovarianceFunction$new(hypers = numeric())
Arguments
hypers

A numeric vector giving hyperparameters for the covariance function.


Method clone()

The objects of this class are cloneable with this method.

Usage
CovarianceFunction$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


duckmayr/gpmss documentation built on Nov. 8, 2021, 5:48 a.m.