Skip to content

Commit 8794f8a

Browse files
authored
fix: Fix HPO Grid Search comparison and name (#3927)
1 parent 1f38b07 commit 8794f8a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/sagemaker/tuner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
HYPERBAND_STRATEGY_CONFIG = "HyperbandStrategyConfig"
7272
HYPERBAND_MIN_RESOURCE = "MinResource"
7373
HYPERBAND_MAX_RESOURCE = "MaxResource"
74-
GRID_SEARCH = "GridSearch"
74+
GRID_SEARCH = "Grid"
7575
MAX_NUMBER_OF_TRAINING_JOBS_NOT_IMPROVING = "MaxNumberOfTrainingJobsNotImproving"
7676
BEST_OBJECTIVE_NOT_IMPROVING = "BestObjectiveNotImproving"
7777
CONVERGENCE_DETECTED = "ConvergenceDetected"
@@ -645,7 +645,7 @@ def __init__(
645645
evaluating training jobs. This value can be either 'Minimize' or
646646
'Maximize' (default: 'Maximize').
647647
max_jobs (int or PipelineVariable): Maximum total number of training jobs to start for
648-
the hyperparameter tuning job. The default value is unspecified fot the GridSearch
648+
the hyperparameter tuning job. The default value is unspecified fot the 'Grid'
649649
strategy and the default value is 1 for all others strategies (default: None).
650650
max_parallel_jobs (int or PipelineVariable): Maximum number of parallel training jobs to
651651
start (default: 1).
@@ -741,7 +741,7 @@ def __init__(
741741
# For all other strategies for the backward compatibility we keep
742742
# the default value as 1 (previous default value).
743743
self.max_jobs = max_jobs
744-
if max_jobs is None and strategy is not GRID_SEARCH:
744+
if max_jobs is None and strategy != GRID_SEARCH:
745745
self.max_jobs = 1
746746
self.max_parallel_jobs = max_parallel_jobs
747747
self.max_runtime_in_seconds = max_runtime_in_seconds
@@ -1917,7 +1917,7 @@ def create(
19171917
objective_type (str): The type of the objective metric for evaluating training jobs.
19181918
This value can be either 'Minimize' or 'Maximize' (default: 'Maximize').
19191919
max_jobs (int): Maximum total number of training jobs to start for the hyperparameter
1920-
tuning job. The default value is unspecified fot the GridSearch strategy
1920+
tuning job. The default value is unspecified fot the 'Grid' strategy
19211921
and the value is 1 for all others strategies (default: None).
19221922
max_parallel_jobs (int): Maximum number of parallel training jobs to start
19231923
(default: 1).

tests/unit/test_tuner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,7 @@ def test_create_tuner_with_grid_search_strategy():
21712171
objective_metric_name_dict={ESTIMATOR_NAME: OBJECTIVE_METRIC_NAME},
21722172
hyperparameter_ranges_dict={ESTIMATOR_NAME: HYPERPARAMETER_RANGES},
21732173
metric_definitions_dict={ESTIMATOR_NAME: METRIC_DEFINITIONS},
2174-
strategy="GridSearch",
2174+
strategy="Grid",
21752175
objective_type="Minimize",
21762176
max_parallel_jobs=1,
21772177
tags=TAGS,

0 commit comments

Comments
 (0)