Skip to content

Commit

Permalink
For fANOVA, remove constant hyperparameters from configspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah Krebs committed Jan 9, 2024
1 parent 8ea1554 commit dee8aaa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deepcave/plugins/hyperparameter/importances.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = []
Expand Down

0 comments on commit dee8aaa

Please sign in to comment.