This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
infMethods.m
executable file
·51 lines (51 loc) · 2.52 KB
/
infMethods.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
% Inference methods: Compute the (approximate) posterior for a Gaussian process.
% Methods currently implemented include:
%
% infGaussLik Exact inference (only possible with Gaussian likelihood)
% infLaplace Laplace's Approximation
% infEP Expectation Propagation
% infVB Variational Bayes Approximation
% infKL Kullback-Leibler optimal Approximation
%
% infMCMC Markov Chain Monte Carlo and Annealed Importance Sampling
% We offer two samplers.
% - hmc: Hybrid Monte Carlo
% - ess: Elliptical Slice Sampling
% No derivatives w.r.t. to hyperparameters are provided.
%
% infLOO Leave-One-Out predictive probability and Least-Squares Approxim.
% infPrior Perform inference with hyperparameter prior.
%
% The interface to the approximation methods is the following:
%
% function [post nlZ dnlZ] = inf..(hyp, cov, lik, x, y)
%
% where:
%
% hyp is a struct of hyperparameters
% cov is the name of the covariance function (see covFunctions.m)
% lik is the name of the likelihood function (see likFunctions.m)
% x is a n by D matrix of training inputs
% y is a (column) vector (of size n) of targets
%
% nlZ is the returned value of the negative log marginal likelihood
% dnlZ is a (column) vector of partial derivatives of the negative
% log marginal likelihood w.r.t. each hyperparameter
% post struct representation of the (approximate) posterior containing
% alpha is a (sparse or full column vector) containing inv(K)*(mu-m),
% where K is the prior covariance matrix, m the prior mean,
% and mu the approx posterior mean
% sW is a (sparse or full column) vector containing diagonal of sqrt(W)
% the approximate posterior covariance matrix is inv(inv(K)+W)
% L is a (sparse or full) triangular matrix, L = chol(sW*K*sW+eye(n)),
% or a full matrix, L = -inv(K+inv(W)),
% or a function L(A) of a matrix A such that -(K+inv(W))*L(A) = A
%
% Usually, the approximate posterior to be returned admits the form
% N(mu=m+K*alpha, V=inv(inv(K)+W)), where alpha is a vector and W is diagonal.
%
% For more information on the individual approximation methods and their
% implementations, see the separate inf??.m files. See also gp.m.
%
% Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2016-10-28.
% File automatically generated using noweb.