FIX: Fixe bug with "expm" function in "state_space_new". Also some minor changes

Test function has been modified also.
This commit is contained in:
Alexander Grigorievskiy 2015-04-08 19:44:19 +03:00
parent 5ff256079b
commit d9cf9c3bff
2 changed files with 29 additions and 22 deletions

View file

@ -7,36 +7,36 @@ import GPy.models.state_space_new as SS_new
#X = np.linspace(0, 10, 2000)[:, None]
#Y = np.sin(X) + np.random.randn(*X.shape)*0.1
## Need to run these lines when X and Y are imported ->
#X.shape = (X.shape[0],1)
#Y.shape = (Y.shape[0],1)
## Need to run these lines when X and Y are imported <-
# Need to run these lines when X and Y are imported ->
X.shape = (X.shape[0],1)
Y.shape = (Y.shape[0],1)
# Need to run these lines when X and Y are imported <-
# Generation of minimal example data ->
X = np.random.rand(3)
sort_index = np.argsort(X)
X = X[sort_index]; X.shape = (X.shape[0],1)
Y = np.sin(10*X) + np.random.randn(*X.shape)*0.1
# Generation of minimal example data <-
## Generation of minimal example data ->
#X = np.random.rand(3)
#sort_index = np.argsort(X)
#X = X[sort_index]; X.shape = (X.shape[0],1)
#Y = np.sin(10*X) + np.random.randn(*X.shape)*0.1
## Generation of minimal example data <-
#plt.figure()
#plt.plot( X, Y)
#plt.show()
kernel = GPy.kern.Matern32(X.shape[1])
m = GPy.models.StateSpace(X,Y, kernel)
print m
#kernel = GPy.kern.Matern32(X.shape[1])
#m = GPy.models.StateSpace(X,Y, kernel)
#
m.optimize()
#
print m
#print m
##
#m.optimize(optimizer='bfgs',messages=True)
##
#print m
kernel1 = GPy.kern.Matern32(X.shape[1])
m1 = GPy.models.GPRegression(X,Y, kernel1)
print m1
m1.optimize()
m1.optimize(optimizer='bfgs',messages=True)
print m1
@ -45,7 +45,7 @@ m2 = SS_new.StateSpace(X,Y, kernel2)
print m2
m2.optimize()
m2.optimize(optimizer='bfgs',messages=True)
print m2