diff --git a/GPy/examples/dimensionality_reduction.py b/GPy/examples/dimensionality_reduction.py index c1911e75..8a31968e 100644 --- a/GPy/examples/dimensionality_reduction.py +++ b/GPy/examples/dimensionality_reduction.py @@ -176,7 +176,7 @@ def bgplvm_oil(optimize=True, verbose=1, plot=True, N=200, Q=7, num_inducing=40, if plot: y = m.Y fig, (latent_axes, sense_axes) = plt.subplots(1, 2) - m.plot_latent(ax=latent_axes) + m.plot_latent(ax=latent_axes, labels=m.data_labels) data_show = GPy.plotting.matplot_dep.visualize.vector_show(y) lvm_visualizer = GPy.plotting.matplot_dep.visualize.lvm_dimselect(param_to_array(m.X.mean), # @UnusedVariable m, data_show, latent_axes=latent_axes, sense_axes=sense_axes) diff --git a/GPy/plotting/matplot_dep/visualize.py b/GPy/plotting/matplot_dep/visualize.py index cf457633..89d36a7d 100644 --- a/GPy/plotting/matplot_dep/visualize.py +++ b/GPy/plotting/matplot_dep/visualize.py @@ -131,10 +131,10 @@ class lvm(matplotlib_show): def modify(self, vals): """When latent values are modified update the latent representation and ulso update the output visualization.""" - self.vals = vals[None,:].copy() + self.vals = vals.copy() y = self.model.predict(self.vals)[0] self.data_visualize.modify(y) - self.latent_handle.set_data(self.vals[:,self.latent_index[0]], self.vals[:,self.latent_index[1]]) + self.latent_handle.set_data(self.vals[0,self.latent_index[0]], self.vals[0,self.latent_index[1]]) self.axes.figure.canvas.draw() @@ -153,8 +153,8 @@ class lvm(matplotlib_show): if event.inaxes!=self.latent_axes: return if self.called and self.move_on: # Call modify code on move - self.latent_values[self.latent_index[0]]=event.xdata - self.latent_values[self.latent_index[1]]=event.ydata + self.latent_values[:, self.latent_index[0]]=event.xdata + self.latent_values[:, self.latent_index[1]]=event.ydata self.modify(self.latent_values) def show_sensitivities(self):