From dee8aaa28b7aa3d98ebe1bd11e1d9945fc9be6db Mon Sep 17 00:00:00 2001 From: Sarah Krebs Date: Tue, 9 Jan 2024 09:02:43 +0100 Subject: [PATCH] For fANOVA, remove constant hyperparameters from configspace --- deepcave/plugins/hyperparameter/importances.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deepcave/plugins/hyperparameter/importances.py b/deepcave/plugins/hyperparameter/importances.py index 876ef4b6..f47860a5 100644 --- a/deepcave/plugins/hyperparameter/importances.py +++ b/deepcave/plugins/hyperparameter/importances.py @@ -182,7 +182,7 @@ def process(run, inputs): # Handle constant values in fANOVA: As the fANOVA implementation relies on pyrfr and pyrfr cannot be applied # to constant hyperparameters (see https://github.com/automl/fanova/issues/81), as a workaround we remove # constant hyperparameters before calculation. - # Note: This will break if there are conditions including constant hyperparameters. + # Note: This will break if there are conditions or forbiddens including constant hyperparameters. hp_dict = run.configspace.get_hyperparameters_dict() if method == "global" and any([type(v) == Constant for v in hp_dict.values()]): hp_dict_wo_const = { @@ -191,6 +191,7 @@ def process(run, inputs): for k in hp_dict_wo_const.keys(): configspace_wo_const.add_hyperparameter(hp_dict_wo_const[k]) configspace_wo_const.add_conditions(run.configspace.get_conditions()) + configspace_wo_const.add_forbidden_clauses(run.configspace.get_forbiddens()) run.configspace = configspace_wo_const configs_wo_const = []