Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jungtaekkim committed Nov 18, 2024
1 parent 240bb32 commit eb1a2a0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/common/test_tp_likelihood.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: March 22, 2021
# author: Jungtaek Kim ([email protected])
# last updated: November 18, 2024
#
"""test_tp_likelihood"""

Expand All @@ -13,9 +13,6 @@
from bayeso.utils import utils_covariance


TEST_EPSILON = 1e-7


def test_neg_log_ml_typing():
annos = package_target.neg_log_ml.__annotations__

Expand Down Expand Up @@ -78,7 +75,7 @@ def test_neg_log_ml():
)
print(neg_log_ml_)
truth_log_ml_ = 5.634155417555853
assert np.abs(neg_log_ml_ - truth_log_ml_) < TEST_EPSILON
np.testing.assert_allclose(neg_log_ml_, truth_log_ml_)

neg_log_ml_, neg_grad_log_ml_ = package_target.neg_log_ml(
X, Y, arr_hyps, str_cov, prior_mu_X, fix_noise=fix_noise, use_gradient=True
Expand All @@ -100,8 +97,8 @@ def test_neg_log_ml():
-1.836237221888097e-05,
]
)
assert np.abs(neg_log_ml_ - truth_log_ml_) < TEST_EPSILON
assert np.all(np.abs(neg_grad_log_ml_ - truth_grad_log_ml_) < TEST_EPSILON)
np.testing.assert_allclose(neg_log_ml_, truth_log_ml_)
np.testing.assert_allclose(neg_grad_log_ml_, truth_grad_log_ml_)

dict_hyps = utils_covariance.get_hyps(str_cov, dim_X, use_gp=use_gp)
arr_hyps = utils_covariance.convert_hyps(
Expand Down

0 comments on commit eb1a2a0

Please sign in to comment.