Switched to scipy.special.log1p@

This commit is contained in:
Mike Croucher 2015-09-07 16:34:53 +01:00
parent 54ea44b9f9
commit d3321251ef
2 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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