mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-05 14:55:15 +02:00
Minor modifications to visualization routines and examples.
This commit is contained in:
parent
fce4dd7fde
commit
9422c603b1
2 changed files with 15 additions and 16 deletions
|
|
@ -73,12 +73,12 @@ def oil_100():
|
|||
|
||||
def brendan_faces():
|
||||
data = GPy.util.datasets.brendan_faces()
|
||||
Y = data['Y'][0:500, :]
|
||||
m = GPy.models.GPLVM(Y, 2, init='rand')
|
||||
Y = data['Y'][0:-1:10, :]
|
||||
m = GPy.models.GPLVM(data['Y'], 2)
|
||||
|
||||
# optimize
|
||||
m.ensure_default_constraints()
|
||||
m.optimize(messages=1, max_f_eval=40)
|
||||
m.optimize(messages=1, max_f_eval=10000)
|
||||
|
||||
ax = m.plot_latent()
|
||||
y = m.likelihood.Y[0,:]
|
||||
|
|
@ -91,7 +91,7 @@ def brendan_faces():
|
|||
|
||||
def stick():
|
||||
data = GPy.util.datasets.stick()
|
||||
m = GPy.models.GPLVM(data['Y'], 2, init='rand')
|
||||
m = GPy.models.GPLVM(data['Y'], 2)
|
||||
|
||||
# optimize
|
||||
m.ensure_default_constraints()
|
||||
|
|
|
|||
|
|
@ -14,19 +14,18 @@ class lvm:
|
|||
self.move_on = False
|
||||
|
||||
def on_click(self, event):
|
||||
print 'click', event.xdata, event.ydata
|
||||
#print 'click', event.xdata, event.ydata
|
||||
if event.inaxes!=self.latent_axis: return
|
||||
self.move_on = not self.move_on
|
||||
print
|
||||
if self.called:
|
||||
self.xs.append(event.xdata)
|
||||
self.ys.append(event.ydata)
|
||||
self.line.set_data(self.xs, self.ys)
|
||||
self.line.figure.canvas.draw()
|
||||
else:
|
||||
self.xs = [event.xdata]
|
||||
self.ys = [event.ydata]
|
||||
self.line, = self.latent_axis.plot(event.xdata, event.ydata)
|
||||
# if self.called:
|
||||
# self.xs.append(event.xdata)
|
||||
# self.ys.append(event.ydata)
|
||||
# self.line.set_data(self.xs, self.ys)
|
||||
# self.line.figure.canvas.draw()
|
||||
# else:
|
||||
# self.xs = [event.xdata]
|
||||
# self.ys = [event.ydata]
|
||||
# self.line, = self.latent_axis.plot(event.xdata, event.ydata)
|
||||
self.called = True
|
||||
def on_move(self, event):
|
||||
if event.inaxes!=self.latent_axis: return
|
||||
|
|
@ -75,7 +74,7 @@ class image_show(data_show):
|
|||
self.invert = invert
|
||||
self.scale = scale
|
||||
self.set_image(vals/255.)
|
||||
self.handle = self.axis.imshow(self.vals, interpolation='nearest')
|
||||
self.handle = self.axis.imshow(self.vals, cmap=plt.cm.gray, interpolation='nearest')
|
||||
plt.show()
|
||||
|
||||
def modify(self, vals):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue