just general tidying

This commit is contained in:
James Hensman 2014-01-06 10:40:36 +00:00
parent 8cad49ce13
commit f669d0124b
2 changed files with 8 additions and 4 deletions

View file

@ -190,7 +190,7 @@ class GPBase(Model):
upper = m + 2*np.sqrt(v) upper = m + 2*np.sqrt(v)
Y = self.Y Y = self.Y
else: else:
m, v, lower, upper = self.predict(Xgrid, which_parts=which_parts) #Compute the exact mean m, v, lower, upper = self.predict(Xgrid, which_parts=which_parts)
Y = self.Y Y = self.Y
for d in which_data_ycols: for d in which_data_ycols:
gpplot(Xnew, m[:, d], lower[:, d], upper[:, d], axes=ax, edgecol=linecol, fillcol=fillcol) gpplot(Xnew, m[:, d], lower[:, d], upper[:, d], axes=ax, edgecol=linecol, fillcol=fillcol)

View file

@ -54,7 +54,7 @@ class Gaussian(Likelihood):
def _gradients(self, partial): def _gradients(self, partial):
""" """
Return the derivative of the log marginal likelihood wrt self.variance, Return the derivative of the log marginal likelihood wrt self.variance,
given the appropriate partial derivative given the appropriate partial derivative
""" """
return np.sum(partial) return np.sum(partial)
@ -82,9 +82,13 @@ class Gaussian(Likelihood):
def predictive_values(self, mu, var, full_cov=False): def predictive_values(self, mu, var, full_cov=False):
if full_cov: if full_cov:
low, up = mu - np.diag(var)[:,None], mu + np.diag(var)[:,None] var += np.eye(var.shape[0])*self.variance
d = 2*np.sqrt(np.diag(var))
low, up = mu - d, mu + d
else: else:
low, up = mu - var, mu + var var += self.variance
d = 2*np.sqrt(var)
low, up = mu - d, mu + d
return mu, var, low, up return mu, var, low, up
def predictive_mean(self, mu, sigma): def predictive_mean(self, mu, sigma):