mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-04 17:22:39 +02:00
added some docstrings and the posterior class structure
This commit is contained in:
parent
326c74ef8a
commit
48c292d263
2 changed files with 58 additions and 0 deletions
24
GPy/inference/latent_function_inference/__init__.py
Normal file
24
GPy/inference/latent_function_inference/__init__.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
__doc__ = """
|
||||
Inference over Gaussian process latent functions
|
||||
|
||||
In all our GP models, the consistency propery means that we have a Gaussian
|
||||
prior over a finite set of points f. This prior is
|
||||
|
||||
math:: N(f | 0, K)
|
||||
|
||||
where K is the kernel matrix.
|
||||
|
||||
We also have a likelihood (see GPy.likelihoods) which defines how the data are
|
||||
related to the latent function: p(y | f). If the likelihood is also a Gaussian,
|
||||
the inference over f is tractable (see exact_gaussian_inference.py).
|
||||
|
||||
If the likelihood object is something other than Gaussian, then exact inference
|
||||
is not tractable. We then resort to a Laplace approximation (laplace.py) or
|
||||
expectation propagation (ep.py).
|
||||
|
||||
The inference methods return a "Posterior" instance, which is a simple
|
||||
structure which contains a summary of the posterior. The model classes can then
|
||||
use this posterior object for making predictions, optimizing hyper-parameters,
|
||||
etc.
|
||||
|
||||
"""
|
||||
34
GPy/inference/latent_function_inference/posterior.py
Normal file
34
GPy/inference/latent_function_inference/posterior.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import numpy as np
|
||||
|
||||
class Posterior(object):
|
||||
"""
|
||||
An object to represent a Gaussian posterior over latent function values.
|
||||
"""
|
||||
def __init__(self, log_marginal, dL_dmean=None, cov=None, prec=None):
|
||||
self._log_marginal = log_marginal
|
||||
|
||||
#TODO: accept the init arguments, make sure we've got enough information to compute everything.
|
||||
|
||||
@property
|
||||
def mean(self):
|
||||
if self._mean is None:
|
||||
self._mean = ??
|
||||
return self._mean
|
||||
|
||||
@property
|
||||
def covariance(self):
|
||||
if self._covariance is None:
|
||||
self._covariance = ??
|
||||
return self._covariance
|
||||
|
||||
@property
|
||||
def precision(self):
|
||||
if self._precision is None:
|
||||
self._precision = ??
|
||||
return self._precision
|
||||
|
||||
@prop
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue