Skip to content
Snippets Groups Projects
Commit 39498bba authored by Hu Zhao's avatar Hu Zhao
Browse files

test: update test for active learning

parent fa135844
No related branches found
No related tags found
No related merge requests found
...@@ -32,11 +32,9 @@ def test_ActiveLearning_init_TypeError(run_sim_obj, prior, likelihood, ...@@ -32,11 +32,9 @@ def test_ActiveLearning_init_TypeError(run_sim_obj, prior, likelihood,
ndim = 1 ndim = 1
bounds = np.array([[0,1]]) bounds = np.array([[0,1]])
data = np.array([1,2,3]) data = np.array([1,2,3])
n0 = 20
nt = 100
with pytest.raises(BeartypeCallHintParamViolation): with pytest.raises(BeartypeCallHintParamViolation):
_ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood, _ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood,
n0, nt, lhs_sampler, scalar_gasp, optimizer=optimizer) lhs_sampler, scalar_gasp, optimizer=optimizer)
@pytest.mark.parametrize( @pytest.mark.parametrize(
...@@ -59,11 +57,9 @@ def test_ActiveLearning_init_RuntimeError(run_sim_obj, lhs_sampler, ...@@ -59,11 +57,9 @@ def test_ActiveLearning_init_RuntimeError(run_sim_obj, lhs_sampler,
data = np.array([1,2,3]) data = np.array([1,2,3])
prior = uniform.pdf prior = uniform.pdf
likelihood = norm.pdf likelihood = norm.pdf
n0 = 20
nt = 100
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):
_ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood, _ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood,
n0, nt, lhs_sampler, scalar_gasp) lhs_sampler, scalar_gasp)
@pytest.mark.parametrize( @pytest.mark.parametrize(
...@@ -82,11 +78,9 @@ def test_ActiveLearning_init_NotImplementedError(scalar_gasp_mean, indicator): ...@@ -82,11 +78,9 @@ def test_ActiveLearning_init_NotImplementedError(scalar_gasp_mean, indicator):
scalar_gasp = ScalarGaSP(1) scalar_gasp = ScalarGaSP(1)
prior = uniform.pdf prior = uniform.pdf
likelihood = norm.pdf likelihood = norm.pdf
n0 = 20
nt = 100
with pytest.raises(NotImplementedError): with pytest.raises(NotImplementedError):
_ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood, _ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood,
n0, nt, lhs_sampler, scalar_gasp, scalar_gasp_mean=scalar_gasp_mean, lhs_sampler, scalar_gasp, scalar_gasp_mean=scalar_gasp_mean,
indicator=indicator) indicator=indicator)
def test_ActiveLearning_init_ValueError(): def test_ActiveLearning_init_ValueError():
...@@ -98,9 +92,7 @@ def test_ActiveLearning_init_ValueError(): ...@@ -98,9 +92,7 @@ def test_ActiveLearning_init_ValueError():
scalar_gasp = ScalarGaSP(1) scalar_gasp = ScalarGaSP(1)
prior = uniform.pdf prior = uniform.pdf
likelihood = norm.pdf likelihood = norm.pdf
n0 = 20
nt = 100
kwgs_optimizer = {"NS":50} kwgs_optimizer = {"NS":50}
with pytest.raises(ValueError): with pytest.raises(ValueError):
_ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood, _ = ActiveLearning(ndim, bounds, data, run_sim_obj, prior, likelihood,
n0, nt, lhs_sampler, scalar_gasp, kwgs_optimizer=kwgs_optimizer) lhs_sampler, scalar_gasp, kwgs_optimizer=kwgs_optimizer)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment