began to merege the SVIGP code into GPy.

Example is implemented, but the step length is a bit crazy!
This commit is contained in:
James Hensman 2013-06-17 13:58:51 +01:00
parent 5d28333582
commit b452e3eebc
7 changed files with 557 additions and 2 deletions

View file

@ -5,3 +5,4 @@ import classification
import regression
import dimensionality_reduction
import tutorials
import stochastic

View file

@ -0,0 +1,41 @@
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import pylab as pb
import numpy as np
import GPy
def toy_1d():
N = 2000
M = 20
#create data
X = np.linspace(0,32,N)[:,None]
Z = np.linspace(0,32,M)[:,None]
Y = np.sin(X) + np.cos(0.3*X) + np.random.randn(*X.shape)/np.sqrt(50.)
m = GPy.models.SVIGPRegression(X,Y, batchsize=10, Z=Z)
m.ensure_default_constraints()
m.constrain_bounded('noise_variance',1e-3,1e-1)
m.param_steplength = 1e-4
fig = pb.figure()
ax = fig.add_subplot(111)
def cb():
ax.cla()
m.plot(ax=ax,Z_height=-3)
ax.set_ylim(-3,3)
fig.canvas.draw()
m.optimize(500, callback=cb, callback_interval=1)
m.plot_traces()
return m