Generalised Gaussian Process¶
Introduction¶
A GP is a statistical distribution \(Y_t\), \(t\in\mathrm T\), for which any finite linear combination of samples has a joint Gaussian distribution [1] [2]. An instance of such class of processes is defined via a mean function \(m(\cdot)\) and a covariance function \(k(\cdot, \cdot)\) whose domains are \(\mathrm T\) and \(\mathrm T\times\mathrm T\), respectively.
Here we implement an extension of GPs that makes use of exponential-family likelihoods. An instance of such process is given by
ExpFamGP
performs inference over the mean and covariance
parameters via maximum likelihood and Expectation Propagation [3]
approximation.
Usage¶
- class glimix_core.ggp.ExpFamGP(y, lik, mean, cov)[source]¶
Expectation Propagation for Generalised Gaussian Processes.
- Parameters
y (array_like) – Outcome variable.
lik_name (str) – Likelihood name.
mean (function) – Mean function. (Refer to Mean functions.)
cov (function) – Covariance function. (Refer to Covariance functions.)
Example
>>> from numpy.random import RandomState >>> >>> from glimix_core.example import offset_mean >>> from glimix_core.example import linear_eye_cov >>> from glimix_core.ggp import ExpFamGP >>> from glimix_core.lik import BernoulliProdLik >>> from glimix_core.link import LogitLink >>> from glimix_core.random import GGPSampler >>> >>> random = RandomState(1) >>> >>> lik = BernoulliProdLik(LogitLink()) >>> mean = offset_mean() >>> cov = linear_eye_cov() >>> >>> y = GGPSampler(lik, mean, cov).sample(random) >>> >>> ggp = ExpFamGP(y, 'bernoulli', mean, cov) >>> print('Before: %.4f' % ggp.lml()) Before: -6.9802 >>> ggp.fit(verbose=False) >>> print('After: %.2f' % ggp.lml()) After: -6.55
- fit(verbose=True, factr=100000.0, pgtol=1e-07)[source]¶
Maximise the marginal likelihood.
- Parameters
verbose (bool) –
True
for progress output;False
otherwise. Defaults toTrue
.factr (float, optional) – The iteration stops when
(f^k - f^{k+1})/max{|f^k|,|f^{k+1}|,1} <= factr * eps
, whereeps
is the machine precision.pgtol (float, optional) – The iteration will stop when
max{|proj g_i | i = 1, ..., n} <= pgtol
wherepg_i
is the i-th component of the projected gradient.
Notes
Please, refer to
scipy.optimize.fmin_l_bfgs_b()
for further information aboutfactr
andpgtol
.