Merge branch 'params' of github.com:SheffieldML/GPy into params

This commit is contained in:
Max Zwiessele 2014-03-18 16:30:49 +00:00
commit a3287c38ea
4 changed files with 8 additions and 9 deletions

View file

@ -42,10 +42,8 @@ class GP(Model):
assert Y.shape[0] == self.num_data
_, self.output_dim = self.Y.shape
if Y_metadata is None:
self.Y_metadata = {}
else:
self.Y_metadata = Y_metadata
#TODO: check the type of this is okay?
self.Y_metadata = Y_metadata
assert isinstance(kernel, kern.Kern)
#assert self.input_dim == kernel.input_dim

View file

@ -3,6 +3,7 @@
from posterior import Posterior
from ...util.linalg import pdinv, dpotrs, tdot
from ...util import diag
import numpy as np
log_2_pi = np.log(2*np.pi)
@ -41,7 +42,9 @@ class ExactGaussianInference(object):
K = kern.K(X)
Wi, LW, LWi, W_logdet = pdinv(K + likelihood.covariance_matrix(Y, Y_metadata))
Ky = K.copy()
diag.add(Ky, likelihood.gaussian_variance(Y, Y_metadata))
Wi, LW, LWi, W_logdet = pdinv(Ky)
alpha, _ = dpotrs(LW, YYT_factor, lower=1)

View file

@ -65,7 +65,7 @@ class VarDTC(object):
_, output_dim = Y.shape
#see whether we've got a different noise variance for each datum
beta = 1./np.fmax(likelihood.gaussian_variance(Y_metadata), 1e-6)
beta = 1./np.fmax(likelihood.gaussian_variance(Y, Y_metadata), 1e-6)
# VVT_factor is a matrix such that tdot(VVT_factor) = VVT...this is for efficiency!
#self.YYTfactor = self.get_YYTfactor(Y)
#VVT_factor = self.get_VVTfactor(self.YYTfactor, beta)

View file

@ -51,14 +51,12 @@ class Gaussian(Likelihood):
self.log_concave = True
def betaY(self,Y,Y_metadata=None):
#TODO: ~Ricardo this does not live here
return Y/self.gaussian_variance(Y_metadata)
def gaussian_variance(self, Y_metadata=None):
return self.variance
def covariance_matrix(self, Y, Y_metadata=None):
return np.eye(Y.shape[0]) * self.variance
def update_gradients(self, grad):
self.variance.gradient = grad