Skip to content

Commit 33e9a5e

Browse files
Lena Kashtelyanmeta-codesync[bot]
authored andcommitted
Add suggested_experiment_status to legacy GS dispatch --> have AxSweep experiment status appear in the UI (#5056)
Summary: Pull Request resolved: #5056 Add `suggested_experiment_status` to the `GenerationStep`s created by `choose_generation_strategy_legacy`. The Sobol step gets `ExperimentStatus.INITIALIZATION` and the BayesOpt step gets `ExperimentStatus.OPTIMIZATION`, matching the convention used by all other GS factory functions. Reviewed By: CristianLara Differential Revision: D96784737 fbshipit-source-id: 50a4205fc41b02556614d976db4e35594f069d7c
1 parent bdd8491 commit 33e9a5e

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

ax/generation_strategy/dispatch_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import torch
1414
from ax.adapter.registry import GeneratorRegistryBase, Generators
1515
from ax.core.experiment import Experiment
16+
from ax.core.experiment_status import ExperimentStatus
1617
from ax.core.optimization_config import OptimizationConfig
1718
from ax.core.parameter import ChoiceParameter, ParameterType, RangeParameter
1819
from ax.core.search_space import SearchSpace
@@ -66,6 +67,7 @@ def _make_sobol_step(
6667
generator_kwargs={"deduplicate": True, "seed": seed},
6768
use_all_trials_in_exp=True,
6869
should_deduplicate=should_deduplicate,
70+
suggested_experiment_status=ExperimentStatus.INITIALIZATION,
6971
)
7072

7173

@@ -133,6 +135,7 @@ def _make_botorch_step(
133135
max_parallelism=max_concurrency,
134136
generator_kwargs=generator_kwargs,
135137
should_deduplicate=should_deduplicate,
138+
suggested_experiment_status=ExperimentStatus.OPTIMIZATION,
136139
)
137140

138141

ax/generation_strategy/tests/test_dispatch_utils.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import torch
1414
from ax.adapter.registry import Generators
1515
from ax.adapter.transforms.log_y import LogY
16+
from ax.core.experiment_status import ExperimentStatus
1617
from ax.core.objective import Objective
1718
from ax.core.optimization_config import MultiObjectiveOptimizationConfig
1819
from ax.generation_strategy.dispatch_utils import (
@@ -1088,3 +1089,32 @@ def test_non_saasbo_discards_irrelevant_generator_kwargs(self) -> None:
10881089
run_branin_experiment_with_generation_strategy(
10891090
generation_strategy=gp_saasbo,
10901091
)
1092+
1093+
def test_suggested_experiment_status(self) -> None:
1094+
with self.subTest(
1095+
"choose_generation_strategy_legacy sets statuses on both nodes"
1096+
):
1097+
gs = choose_generation_strategy_legacy(
1098+
search_space=get_branin_search_space(),
1099+
)
1100+
# Sobol step should be INITIALIZATION
1101+
self.assertEqual(
1102+
gs._nodes[0].suggested_experiment_status,
1103+
ExperimentStatus.INITIALIZATION,
1104+
)
1105+
# BoTorch step should be OPTIMIZATION
1106+
self.assertEqual(
1107+
gs._nodes[1].suggested_experiment_status,
1108+
ExperimentStatus.OPTIMIZATION,
1109+
)
1110+
1111+
with self.subTest("force_random_search sets INITIALIZATION on Sobol-only GS"):
1112+
gs = choose_generation_strategy_legacy(
1113+
search_space=get_branin_search_space(),
1114+
force_random_search=True,
1115+
)
1116+
self.assertEqual(len(gs._nodes), 1)
1117+
self.assertEqual(
1118+
gs._nodes[0].suggested_experiment_status,
1119+
ExperimentStatus.INITIALIZATION,
1120+
)

ax/orchestration/tests/test_orchestrator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,14 @@ class TestAxOrchestrator(TestCase):
164164
"transition_criteria="
165165
"[MinTrials(transition_to='GenerationStep_1_BoTorch'), "
166166
"MinTrials(transition_to='GenerationStep_1_BoTorch')], "
167+
"suggested_experiment_status=ExperimentStatus.INITIALIZATION, "
167168
"pausing_criteria="
168169
"[MaxTrialsAwaitingData(threshold=5)]), "
169170
"GenerationNode(name='GenerationStep_1_BoTorch', "
170171
"generator_specs=[GeneratorSpec(generator_enum=BoTorch, "
171172
"generator_key_override=None)], "
172173
"transition_criteria=None, "
174+
"suggested_experiment_status=ExperimentStatus.OPTIMIZATION, "
173175
"pausing_criteria="
174176
"[MaxGenerationParallelism(threshold=3)])]), "
175177
"options=OrchestratorOptions(max_pending_trials=10, "
@@ -2913,12 +2915,14 @@ class TestAxOrchestratorMultiTypeExperiment(TestAxOrchestrator):
29132915
"transition_criteria="
29142916
"[MinTrials(transition_to='GenerationStep_1_BoTorch'), "
29152917
"MinTrials(transition_to='GenerationStep_1_BoTorch')], "
2918+
"suggested_experiment_status=ExperimentStatus.INITIALIZATION, "
29162919
"pausing_criteria="
29172920
"[MaxTrialsAwaitingData(threshold=5)]), "
29182921
"GenerationNode(name='GenerationStep_1_BoTorch', "
29192922
"generator_specs=[GeneratorSpec(generator_enum=BoTorch, "
29202923
"generator_key_override=None)], "
29212924
"transition_criteria=None, "
2925+
"suggested_experiment_status=ExperimentStatus.OPTIMIZATION, "
29222926
"pausing_criteria="
29232927
"[MaxGenerationParallelism(threshold=3)])]), "
29242928
"options=OrchestratorOptions(max_pending_trials=10, "

0 commit comments

Comments
 (0)