def test_all(self):
with self.test_context():
likelihoods = np.array([
-m._objective(m.get_free_state())[0].squeeze()
for m in self.models])
self.assertTrue(np.allclose(likelihoods, likelihoods[0], 1e-6))
variances, lengthscales = [], []
After Change
with self.test_context():
likelihoods = []
for m in self.models:
m.compile()
opt = gpflow.train.ScipyOptimizer()
opt.minimize(m, maxiter=300)
neg_obj = tf.negative(m.objective)
likelihoods.append(m.session.run(neg_obj).squeeze())