diff --git a/CHANGELOG.md b/CHANGELOG.md index b3ef73be..625d090f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/deepcave/plugins/__init__.py b/deepcave/plugins/__init__.py index 85026af8..0238cd47 100644 --- a/deepcave/plugins/__init__.py +++ b/deepcave/plugins/__init__.py @@ -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) diff --git a/deepcave/plugins/hyperparameter/pdp.py b/deepcave/plugins/hyperparameter/pdp.py index 4db4d92e..4770e5ab 100644 --- a/deepcave/plugins/hyperparameter/pdp.py +++ b/deepcave/plugins/hyperparameter/pdp.py @@ -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 { @@ -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, }, } diff --git a/deepcave/plugins/objective/configuration_cube.py b/deepcave/plugins/objective/configuration_cube.py index adb13919..f70b6e4e 100644 --- a/deepcave/plugins/objective/configuration_cube.py +++ b/deepcave/plugins/objective/configuration_cube.py @@ -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"]