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

bugfix/Reset inputs when changing runs #107

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

## Bug-Fixes
- Don't convert BOHB runs with status 'running' (consistent with SMAC).
- Reset inputs to fix error when subsequently selecting runs with different configspaces, objectives or budgets (#106)

# Version 1.1.3

Expand Down
14 changes: 9 additions & 5 deletions deepcave/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,15 @@ def plugin_input_update(pathname: str, *inputs_list: str) -> List[str]:
# because `run` would be removed.
# Also: We want to keep the current run name.
update_dict(_inputs, self.load_inputs())

# TODO: Reset only inputs which are not available in another run.
# E.g. if options from budget in run_2 and run_3 are the same
# take the budget from run_2 if changed to run_3. Otherwise,
# reset budgets.
# Reset inputs
if "objective_id" in _inputs.keys():
update_dict(_inputs, {"objective_id": {"value": None}})
if "budget_id" in _inputs.keys():
update_dict(_inputs, {"budget_id": {"value": None}})
if "hyperparameter_name_1" in _inputs.keys():
update_dict(_inputs, {"hyperparameter_name_1": {"value": None}})
if "hyperparameter_name_2" in _inputs.keys():
update_dict(_inputs, {"hyperparameter_name_2": {"value": None}})

selected_run = run_handler.get_run(_run_id)

Expand Down
4 changes: 4 additions & 0 deletions deepcave/plugins/hyperparameter/pdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,13 @@ def load_dependency_inputs(self, run, previous_inputs, inputs):
objective_value = inputs["objective_id"]["value"]
budget_value = inputs["budget_id"]["value"]
hp1_value = inputs["hyperparameter_name_1"]["value"]
hp2_value = inputs["hyperparameter_name_2"]["value"]

if objective_value is None:
objective_value = objective_ids[0]
if budget_value is None:
budget_value = budget_ids[-1]
if hp1_value is None:
hp1_value = hp_names[0]

return {
Expand All @@ -160,6 +163,7 @@ def load_dependency_inputs(self, run, previous_inputs, inputs):
},
"hyperparameter_name_2": {
"options": get_checklist_options([None] + hp_names),
"value": hp2_value,
},
}

Expand Down
1 change: 1 addition & 0 deletions deepcave/plugins/objective/configuration_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def load_dependency_inputs(self, run, _, inputs):
# Pre-set values
if objective_value is None:
objective_value = objective_ids[0]
if budget_value is None:
budget_value = budget_ids[-1]
else:
budget_value = inputs["budget_id"]["value"]
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.