MeanFunction: Mean Function Class

Description Details Public fields Methods

Description

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

Details

"A Gaussian process is completely specified by its mean function and covariance function" (Rasmussen and Williams 2006, 13). The mean function gives the prior mean for function output given input values.

We implement the following mean functions:

MeanZero

A zero mean; for any set of inputs, the GP's prior mean is zero.

MeanLinear

A linear mean; the GP's prior mean is a vector of coefficients multiplied by the predictors, plus (optionally) an intercept.

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

The mean() method is used to actually call the mean function. The first argument should be X, the first set of inputs. The second argument should be hypers, a numeric vector giving all the hyperparameters of the mean 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 mean function with respect to each of its hyperparameters. (This is useful for optimization). Its arguments should be the same as the mean() 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 mean function with respect to its inputs. (This is useful for obtaining marginal effects). Its arguments should be the same as the mean() method, with an additional argument: dimension, an integer vector of length one giving the dimension of X with respect to which the derivative is being taken.

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 mean function's name

hypers

A numeric vector giving the mean function's hyperparameters

Methods

Public methods


Method mean()

Compute function prior mean

Usage
MeanFunction$mean(X, hypers = NULL)
Arguments
X

The input values (should be a numeric matrix)

hypers

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


Method parameter_derivative()

Compute partial derivatives of mean function with respect to its hyperparameters

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

The input values (should be a numeric matrix)

hypers

A numeric vector giving hyperparameters for the mean 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 mean function with respect to its inputs

Usage
MeanFunction$input_derivative(X, hypers = NULL, dimension = 1)
Arguments
X

The input values (should be a numeric matrix)

hypers

A numeric vector giving hyperparameters for the mean 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


Method new()

Create a new MeanFunction object

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

A numeric vector giving hyperparameters for the mean function.


Method clone()

The objects of this class are cloneable with this method.

Usage
MeanFunction$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


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