From 624d65493c75618262d0b7991e4ed766872a3028 Mon Sep 17 00:00:00 2001 From: Alan Saul Date: Tue, 18 Aug 2015 17:41:25 +0100 Subject: [PATCH] Fixed laplace seed, added debugging for misc tests --- GPy/inference/latent_function_inference/laplace.py | 2 ++ GPy/testing/likelihood_tests.py | 6 +++--- GPy/testing/misc_tests.py | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/GPy/inference/latent_function_inference/laplace.py b/GPy/inference/latent_function_inference/laplace.py index 902d5fff..00a2c2b0 100644 --- a/GPy/inference/latent_function_inference/laplace.py +++ b/GPy/inference/latent_function_inference/laplace.py @@ -171,7 +171,9 @@ class Laplace(LatentFunctionInference): #define the objective function (to be maximised) def obj(Ki_f, f): ll = -0.5*np.sum(np.dot(Ki_f.T, f)) + np.sum(likelihood.logpdf(f, Y, Y_metadata=Y_metadata)) + print ll if np.isnan(ll): + import ipdb; ipdb.set_trace() # XXX BREAKPOINT return -np.inf else: return ll diff --git a/GPy/testing/likelihood_tests.py b/GPy/testing/likelihood_tests.py index f21c7fa1..323e3ff1 100644 --- a/GPy/testing/likelihood_tests.py +++ b/GPy/testing/likelihood_tests.py @@ -9,8 +9,7 @@ import inspect from GPy.likelihoods import link_functions from GPy.core.parameterization import Param from functools import partial -#np.random.seed(300) -#np.random.seed(4) +fixed_seed = 0 #np.seterr(divide='raise') def dparam_partial(inst_func, *args): @@ -105,7 +104,7 @@ class TestNoiseModels(object): Generic model checker """ def setUp(self): - np.random.seed(0) + np.random.seed(fixed_seed) self.N = 15 self.D = 3 self.X = np.random.rand(self.N, self.D)*10 @@ -704,6 +703,7 @@ class LaplaceTests(unittest.TestCase): """ def setUp(self): + np.random.seed(fixed_seed) self.N = 15 self.D = 1 self.X = np.random.rand(self.N, self.D)*10 diff --git a/GPy/testing/misc_tests.py b/GPy/testing/misc_tests.py index cbb74ca2..e00c793a 100644 --- a/GPy/testing/misc_tests.py +++ b/GPy/testing/misc_tests.py @@ -17,6 +17,8 @@ class MiscTests(np.testing.TestCase): assert np.isinf(np.exp(self._lim_val_exp + 1)) assert np.isfinite(GPy.util.misc.safe_exp(self._lim_val_exp + 1)) + print w + print len(w) assert len(w)==1 # should have one overflow warning def test_safe_exp_lower(self):