EXT: State-Space modelling functionality is untied with the GPy models.

Currently, these new functionality is added on the side, not intervening
    the old state-space functionality. Example file has been changed and minimal
    example where descripancies appear is cunstructed.
This commit is contained in:
Alexander Grigorievskiy 2015-04-07 18:20:11 +03:00
parent 03d4096fe8
commit 5ff256079b
3 changed files with 1968 additions and 4 deletions

View file

@ -2,19 +2,50 @@ import GPy
import numpy as np
import matplotlib.pyplot as plt
X = np.linspace(0, 10, 2000)[:, None]
Y = np.sin(X) + np.random.randn(*X.shape)*0.1
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 <-
# 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
#
m.optimize()
#
print m
kernel1 = GPy.kern.Matern32(X.shape[1])
m1 = GPy.models.GPRegression(X,Y, kernel1)
print m1
m1.optimize()
print m1
print m1
kernel2 = GPy.kern.Matern32(X.shape[1])
m2 = SS_new.StateSpace(X,Y, kernel2)
print m2
m2.optimize()
print m2