Assorted work on combining the EP and sparse methods

This commit is contained in:
James Hensman 2013-02-01 17:12:45 +00:00
parent 64280d7eb6
commit 5447d6fbfc
7 changed files with 95 additions and 44 deletions

View file

@ -19,6 +19,7 @@ class EP(likelihood):
self.data = data
self.N = self.data.size
self.is_heteroscedastic = True
self.Nparams = 0
#Initial values - Likelihood approximation parameters:
#p(y|f) = t(f|tau_tilde,v_tilde)
@ -28,6 +29,7 @@ class EP(likelihood):
#initial values for the GP variables
self.Y = np.zeros((self.N,1))
self.covariance_matrix = np.eye(self.N)
self.precision = np.ones(self.N)
self.Z = 0
self.YYT = None

View file

@ -4,6 +4,7 @@ from likelihood import likelihood
class Gaussian(likelihood):
def __init__(self,data,variance=1.,normalize=False):
self.is_heteroscedastic = False
self.Nparams = 1
self.data = data
self.N,D = data.shape
self.Z = 0. # a correction factor which accounts for the approximation made
@ -18,7 +19,9 @@ class Gaussian(likelihood):
self._std = np.ones((1,D))
self.Y = self.data
#TODO: make this work efficiently (only compute YYT if D>>N)
self.YYT = np.dot(self.Y,self.Y.T)
self.trYYT = np.trace(self.YYT)
self._set_params(np.asarray(variance))
@ -50,4 +53,4 @@ class Gaussian(likelihood):
pass
def _gradients(self,partial):
return np.sum(np.diag(partial))
return np.sum(partial)