Skip to content

Commit

Permalink
improve numerical stability in moo tests (facebook#679)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#679

This should help with stochastic numerical issues

Reviewed By: Balandat

Differential Revision: D30530479

fbshipit-source-id: 918745994bea60552fcb4896eaa5a7e6d32ea144
  • Loading branch information
sdaulton authored and facebook-github-bot committed Aug 25, 2021
1 parent afb4e4a commit 2c60c85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 9 additions & 1 deletion ax/modelbridge/tests/test_multi_objective_torch_modelbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from ax.utils.testing.core_stubs import (
get_branin_data_multi_objective,
get_branin_experiment_with_multi_objective,
TEST_SOBOL_SEED,
)
from botorch.utils.multi_objective.pareto import is_non_dominated

Expand Down Expand Up @@ -506,7 +507,14 @@ def test_infer_objective_thresholds(self, _, cuda=False):
)
)
# test using MTGP
sobol_generator = get_sobol(search_space=exp.search_space)
sobol_generator = get_sobol(
search_space=exp.search_space,
seed=TEST_SOBOL_SEED,
# set initial position equal to the number of sobol arms generated
# so far. This means that new sobol arms will complement the previous
# arms in a space-filling fashion
init_position=len(exp.arms_by_name) - 1,
)
sobol_run = sobol_generator.gen(n=5)
trial = exp.new_batch_trial(optimize_for_power=True)
trial.add_generator_run(sobol_run)
Expand Down
5 changes: 3 additions & 2 deletions ax/utils/testing/core_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@

logger = get_logger(__name__)

TEST_SOBOL_SEED = 1234

##############################
# Experiments
Expand Down Expand Up @@ -381,8 +382,8 @@ def get_branin_experiment_with_multi_objective(
exp.status_quo = Arm(parameters={"x1": 0.0, "x2": 0.0})

if with_batch:
sobol_generator = get_sobol(search_space=exp.search_space)
sobol_run = sobol_generator.gen(n=15)
sobol_generator = get_sobol(search_space=exp.search_space, seed=TEST_SOBOL_SEED)
sobol_run = sobol_generator.gen(n=5)
exp.new_batch_trial(optimize_for_power=with_status_quo).add_generator_run(
sobol_run
)
Expand Down

0 comments on commit 2c60c85

Please sign in to comment.