Skip to content

Commit 09dabf7

Browse files
committed
Raise an error for the step parameter
Signed-off-by: tenzen-y <[email protected]>
1 parent 5e9536a commit 09dabf7

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

pkg/suggestion/v1beta1/internal/search_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def convert_to_combinations(search_space):
4949
combinations[parameter.name] = range(int(parameter.min), int(parameter.max)+1, int(parameter.step))
5050
elif parameter.type == DOUBLE:
5151
if parameter.step == "" or parameter.step is None:
52-
return "Param {} step is nil".format(parameter.name)
52+
raise Exception("Param {} step is nil".format(parameter.name))
5353
double_list = np.arange(float(parameter.min), float(parameter.max)+float(parameter.step),
5454
float(parameter.step))
5555
if double_list[-1] > float(parameter.max):

pkg/suggestion/v1beta1/optuna/service.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ def _validate_grid_setting(cls, experiment):
206206

207207
try:
208208
combinations = HyperParameterSearchSpace.convert_to_combinations(search_space)
209-
if isinstance(combinations, str):
210-
return False, combinations
211-
212209
num_combinations = len(list(itertools.product(*combinations.values())))
213210
max_trial_count = experiment.spec.max_trial_count
214211
if max_trial_count > num_combinations:

test/unit/v1beta1/suggestion/test_optuna_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def test_get_suggestion(self, algorithm_name, algorithm_settings):
189189
["algorithm_name", "algorithm_settings", "max_trial_count", "parameters", "result"],
190190
[
191191
# Invalid algorithm name
192-
["invalid", {}, 1, [], grpc.StatusCode.UNKNOWN],
192+
["invalid", {}, 1, [], grpc.StatusCode.INVALID_ARGUMENT],
193193
194194
# [TPE] Valid case
195195
["tpe", {"n_startup_trials": "5", "n_ei_candidates": "24", "random_state": "1"}, 100, [],

0 commit comments

Comments
 (0)