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 7af90a3 commit 09f13d9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion tests/common/test_bo_bo_w_gp.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def test_optimize_str_optimize_method_bo():
Y = np.random.randn(num_X, 1)

model_bo = BO(arr_range_1, str_optimizer_method_bo="L-BFGS-B")
next_point, dict_info = model_bo.optimize(X, Y)
next_point, dict_info = model_bo.optimize(X, Y, seed=42)
next_points = dict_info["next_points"]
acquisitions = dict_info["acquisitions"]
cov_X_X = dict_info["cov_X_X"]
Expand All @@ -607,6 +607,12 @@ def test_optimize_str_optimize_method_bo():
assert next_points.shape[1] == dim_X
assert next_points.shape[0] == acquisitions.shape[0]

print(next_point)
for elem in next_point:
print(elem)
truth_next_point = np.array([7.635218604824165, -2.0, 4.021317101319325])
np.testing.assert_allclose(next_point, truth_next_point)

model_bo = BO(arr_range_1, str_optimizer_method_bo="DIRECT")
next_point, dict_info = model_bo.optimize(X, Y)
next_points = dict_info["next_points"]
Expand Down Expand Up @@ -634,6 +640,10 @@ def test_optimize_str_optimize_method_bo():
assert next_points.shape[1] == dim_X
assert next_points.shape[0] == acquisitions.shape[0]

print(next_point)
for elem in next_point:
print(elem)

model_bo = BO(arr_range_1, str_optimizer_method_bo="CMA-ES")
next_point, dict_info = model_bo.optimize(X, Y)
next_points = dict_info["next_points"]
Expand Down Expand Up @@ -661,6 +671,10 @@ def test_optimize_str_optimize_method_bo():
assert next_points.shape[1] == dim_X
assert next_points.shape[0] == acquisitions.shape[0]

print(next_point)
for elem in next_point:
print(elem)


def test_optimize_str_mlm_method():
np.random.seed(42)
Expand Down
16 changes: 15 additions & 1 deletion tests/common/test_bo_bo_w_tp.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def test_optimize_str_optimize_method_bo():
Y = np.random.randn(num_X, 1)

model_bo = BO(arr_range_1, str_optimizer_method_bo="L-BFGS-B")
next_point, dict_info = model_bo.optimize(X, Y)
next_point, dict_info = model_bo.optimize(X, Y, seed=42)
next_points = dict_info["next_points"]
acquisitions = dict_info["acquisitions"]
cov_X_X = dict_info["cov_X_X"]
Expand All @@ -596,6 +596,12 @@ def test_optimize_str_optimize_method_bo():
assert next_points.shape[1] == dim_X
assert next_points.shape[0] == acquisitions.shape[0]

print(next_point)
for elem in next_point:
print(elem)
truth_next_point = np.array([7.638093905542978, -2.0, 3.9619470988529613])
np.testing.assert_allclose(next_point, truth_next_point)

model_bo = BO(arr_range_1, str_optimizer_method_bo="DIRECT")
next_point, dict_info = model_bo.optimize(X, Y)
next_points = dict_info["next_points"]
Expand Down Expand Up @@ -623,6 +629,10 @@ def test_optimize_str_optimize_method_bo():
assert next_points.shape[1] == dim_X
assert next_points.shape[0] == acquisitions.shape[0]

print(next_point)
for elem in next_point:
print(elem)

model_bo = BO(arr_range_1, str_optimizer_method_bo="CMA-ES")
next_point, dict_info = model_bo.optimize(X, Y)
next_points = dict_info["next_points"]
Expand Down Expand Up @@ -650,6 +660,10 @@ def test_optimize_str_optimize_method_bo():
assert next_points.shape[1] == dim_X
assert next_points.shape[0] == acquisitions.shape[0]

print(next_point)
for elem in next_point:
print(elem)


def test_optimize_use_ard():
np.random.seed(42)
Expand Down

0 comments on commit 09f13d9

Please sign in to comment.