made initial lengthscale!=1 to ensure we're properly testing gradients

This commit is contained in:
Michael T Smith 2016-08-04 10:11:30 +01:00
parent 97f5ca6b84
commit ad2779bdf3

View file

@ -421,6 +421,7 @@ class MiscTests(unittest.TestCase):
Y = np.vstack([Y,Y]) Y = np.vstack([Y,Y])
m = GPy.models.GPOffsetRegression(X,Y) m = GPy.models.GPOffsetRegression(X,Y)
m.rbf.lengthscale=5.0 #make it something other than one to check our gradients properly!
assert m.checkgrad(), "Gradients of offset parameters don't match numerical approximations." assert m.checkgrad(), "Gradients of offset parameters don't match numerical approximations."
m.optimize() m.optimize()
assert np.abs(m.offset[0]-offset)<0.1, ("GPOffsetRegression model failing to estimate correct offset (value estimated = %0.2f instead of %0.2f)" % (m.offset[0], offset)) assert np.abs(m.offset[0]-offset)<0.1, ("GPOffsetRegression model failing to estimate correct offset (value estimated = %0.2f instead of %0.2f)" % (m.offset[0], offset))