From 3e5e3a099e061c02dfe701b8ac5d9170bbca6ba0 Mon Sep 17 00:00:00 2001 From: Max Zwiessele Date: Fri, 14 Mar 2014 11:32:08 +0000 Subject: [PATCH] checkgrad is zero test --- GPy/core/model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GPy/core/model.py b/GPy/core/model.py index 0990e7f1..1f53885c 100644 --- a/GPy/core/model.py +++ b/GPy/core/model.py @@ -301,8 +301,7 @@ class Model(Parameterized): denominator = (2 * np.dot(dx, gradient)) global_ratio = (f1 - f2) / np.where(denominator==0., 1e-32, denominator) - - return np.abs(1. - global_ratio) < tolerance + return np.abs(1. - global_ratio) < tolerance or np.abs(f1-f2).sum() + np.abs((2 * np.dot(dx, gradient))).sum() < tolerance else: # check the gradient of each parameter individually, and do some pretty printing try: