mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-08 03:22:38 +02:00
Added safe_exp and tests
This commit is contained in:
parent
4d27fddd37
commit
1a253ff82a
2 changed files with 19 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ import numpy as np
|
||||||
from scipy import stats,special
|
from scipy import stats,special
|
||||||
import scipy as sp
|
import scipy as sp
|
||||||
import link_functions
|
import link_functions
|
||||||
from ..util.misc import chain_1, chain_2, chain_3, blockify_dhess_dtheta, blockify_third, blockify_hessian
|
from ..util.misc import chain_1, chain_2, chain_3, blockify_dhess_dtheta, blockify_third, blockify_hessian, safe_exp
|
||||||
from scipy.integrate import quad
|
from scipy.integrate import quad
|
||||||
import warnings
|
import warnings
|
||||||
from ..core.parameterization import Parameterized
|
from ..core.parameterization import Parameterized
|
||||||
|
|
|
||||||
18
GPy/testing/misc_tests.py
Normal file
18
GPy/testing/misc_tests.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import numpy as np
|
||||||
|
import scipy as sp
|
||||||
|
import GPy
|
||||||
|
|
||||||
|
class MiscTests(np.testing.TestCase):
|
||||||
|
"""
|
||||||
|
Testing some utilities of misc
|
||||||
|
"""
|
||||||
|
def setUp(self):
|
||||||
|
self._lim_val = np.finfo(np.float64).max
|
||||||
|
self._lim_val_exp = np.log(self._lim_val)
|
||||||
|
|
||||||
|
def test_safe_exp_upper(self):
|
||||||
|
assert np.exp(self._lim_val_exp + 1) == np.inf
|
||||||
|
assert GPy.util.misc.safe_exp(self._lim_val_exp + 1) < np.inf
|
||||||
|
|
||||||
|
def test_safe_exp_lower(self):
|
||||||
|
assert GPy.util.misc.safe_exp(1e-10) < np.inf
|
||||||
Loading…
Add table
Add a link
Reference in a new issue