Description Details Public fields Methods
This provides a parent class for all likelihood function classes for gpmss.
We implement the following likelihood functions:
The likelihood of y_i given f_i is normal with mean f_i and variance σ_y^2.
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.
name
A character vector of length one giving the likelihood function's name
hypers
A numeric vector giving the likelihood function's hyperparameters
lp()
Compute log probability of outcomes given function values
LikelihoodFunction$lp(y, f, hypers = NULL)
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.
f_derivative()
Compute partial derivatives of log likelihood function with respect to f
LikelihoodFunction$f_derivative(y, f, hypers = NULL, order = 1)
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
new()
Create a new LikelihoodFunction object
LikelihoodFunction$new(hypers = numeric())
hypers
A numeric vector giving hyperparameters for the likelihood function.
clone()
The objects of this class are cloneable with this method.
LikelihoodFunction$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.