Skip to content

Commit 6d785c1

Browse files
author
Sarah Krebs
committed
Format
1 parent 1688de9 commit 6d785c1

File tree

4 files changed

+28
-30
lines changed

4 files changed

+28
-30
lines changed

deepcave/evaluators/mo_ablation.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ def predict(self, cfg: list[Any], weighting: np.ndarray) -> Tuple[float, float]:
119119
return mean, var
120120

121121
def calculate(
122-
self,
123-
objectives: Optional[Union[Objective, List[Objective]]], # noqa
124-
budget: Optional[Union[int, float]] = None, # noqa
125-
n_trees: int = 50, # noqa
126-
seed: int = 0, # noqa
122+
self,
123+
objectives: Optional[Union[Objective, List[Objective]]], # noqa
124+
budget: Optional[Union[int, float]] = None, # noqa
125+
n_trees: int = 50, # noqa
126+
seed: int = 0, # noqa
127127
) -> None:
128128
"""
129129
Calculate the MO ablation path performances and improvements.
@@ -157,7 +157,7 @@ def calculate(
157157
for obj in objectives:
158158
normed = obj.name + "_normed"
159159
df[normed] = (df[obj.name] - df[obj.name].min()) / (
160-
df[obj.name].max() - df[obj.name].min()
160+
df[obj.name].max() - df[obj.name].min()
161161
)
162162

163163
if obj.optimize == "upper":
@@ -187,12 +187,12 @@ def calculate(
187187
self.df_importances = self.df_importances.reset_index(drop=True)
188188

189189
def calculate_ablation_path(
190-
self,
191-
df: pd.DataFrame,
192-
objectives_normed: List[str],
193-
weighting: np.ndarray,
194-
budget: Optional[Union[int, float]],
195-
) -> pd.DataFrame:
190+
self,
191+
df: pd.DataFrame,
192+
objectives_normed: List[str],
193+
weighting: np.ndarray,
194+
budget: Optional[Union[int, float]],
195+
) -> pd.DataFrame:
196196
"""
197197
Calculate the ablation path performances.
198198
@@ -286,12 +286,12 @@ def calculate_ablation_path(
286286
return df_abl.reset_index(drop=True)
287287

288288
def ablation(
289-
self,
290-
budget: Optional[Union[int, float]],
291-
incumbent_config: Any,
292-
def_cost: Any,
293-
hp_it: List[str],
294-
weighting: np.ndarray[Any, Any],
289+
self,
290+
budget: Optional[Union[int, float]],
291+
incumbent_config: Any,
292+
def_cost: Any,
293+
hp_it: List[str],
294+
weighting: np.ndarray[Any, Any],
295295
) -> Tuple[Any, Any, Any, Any]:
296296
"""
297297
Calculate the ablation importance for each hyperparameter.

deepcave/evaluators/mo_lpi.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ def __init__(self, run: AbstractRun):
7676
self.importances: Optional[pd.DataFrame] = None
7777

7878
def calculate(
79-
self,
80-
objectives: Optional[Union[Objective, List[Objective]]] = None,
81-
budget: Optional[Union[int, float]] = None,
82-
continous_neighbors: int = 500,
83-
n_trees: int = 10,
84-
seed: int = 0,
79+
self,
80+
objectives: Optional[Union[Objective, List[Objective]]] = None,
81+
budget: Optional[Union[int, float]] = None,
82+
continous_neighbors: int = 500,
83+
n_trees: int = 10,
84+
seed: int = 0,
8585
) -> None:
8686
"""
8787
Prepare the data and train a RandomForest model.
@@ -129,7 +129,7 @@ def calculate(
129129
for obj in objectives:
130130
normed = obj.name + "_normed"
131131
df[normed] = (df[obj.name] - df[obj.name].min()) / (
132-
df[obj.name].max() - df[obj.name].min()
132+
df[obj.name].max() - df[obj.name].min()
133133
)
134134
if obj.optimize == "upper":
135135
df[normed] = 1 - df[normed]

deepcave/plugins/hyperparameter/ablation_paths.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ def load_inputs(self) -> Dict[str, Dict[str, Any]]:
212212
"show_confidence": {"options": get_select_options(binary=True), "value": "false"},
213213
}
214214

215-
def load_dependency_inputs(self, run, _: Any, inputs: Dict[str, Any]) -> Dict[
216-
str, Any]: # type: ignore # noqa: E501
215+
def load_dependency_inputs(self, run, _, inputs) -> Dict[str, Any]: # type: ignore # noqa: E501
217216
"""
218217
Works like 'load_inputs' but called after inputs have changed.
219218
@@ -477,7 +476,7 @@ def load_outputs(run, inputs, outputs) -> List[go.Figure]: # type: ignore
477476
barmode="group",
478477
title={
479478
"text": "Ablation Path when Iteratively Setting the Hyperparameters to Their "
480-
"Incumbent Value",
479+
"Incumbent Value",
481480
"font": {"size": config.FIGURE_FONT_SIZE + 2},
482481
},
483482
yaxis_title=objective.name,

deepcave/plugins/hyperparameter/importances.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ def load_inputs(self) -> Dict[str, Dict[str, Any]]:
224224
"budget_ids": {"options": get_checklist_options(), "value": []},
225225
}
226226

227-
def load_dependency_inputs(self, run, _: Any, inputs: Dict[str, Any]) -> Dict[
228-
str, Any]: # type: ignore # noqa: E501
227+
def load_dependency_inputs(self, run, _, inputs) -> Dict[str, Any]: # type: ignore # noqa: E501
229228
"""
230229
Works like 'load_inputs' but called after inputs have changed.
231230

0 commit comments

Comments
 (0)