likelihood test

This commit is contained in:
Max Zwiessele 2014-03-10 08:17:19 +00:00
parent 4ce2eb2ac6
commit a9a285c790

View file

@ -651,7 +651,7 @@ class LaplaceTests(unittest.TestCase):
m2['.*white'].constrain_fixed(1e-6) m2['.*white'].constrain_fixed(1e-6)
m2['.*rbf.variance'].constrain_bounded(1e-4, 10) m2['.*rbf.variance'].constrain_bounded(1e-4, 10)
m2.randomize() m2.randomize()
if debug: if debug:
print m1 print m1
print m2 print m2
@ -663,9 +663,8 @@ class LaplaceTests(unittest.TestCase):
if debug: if debug:
print m1 print m1
print m2 print m2
m2.parameters_changed() m2[:] = m1[:]
#m2._set_params(m1._get_params())
#Predict for training points to get posterior mean and variance #Predict for training points to get posterior mean and variance
post_mean, post_var, _, _ = m1.predict(X) post_mean, post_var, _, _ = m1.predict(X)
@ -701,8 +700,9 @@ class LaplaceTests(unittest.TestCase):
np.testing.assert_almost_equal(m1.log_likelihood(), m2.log_likelihood(), decimal=2) np.testing.assert_almost_equal(m1.log_likelihood(), m2.log_likelihood(), decimal=2)
#Check marginals are the same with random #Check marginals are the same with random
m1.randomize() m1.randomize()
#m2._set_params(m1._get_params()) import ipdb;ipdb.set_trace()
m2.parameters_changed() m2[:] = m1[:]
np.testing.assert_almost_equal(m1.log_likelihood(), m2.log_likelihood(), decimal=2) np.testing.assert_almost_equal(m1.log_likelihood(), m2.log_likelihood(), decimal=2)
#Check they are checkgradding #Check they are checkgradding