From d3321251ef0fcaf1d995dea69ed7374cd77db9a0 Mon Sep 17 00:00:00 2001 From: Mike Croucher Date: Mon, 7 Sep 2015 16:34:53 +0100 Subject: [PATCH] Switched to scipy.special.log1p@ --- GPy/likelihoods/link_functions.py | 2 +- GPy/testing/link_function_tests.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GPy/likelihoods/link_functions.py b/GPy/likelihoods/link_functions.py index 30ad32ad..4947fdb8 100644 --- a/GPy/likelihoods/link_functions.py +++ b/GPy/likelihoods/link_functions.py @@ -141,7 +141,7 @@ class Log_ex_1(GPTransformation): """ def transf(self,f): - return scipy.log1p(safe_exp(f)) + return scipy.special.log1p(safe_exp(f)) def dtransf_df(self,f): ef = safe_exp(f) diff --git a/GPy/testing/link_function_tests.py b/GPy/testing/link_function_tests.py index a4b631f8..2f8fc5a8 100644 --- a/GPy/testing/link_function_tests.py +++ b/GPy/testing/link_function_tests.py @@ -1,5 +1,5 @@ import numpy as np -import scipy as sp +import scipy from scipy.special import cbrt from GPy.models import GradientChecker _lim_val = np.finfo(np.float64).max @@ -92,8 +92,8 @@ class LinkFunctionTests(np.testing.TestCase): link = Log_ex_1() lim_of_inf = _lim_val_exp - np.testing.assert_almost_equal(np.log1p(np.exp(self.mid_f)), link.transf(self.mid_f)) - assert np.isinf(np.log1p(np.exp(np.log(self.f_upper_lim)))) + np.testing.assert_almost_equal(scipy.special.log1p(np.exp(self.mid_f)), link.transf(self.mid_f)) + assert np.isinf(scipy.special.log1p(np.exp(np.log(self.f_upper_lim)))) #Check the clipping works np.testing.assert_almost_equal(link.transf(self.f_lower_lim), 0, decimal=5) #Need to look at most significant figures here rather than the decimals