diff --git a/GPy/models/Bayesian_GPLVM.py b/GPy/models/Bayesian_GPLVM.py index 430c2718..a18ec9bb 100644 --- a/GPy/models/Bayesian_GPLVM.py +++ b/GPy/models/Bayesian_GPLVM.py @@ -85,5 +85,5 @@ class Bayesian_GPLVM(sparse_GP, GPLVM): return np.hstack((self.dL_dmuS().flatten(), sparse_GP._log_likelihood_gradients(self))) def plot_latent(self, *args, **kwargs): - input_1, input_2 = GPLVM.plot_latent(*args, **kwargs) - pb.plot(m.Z[:, input_1], m.Z[:, input_2], '^w') + input_1, input_2 = GPLVM.plot_latent(self, *args, **kwargs) + pb.plot(self.Z[:, input_1], self.Z[:, input_2], '^w') diff --git a/GPy/models/GPLVM.py b/GPy/models/GPLVM.py index b44801fc..5be54049 100644 --- a/GPy/models/GPLVM.py +++ b/GPy/models/GPLVM.py @@ -81,13 +81,16 @@ class GPLVM(GP): raise ValueError, "cannot Atomatically determine which dimensions to plot, please pass 'which_indices'" k = k[0] if k.name=='rbf': - input_1, input_2 = np.argsort(k.lengthscales)[:2] + input_1, input_2 = np.argsort(k.lengthscale)[:2] elif k.name=='linear': input_1, input_2 = np.argsort(k.variances)[::-1][:2] #first, plot the output variance as a function of the latent space Xtest, xx,yy,xmin,xmax = util.plot.x_frame2D(self.X[:,[input_1, input_2]],resolution=resolution) - mu, var, low, up = self.predict(Xtest) + Xtest_full = np.zeros((Xtest.shape[0], self.X.shape[1])) + Xtest_full[:, :2] = Xtest + mu, var, low, up = self.predict(Xtest_full) + var = var[:, :2] pb.imshow(var.reshape(resolution,resolution).T[::-1,:],extent=[xmin[0],xmax[0],xmin[1],xmax[1]],cmap=pb.cm.binary,interpolation='bilinear')