Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change tell method for BO Suggestion #1055

Merged
merged 1 commit into from
Feb 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions pkg/suggestion/v1alpha3/skopt/base_skopt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,30 @@ def getSuggestions(self, search_space, trials, request_number):
acq_optimizer=self.acq_optimizer,
random_state=self.random_state)

skopt_suggested = []
loss_for_skopt = []
for trial in trials:
skopt_suggested = []
trial_assignment = []
for param in search_space.params:
parameter_value = None
for assignment in trial.assignments:
if assignment.name == param.name:
parameter_value = assignment.value
break
if param.type == INTEGER:
skopt_suggested.append(int(parameter_value))
trial_assignment.append(int(parameter_value))
elif param.type == DOUBLE:
skopt_suggested.append(float(parameter_value))
trial_assignment.append(float(parameter_value))
else:
skopt_suggested.append(parameter_value)
trial_assignment.append(parameter_value)
skopt_suggested.append(trial_assignment)

loss_for_skopt = float(trial.target_metric.value)
loss_value = float(trial.target_metric.value)
if search_space.goal == MAX_GOAL:
loss_for_skopt = -1 * loss_for_skopt
loss_value = -1 * loss_value
loss_for_skopt.append(loss_value)

if loss_for_skopt != [] and skopt_suggested != []:
skopt_optimizer.tell(skopt_suggested, loss_for_skopt)

return_trial_list = []
Expand Down