From 464d3aac0b64ec6ccf64b166bdca21ddda1c8314 Mon Sep 17 00:00:00 2001 From: jiabeizhao Date: Thu, 30 Jun 2022 18:12:19 +0800 Subject: [PATCH 1/2] Add condition control when passing parameters bounds to scipy.minimize --- nni/algorithms/hpo/gp_tuner/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nni/algorithms/hpo/gp_tuner/util.py b/nni/algorithms/hpo/gp_tuner/util.py index 6926f98899..28d0230e9a 100644 --- a/nni/algorithms/hpo/gp_tuner/util.py +++ b/nni/algorithms/hpo/gp_tuner/util.py @@ -89,7 +89,8 @@ def acq_max(f_acq, gp, y_max, bounds, space, num_warmup, num_starting_points): x_seeds = [space.random_sample() for _ in range(int(num_starting_points))] bounds_minmax = np.array( - [[bound['_value'][0], bound['_value'][-1]] for bound in bounds]) + [[bound['_value'][0], bound['_value'][1 if bound['_type'] == 'quniform' + or bound['_type'] == 'qloguniform' else -1]] for bound in bounds]) for x_try in x_seeds: # Find the minimum of minus the acquisition function From 3b7618e188ae95a87a2e8968d75c12982f28a268 Mon Sep 17 00:00:00 2001 From: jiabeizhao Date: Thu, 30 Jun 2022 18:34:01 +0800 Subject: [PATCH 2/2] remove whitespace --- nni/algorithms/hpo/gp_tuner/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nni/algorithms/hpo/gp_tuner/util.py b/nni/algorithms/hpo/gp_tuner/util.py index 28d0230e9a..4ee6387ff5 100644 --- a/nni/algorithms/hpo/gp_tuner/util.py +++ b/nni/algorithms/hpo/gp_tuner/util.py @@ -89,7 +89,7 @@ def acq_max(f_acq, gp, y_max, bounds, space, num_warmup, num_starting_points): x_seeds = [space.random_sample() for _ in range(int(num_starting_points))] bounds_minmax = np.array( - [[bound['_value'][0], bound['_value'][1 if bound['_type'] == 'quniform' + [[bound['_value'][0], bound['_value'][1 if bound['_type'] == 'quniform' or bound['_type'] == 'qloguniform' else -1]] for bound in bounds]) for x_try in x_seeds: