mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
Switched to scipy.special.log1p@
This commit is contained in:
parent
54ea44b9f9
commit
d3321251ef
2 changed files with 4 additions and 4 deletions
|
|
@ -141,7 +141,7 @@ class Log_ex_1(GPTransformation):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def transf(self,f):
|
def transf(self,f):
|
||||||
return scipy.log1p(safe_exp(f))
|
return scipy.special.log1p(safe_exp(f))
|
||||||
|
|
||||||
def dtransf_df(self,f):
|
def dtransf_df(self,f):
|
||||||
ef = safe_exp(f)
|
ef = safe_exp(f)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy as sp
|
import scipy
|
||||||
from scipy.special import cbrt
|
from scipy.special import cbrt
|
||||||
from GPy.models import GradientChecker
|
from GPy.models import GradientChecker
|
||||||
_lim_val = np.finfo(np.float64).max
|
_lim_val = np.finfo(np.float64).max
|
||||||
|
|
@ -92,8 +92,8 @@ class LinkFunctionTests(np.testing.TestCase):
|
||||||
link = Log_ex_1()
|
link = Log_ex_1()
|
||||||
lim_of_inf = _lim_val_exp
|
lim_of_inf = _lim_val_exp
|
||||||
|
|
||||||
np.testing.assert_almost_equal(np.log1p(np.exp(self.mid_f)), link.transf(self.mid_f))
|
np.testing.assert_almost_equal(scipy.special.log1p(np.exp(self.mid_f)), link.transf(self.mid_f))
|
||||||
assert np.isinf(np.log1p(np.exp(np.log(self.f_upper_lim))))
|
assert np.isinf(scipy.special.log1p(np.exp(np.log(self.f_upper_lim))))
|
||||||
#Check the clipping works
|
#Check the clipping works
|
||||||
np.testing.assert_almost_equal(link.transf(self.f_lower_lim), 0, decimal=5)
|
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
|
#Need to look at most significant figures here rather than the decimals
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue