added GPy.tests(), removed some useless tests

This commit is contained in:
Nicolo Fusi 2013-03-11 12:33:03 +00:00
parent 2b7f0999bc
commit e32afa11e5
5 changed files with 11 additions and 17 deletions

View file

@ -12,6 +12,7 @@ class BGPLVMTests(unittest.TestCase):
k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001)
K = k.K(X)
Y = np.random.multivariate_normal(np.zeros(N),K,D).T
Y -= Y.mean(axis=0)
k = GPy.kern.bias(Q) + GPy.kern.white(Q, 0.00001)
m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M)
m.constrain_positive('(rbf|bias|noise|white|S)')
@ -24,6 +25,7 @@ class BGPLVMTests(unittest.TestCase):
k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001)
K = k.K(X)
Y = np.random.multivariate_normal(np.zeros(N),K,D).T
Y -= Y.mean(axis=0)
k = GPy.kern.linear(Q) + GPy.kern.white(Q, 0.00001)
m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M)
m.constrain_positive('(linear|bias|noise|white|S)')
@ -36,13 +38,14 @@ class BGPLVMTests(unittest.TestCase):
k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001)
K = k.K(X)
Y = np.random.multivariate_normal(np.zeros(N),K,D).T
Y -= Y.mean(axis=0)
k = GPy.kern.rbf(Q) + GPy.kern.white(Q, 0.00001)
m = GPy.models.Bayesian_GPLVM(Y, Q, kernel = k, M=M)
m.constrain_positive('(rbf|bias|noise|white|S)')
m.randomize()
self.assertTrue(m.checkgrad())
if __name__ == "__main__":
print "Running unit tests, please be (very) patient..."
unittest.main()

View file

@ -13,7 +13,6 @@ class KernelTests(unittest.TestCase):
X = np.random.rand(5,5)
Y = np.ones((5,1))
m = GPy.models.GP_regression(X,Y,K)
print m
self.assertTrue(m.checkgrad())
def test_coregionalisation(self):

View file

@ -177,17 +177,6 @@ class GradientTests(unittest.TestCase):
m.approximate_likelihood()
self.assertTrue(m.checkgrad())
def test_warped_GP(self):
xmin, xmax = 1, 2.5*np.pi
b, C, SNR = 1, 0, 0.1
X = np.linspace(xmin, xmax, 500)
y = b*X + C + 1*np.sin(X)
y += 0.05*np.random.randn(len(X))
X, y = X[:, None], y[:, None]
m = GPy.models.warpedGP(X, y, warping_terms = 3)
m.constrain_positive('(tanh_a|tanh_b|rbf|white|bias)')
self.assertTrue(m.checkgrad())
if __name__ == "__main__":
print "Running unit tests, please be (very) patient..."