LikelihoodFunction: Likelihood Function Class

Description Details Public fields Methods

Description

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

Details

We implement the following likelihood functions:

LikGauss

The likelihood of y_i given f_i is normal with mean f_i and variance σ_y^2.

LikLogis

The likelihood of y_i given f_i is given by the logistic function with input y_i f_i (where the binary labels for y are encoded by 1 and -1).

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

The lp() method calculates the log probability of observations. The first argument should be y, the outcomes. The second argument should be f, the function values. The third argument should be hypers, a numeric vector giving all the hyperparameters of the likelihood 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 f_derivative() method is used to obtain the partial derivatives of the log likelihood function with respect to f. (This is useful for optimization in some inference methods). Its arguments should be the same as the lp() method, with one additional argument, order, giving the order of 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 likelihood function's name

hypers

A numeric vector giving the likelihood function's hyperparameters

Methods

Public methods


Method lp()

Compute log probability of outcomes given function values

Usage
LikelihoodFunction$lp(y, f, hypers = NULL)
Arguments
y

The observed outcomes

f

The function values (generally a posterior mean or mode)

hypers

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


Method f_derivative()

Compute partial derivatives of log likelihood function with respect to f

Usage
LikelihoodFunction$f_derivative(y, f, hypers = NULL, order = 1)
Arguments
y

The observed outcomes

f

The function values (generally a posterior mean or mode)

hypers

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

order

An integer vector of length one giving order of derivative desired; the default is 1


Method new()

Create a new LikelihoodFunction object

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

A numeric vector giving hyperparameters for the likelihood function.


Method clone()

The objects of this class are cloneable with this method.

Usage
LikelihoodFunction$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


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