mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-02 14:45:15 +02:00
adapter laplace inference into the param framework
This commit is contained in:
parent
ae03b63afb
commit
9a7d9fa5b7
1 changed files with 21 additions and 0 deletions
|
|
@ -53,6 +53,27 @@ class LaplaceInference(object):
|
||||||
self.restart()
|
self.restart()
|
||||||
likelihood.__init__(self)
|
likelihood.__init__(self)
|
||||||
|
|
||||||
|
def inference(self, kern, X, likelihood, Y, Y_metadata=None):
|
||||||
|
"""
|
||||||
|
Returns a Posterior class containing essential quantities of the posterior
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Compute K
|
||||||
|
self.K = kern.K(X)
|
||||||
|
self.data = Y
|
||||||
|
self.N, self.D = Y.shape
|
||||||
|
|
||||||
|
#Find mode
|
||||||
|
self.f_hat = self.rasm_mode(self.K)
|
||||||
|
|
||||||
|
#Compute hessian and other variables at mode
|
||||||
|
self._compute_likelihood_variables()
|
||||||
|
|
||||||
|
#Compute fake variables replicating laplace approximation to posterior
|
||||||
|
self._compute_GP_variables()
|
||||||
|
|
||||||
|
return Posterior(mean=self.f_hat, cov=self.covariance_matrix, K=self.K)
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
"""
|
"""
|
||||||
Reset likelihood variables to their defaults
|
Reset likelihood variables to their defaults
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue