-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50e26c7
commit 240bb32
Showing
1 changed file
with
8 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_gp_likelihood""" | ||
|
||
|
@@ -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__ | ||
|
||
|
@@ -85,7 +82,7 @@ def test_neg_log_ml(): | |
) | ||
print(neg_log_ml_) | ||
truth_log_ml_ = 21.916650988532854 | ||
assert np.abs(neg_log_ml_ - truth_log_ml_) < TEST_EPSILON | ||
np.testing.assert_allclose(neg_log_ml_, truth_log_ml_) | ||
|
||
neg_log_ml_ = package_target.neg_log_ml( | ||
X, | ||
|
@@ -99,7 +96,7 @@ def test_neg_log_ml(): | |
) | ||
print(neg_log_ml_) | ||
truth_log_ml_ = 21.91665090519953 | ||
assert np.abs(neg_log_ml_ - truth_log_ml_) < TEST_EPSILON | ||
np.testing.assert_allclose(neg_log_ml_, truth_log_ml_) | ||
|
||
neg_log_ml_ = package_target.neg_log_ml( | ||
X, | ||
|
@@ -113,7 +110,7 @@ def test_neg_log_ml(): | |
) | ||
print(neg_log_ml_) | ||
truth_log_ml_ = 21.91665090519953 | ||
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, | ||
|
@@ -141,8 +138,8 @@ def test_neg_log_ml(): | |
-0.00029606081917620415, | ||
] | ||
) | ||
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_) | ||
|
||
|
||
def test_neg_log_pseudo_l_loocv_typing(): | ||
|
@@ -211,4 +208,4 @@ def test_neg_log_pseudo_l_loocv(): | |
) | ||
print(neg_log_pseudo_l_) | ||
truth_log_pseudo_l_ = 21.916822991658695 | ||
assert np.abs(neg_log_pseudo_l_ - truth_log_pseudo_l_) < TEST_EPSILON | ||
np.testing.assert_allclose(neg_log_pseudo_l_, truth_log_pseudo_l_) |