def test_sgpr(self):
with self.test_context():
m = gpflow.models.SGPR(self.X, self.Y, self.kern, Z=self.X[::2])
m.compile()
m.X = self.rng.randn(*self.X.shape)
self.assertFalse(
m._needs_recompile,
msg="Recompilation should be avoided for the same shape data")
m.X = self.rng.randn(30, 1)
self.assertFalse(
m._needs_recompile,
msg="For SGPR, recompilation should be avoided for the same shape data")
After Change
def test_sgpr(self):
with self.test_context():
X, Y, kern, rng = self.setup()
m = gpflow.models.SGPR(X, Y, kern, Z=X[::2])
m.compile()
m.X = rng.randn(*X.shape)with self.assertRaises(gpflow.GPflowError):
m.X = rng.randn(30, 1)
def test_gpmc(self):
with self.test_context():
X, Y, kern, rng = self.setup()
m = gpflow.models.GPMC(X, Y, kern, likelihood=gpflow.likelihoods.StudentT())