From 77779340652ad7f4696a4c648ad44be330b2231e Mon Sep 17 00:00:00 2001 From: Sarah Krebs Date: Mon, 15 Jan 2024 15:30:41 +0100 Subject: [PATCH] Fix varying configspace index order in PDP and symbolic explanations --- CHANGELOG.md | 1 + deepcave/plugins/hyperparameter/pdp.py | 4 ++++ deepcave/plugins/hyperparameter/symbolic_explanations.py | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31b6ba26..4d249b31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ## Bug-Fixes - Don't convert BOHB runs with status 'running' (consistent with SMAC). +- Fix varying configspace index order in PDP and symbolic explanations. # Version 1.1.3 diff --git a/deepcave/plugins/hyperparameter/pdp.py b/deepcave/plugins/hyperparameter/pdp.py index 104ed619..4157eda9 100644 --- a/deepcave/plugins/hyperparameter/pdp.py +++ b/deepcave/plugins/hyperparameter/pdp.py @@ -190,6 +190,10 @@ def process(run, inputs): surrogate_model = RandomForestSurrogate(run.configspace, seed=0) surrogate_model.fit(X, Y) + # This is necessary as the run configspace can differ from the surrogate, which would be problematic as the + # surrogate configspace is used in the PDP and the run configspace for plotting in load_outputs() + surrogate_model.config_space = run.configspace + # Prepare the hyperparameters selected_hyperparameters = [hp1] if hp2 is not None and hp2 != "": diff --git a/deepcave/plugins/hyperparameter/symbolic_explanations.py b/deepcave/plugins/hyperparameter/symbolic_explanations.py index 07353b5b..c8957c5c 100644 --- a/deepcave/plugins/hyperparameter/symbolic_explanations.py +++ b/deepcave/plugins/hyperparameter/symbolic_explanations.py @@ -267,6 +267,10 @@ def process(run, inputs): surrogate_model = RandomForestSurrogate(run.configspace, seed=0) surrogate_model.fit(X, Y) + # This is necessary as the run configspace can differ from the surrogate, which would be problematic as the + # surrogate configspace is used in the PDP and the run configspace for plotting in load_outputs() + surrogate_model.config_space = run.configspace + # Prepare the hyperparameters selected_hyperparameters = [hp1] idx1 = run.configspace.get_idx_by_hyperparameter_name(hp1)