Skip to content

Commit

Permalink
GPR: Unit tests (noise case).
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitcek committed Apr 7, 2022
1 parent 94acf02 commit 2b395a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/unit_tests/surrogates/test_gpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@
bounds=[[0.1, 5], [0.1, 3]])
gpr3.fit(samples=samples, values=values+1.05)

gpr4 = GaussianProcessRegression(regression_model=constant_reg, kernel=RBF(), hyperparameters=[2.852, 2.959, 0.001],
random_state=1, optimizer=optimizer3, bounds=[[0.1, 5], [0.1, 3], [1e-6, 1e-1]],
noise=True)
gpr4 = GaussianProcessRegression(kernel=RBF(), hyperparameters=[2.852, 2.959, 0.001], random_state=1,
optimizer=optimizer3, bounds=[[0.1, 5], [0.1, 3], [1e-6, 1e-1]], noise=True)
gpr4.fit(samples=samples, values=values)


Expand All @@ -76,9 +75,10 @@ def test_predict3():
assert (expected_prediction == prediction).all()


def test_hyperparameters():
tmp = np.round(gpr4.hyperparameters, 3)
assert (tmp == np.array([2.524, 1.522, 0.])).all()
def test_predict4():
prediction = np.round(gpr4.predict([[1], [2 * np.pi], [np.pi]], True), 3)
expected_prediction = np.array([[0.54, 0.983, -1.], [0., 0.04, 0.]])
assert np.isclose(prediction, expected_prediction, atol=0.05).all()


def test_rbf():
Expand Down

0 comments on commit 2b395a0

Please sign in to comment.