mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-09 12:02:38 +02:00
GP_regression and sparse_GP_regression now only return the full
posterior covariance matrix when requested.
This commit is contained in:
parent
2999c6d2d6
commit
aae006411a
2 changed files with 36 additions and 14 deletions
|
|
@ -171,14 +171,19 @@ class sparse_GP_regression(GP_regression):
|
|||
def log_likelihood_gradients(self):
|
||||
return np.hstack([self.dL_dZ().flatten(), self.dL_dbeta(), self.dL_dtheta()])
|
||||
|
||||
def _raw_predict(self, Xnew, slices):
|
||||
def _raw_predict(self, Xnew, slices, full_cov=False):
|
||||
"""Internal helper function for making predictions, does not account for normalisation"""
|
||||
|
||||
Kx = self.kern.K(self.Z, Xnew)
|
||||
Kxx = self.kern.K(Xnew)
|
||||
|
||||
mu = mdot(Kx.T, self.LBL_inv, self.psi1V)
|
||||
var = Kxx - mdot(Kx.T, (self.Kmmi - self.LBL_inv), Kx) + np.eye(Xnew.shape[0])/self.beta # TODO: This beta doesn't belong here in the EP case.
|
||||
|
||||
if full_cov:
|
||||
Kxx = self.kern.K(Xnew)
|
||||
var = Kxx - mdot(Kx.T, (self.Kmmi - self.LBL_inv), Kx) + np.eye(Xnew.shape[0])/self.beta # TODO: This beta doesn't belong here in the EP case.
|
||||
else:
|
||||
Kxx = self.kern.Kdiag(Xnew)
|
||||
var = Kxx - np.sum(Kx*np.dot(self.Kmmi - self.LBL_inv, Kx),0) + 1./self.beta # TODO: This beta doesn't belong here in the EP case.
|
||||
|
||||
return mu,var
|
||||
|
||||
def plot(self, *args, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue