diff --git a/ax/modelbridge/generation_strategy.py b/ax/modelbridge/generation_strategy.py index 3c4e3fbef29..cdab4b2fd38 100644 --- a/ax/modelbridge/generation_strategy.py +++ b/ax/modelbridge/generation_strategy.py @@ -90,7 +90,7 @@ class GenerationStrategy(GenerationStrategyInterface): should use nodes. Notably, either, but not both, of `nodes` and `steps` must be provided. steps: A list of `GenerationStep` describing steps of this strategy. - name: An optional name for this generaiton strategy. If not specified, + name: An optional name for this generation strategy. If not specified, strategy's name will be names of its nodes' models joined with '+'. """ @@ -526,9 +526,9 @@ def _validate_and_set_step_sequence(self, steps: List[GenerationStep]) -> None: This function validates: 1. That only the last step has num_trials=-1, which indicates unlimited trial generation is possible. - 2. That each step's num_trials attrivute is either positive or -1 + 2. That each step's num_trials attribute is either positive or -1 3. That each step's max_parallelism attribute is either None or positive - It then sets the corect TransitionCriterion and node_name attributes on the + It then sets the correct TransitionCriterion and node_name attributes on the underlying GenerationNode objects. """ for idx, step in enumerate(steps): @@ -537,8 +537,8 @@ def _validate_and_set_step_sequence(self, steps: List[GenerationStep]) -> None: raise UserInputError( "Only last step in generation strategy can have " "`num_trials` set to -1 to indicate that the model in " - "the step shouldbe used to generate new trials " - "indefinitely unless completion critera present." + "the step should be used to generate new trials " + "indefinitely unless completion criteria present." ) elif step.num_trials < 1 and step.num_trials != -1: raise UserInputError( @@ -684,12 +684,12 @@ def _gen_multiple( """Produce multiple generator runs at once, to be made into multiple trials on the experiment. - NOTE: This is used to ensure that maximum paralellism and number + NOTE: This is used to ensure that maximum parallelism and number of trials per node are not violated when producing many generator runs from this generation strategy in a row. Without this function, if one generates multiple generator runs without first making any of them into running trials, generation strategy cannot enforce that it only - produces as many generator runs as are allowed by the paralellism + produces as many generator runs as are allowed by the parallelism limit and the limit on number of trials in current node. Args: diff --git a/ax/modelbridge/tests/test_transition_criterion.py b/ax/modelbridge/tests/test_transition_criterion.py index b88a0d63f91..25e5e9f3d49 100644 --- a/ax/modelbridge/tests/test_transition_criterion.py +++ b/ax/modelbridge/tests/test_transition_criterion.py @@ -46,7 +46,7 @@ def setUp(self) -> None: self.branin_experiment = get_branin_experiment() def test_minimum_preference_criterion(self) -> None: - """Tests the minimum preference criterion subcalss of TransitionCriterion.""" + """Tests the minimum preference criterion subclass of TransitionCriterion.""" criterion = MinimumPreferenceOccurances(metric_name="m1", threshold=3) experiment = get_experiment() generation_strategy = GenerationStrategy( @@ -192,14 +192,14 @@ def test_min_trials_is_met(self) -> None: for _i in range(4): experiment.new_trial(gs.gen(experiment=experiment)) - # TODO: @mgarrard More comphrensive test of trials_from_node + # TODO: @mgarrard More comprehensive test of trials_from_node node_0_trials = gs._steps[0].trials_from_node node_1_trials = gs._steps[1].trials_from_node self.assertEqual(len(node_0_trials), 4) self.assertEqual(len(node_1_trials), 0) - # MinTrials is met should not pass yet, becasue no trials + # MinTrials is met should not pass yet, because no trials # are marked completed self.assertFalse( gs._steps[0] @@ -450,11 +450,11 @@ def test_repr(self) -> None: + "'use_all_trials_in_exp': False, " + "'complete_trial_generation': True})", ) - minimum_preference_occurances_criterion = MinimumPreferenceOccurances( + minimum_preference_occurrences_criterion = MinimumPreferenceOccurances( metric_name="m1", threshold=3 ) self.assertEqual( - str(minimum_preference_occurances_criterion), + str(minimum_preference_occurrences_criterion), "MinimumPreferenceOccurances({'metric_name': 'm1', 'threshold': 3, " + "'transition_to': None, 'block_gen_if_met': False, " "'block_transition_if_unmet': True})", diff --git a/ax/modelbridge/transition_criterion.py b/ax/modelbridge/transition_criterion.py index eae8c9dbbd8..89c751e56cc 100644 --- a/ax/modelbridge/transition_criterion.py +++ b/ax/modelbridge/transition_criterion.py @@ -167,7 +167,7 @@ class TrialBasedCriterion(TransitionCriterion): generate at most 3 trials, then the threshold is 3. block_transition_if_unmet: A flag to prevent the node from completing and being able to transition to another node. Ex: MaxGenerationParallelism - defaults to setting this to Flase since we can complete and move on from + defaults to setting this to False since we can complete and move on from this node without ever reaching its threshold. block_gen_if_met: A flag to prevent continued generation from the associated GenerationNode if this criterion is met but other criterion @@ -348,7 +348,7 @@ class MaxGenerationParallelism(TrialBasedCriterion): are multiple arms per trial, and we enable generation of arms within a batch from different ```GenerationNodes```. This flag should be set to True for the last node in a set of ```GenerationNodes``` expected to - create a given ```BatchTrial```. Defautls to False for + create a given ```BatchTrial```. Defaults to False for MaxGenerationParallelism since this criterion isn't currently used for node -> node or trial -> trial transition. """