From 3f924bea8fc2661cd44a25a2d8b197ae4334ddf0 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 21 Feb 2013 15:21:37 +0000 Subject: [PATCH] Some bugfixes that have affected GPLVM/sparseGPLVM since the hetero noise change --- GPy/models/GPLVM.py | 6 +++--- GPy/models/sparse_GPLVM.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/GPy/models/GPLVM.py b/GPy/models/GPLVM.py index a0ee55ef..0274647d 100644 --- a/GPy/models/GPLVM.py +++ b/GPy/models/GPLVM.py @@ -53,10 +53,10 @@ class GPLVM(GP): return np.hstack((dL_dX.flatten(),GP._log_likelihood_gradients(self))) def plot(self): - assert self.Y.shape[1]==2 - pb.scatter(self.Y[:,0],self.Y[:,1],40,self.X[:,0].copy(),linewidth=0,cmap=pb.cm.jet) + assert self.likelihood.Y.shape[1]==2 + pb.scatter(self.likelihood.Y[:,0],self.likelihood.Y[:,1],40,self.X[:,0].copy(),linewidth=0,cmap=pb.cm.jet) Xnew = np.linspace(self.X.min(),self.X.max(),200)[:,None] - mu, var = self.predict(Xnew) + mu, var, upper, lower = self.predict(Xnew) pb.plot(mu[:,0], mu[:,1],'k',linewidth=1.5) def plot_latent(self): diff --git a/GPy/models/sparse_GPLVM.py b/GPy/models/sparse_GPLVM.py index 94559cca..dc97c79e 100644 --- a/GPy/models/sparse_GPLVM.py +++ b/GPy/models/sparse_GPLVM.py @@ -42,7 +42,8 @@ class sparse_GPLVM(sparse_GP_regression, GPLVM): return sparse_GP_regression.log_likelihood(self) def dL_dX(self): - dL_dpsi1 = self.dL_dpsi1 + 2.*np.dot(self.dL_dpsi2,self.psi1) + #dL_dpsi1 = self.dL_dpsi1 + 2.*np.dot(self.dL_dpsi2,self.psi1) + dL_dpsi1 = self.dL_dpsi1 + 2.*np.dot(self.dL_dpsi2[0,:,:],self.psi1) dL_dX = self.kern.dKdiag_dX(self.dL_dpsi0,self.X) dL_dX += self.kern.dK_dX(dL_dpsi1.T,self.X,self.Z) @@ -55,5 +56,5 @@ class sparse_GPLVM(sparse_GP_regression, GPLVM): def plot(self): GPLVM.plot(self) #passing Z without a small amout of jitter will induce the white kernel where we don;t want it! - mu, var = sparse_GP_regression.predict(self, self.Z+np.random.randn(*self.Z.shape)*0.0001) + mu, var, upper, lower = sparse_GP_regression.predict(self, self.Z+np.random.randn(*self.Z.shape)*0.0001) pb.plot(mu[:, 0] , mu[:, 1], 'ko')