diff --git a/.flake8 b/.flake8 index b4f03155..8c14d98f 100644 --- a/.flake8 +++ b/.flake8 @@ -6,5 +6,7 @@ extend-exclude = .venv build extend-ignore = - E203 # No whitespace before ':' in [x : y] - E731 # No lambdas — too strict + # No whitespace before ':' in [x : y] + E203, + # No lambdas — too strict + E731, diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e0bf902..33fc170e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Version 1.1.4 + +## Bug-Fixes +- + # Version 1.1.3 ## Bug-Fixes diff --git a/deepcave/evaluators/epm/random_forest.py b/deepcave/evaluators/epm/random_forest.py index 64d69ad3..30bbb9b0 100644 --- a/deepcave/evaluators/epm/random_forest.py +++ b/deepcave/evaluators/epm/random_forest.py @@ -432,10 +432,9 @@ def predict_marginalized(self, X: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: # marginalized predictions for each tree dat_ = np.zeros((X.shape[0], self._model_options.num_trees)) for i, x in enumerate(X): - # marginalize over instances # 1. get all leaf values for each tree - # type: list[list[float]] + # type= list[list[float]] preds_trees = [[] for i in range(self._model_options.num_trees)] for feat in self.instance_features: diff --git a/deepcave/layouts/sidebar.py b/deepcave/layouts/sidebar.py index 0810e5f8..93f01fc2 100644 --- a/deepcave/layouts/sidebar.py +++ b/deepcave/layouts/sidebar.py @@ -43,7 +43,7 @@ def update_navigation_items(pathname): # type: ignore ] point_layouts = [] - for (id, name, icon) in points: + for id, name, icon in points: href = f"/plugins/{id}" point_layouts += [ html.Li( @@ -106,7 +106,6 @@ def update_queue_info() -> List[Component]: collect = [] for jobs, status in zip(all_jobs, job_stati): - for job in jobs: name = job.meta["display_name"] job_id = job.id diff --git a/deepcave/plugins/__init__.py b/deepcave/plugins/__init__.py index 85026af8..5cf51173 100644 --- a/deepcave/plugins/__init__.py +++ b/deepcave/plugins/__init__.py @@ -314,7 +314,7 @@ def plugin_input_update(pathname: str, *inputs_list: str) -> List[str]: update_dict(inputs, new_inputs) # Set not used inputs - for (id, attribute, _, _) in self.inputs: + for id, attribute, _, _ in self.inputs: if id not in inputs: inputs[id] = {} @@ -421,7 +421,7 @@ def toggle_help_modal(n: Optional[int], is_open: bool) -> Tuple[bool, str]: return is_open # Register callback to click on configurations - for (id, *_) in self.outputs: + for id, *_ in self.outputs: internal_id = self.get_internal_output_id(id) @app.callback( @@ -470,8 +470,7 @@ def _inputs_changed( # If only filters changed, then we don't need to # calculate the results again. if last_inputs is not None: - for (id, attribute, filter, _) in self.inputs: - + for id, attribute, filter, _ in self.inputs: if self.activate_run_selection: if id == "run": continue @@ -524,7 +523,7 @@ def _process_raw_outputs( # We have to add no_updates here for the mode we don't want count_outputs = 0 count_mpl_outputs = 0 - for (_, _, mpl_mode) in self.outputs: + for _, _, mpl_mode in self.outputs: if mpl_mode: count_mpl_outputs += 1 else: @@ -600,7 +599,7 @@ def _dict_to_list( order = self.outputs # type: ignore result: List[Optional[str]] = [] - for (id, attribute, instance, *_) in order: + for id, attribute, instance, *_ in order: if not input: # Instance is mlp_mode in case of outputs # Simply ignore other outputs. @@ -637,7 +636,7 @@ def _dict_as_key(self, d: Dict[str, Any], remove_filters: bool = False) -> Optio new_d = copy.deepcopy(d) if remove_filters: - for (id, _, filter, _) in self.inputs: + for id, _, filter, _ in self.inputs: if filter: if id in new_d: del new_d[id] @@ -662,10 +661,9 @@ def _cast_inputs(self, inputs: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str, casted_inputs: Dict[str, Dict[str, str]] = defaultdict(dict) for id, attributes in inputs.items(): for attribute in attributes: - # Find corresponding input type = None - for (id_, attribute_, _, type_) in self.inputs: + for id_, attribute_, _, type_ in self.inputs: if id == id_ and attribute == attribute_: type = type_ break @@ -702,7 +700,7 @@ def _clean_inputs(self, inputs: Dict[str, Any]) -> Dict[str, Any]: """ used_ids = [] cleaned_inputs = {} - for (id, attribute, *_) in self.inputs: + for id, attribute, *_ in self.inputs: # Since self.inputs is ordered, we use the first occuring attribute and add # the id so it is not used again. if id not in used_ids: @@ -1332,7 +1330,7 @@ def generate_inputs(self, **kwargs: Any) -> Dict[str, Any]: The inputs for the run. """ mapping = {} - for (id, attribute, *_) in self.inputs: + for id, attribute, *_ in self.inputs: # Since `self.inputs` is ordered, we use the first occuring attribute and add # the id so it is not used again. if id not in mapping: diff --git a/deepcave/plugins/objective/cost_over_time.py b/deepcave/plugins/objective/cost_over_time.py index c505d5cb..ae693c7d 100644 --- a/deepcave/plugins/objective/cost_over_time.py +++ b/deepcave/plugins/objective/cost_over_time.py @@ -32,12 +32,14 @@ def check_runs_compatibility(self, runs: List[AbstractRun]) -> None: if run_inequality == RunInequality.INEQ_BUDGET: notification.update("The budgets of the runs are not equal.", color="warning") elif run_inequality == RunInequality.INEQ_CONFIGSPACE: - notification.update("The configuration spaces of the runs are not equal.", color="warning") + notification.update( + "The configuration spaces of the runs are not equal.", color="warning" + ) elif run_inequality == RunInequality.INEQ_META: notification.update("The meta data of the runs is not equal.", color="warning") elif run_inequality == RunInequality.INEQ_OBJECTIVE: notification.update("The objectives of the runs are not equal.", color="warning") - + # Set some attributes here run = runs[0] diff --git a/deepcave/plugins/objective/pareto_front.py b/deepcave/plugins/objective/pareto_front.py index 7b148115..7ce91ccc 100644 --- a/deepcave/plugins/objective/pareto_front.py +++ b/deepcave/plugins/objective/pareto_front.py @@ -32,7 +32,9 @@ def check_runs_compatibility(self, runs): if run_inequality == RunInequality.INEQ_BUDGET: notification.update("The budgets of the runs are not equal.", color="warning") elif run_inequality == RunInequality.INEQ_CONFIGSPACE: - notification.update("The configuration spaces of the runs are not equal.", color="warning") + notification.update( + "The configuration spaces of the runs are not equal.", color="warning" + ) elif run_inequality == RunInequality.INEQ_META: notification.update("The meta data of the runs is not equal.", color="warning") elif run_inequality == RunInequality.INEQ_OBJECTIVE: @@ -186,7 +188,6 @@ def process(run, inputs): is_front: Union[List, np.ndarray] = np.ones(points.shape[0], dtype=bool) for point_idx, costs in enumerate(points): - if is_front[point_idx]: # Keep any point with a lower/upper cost # This loop is a little bit complicated than diff --git a/deepcave/plugins/summary/overview.py b/deepcave/plugins/summary/overview.py index d78f5978..f18d3824 100644 --- a/deepcave/plugins/summary/overview.py +++ b/deepcave/plugins/summary/overview.py @@ -291,7 +291,6 @@ def load_outputs(run, *_): } for hp_name, hp in run.configspace.get_hyperparameters_dict().items(): - log = False value = None if ( diff --git a/deepcave/runs/__init__.py b/deepcave/runs/__init__.py index fb69b3ad..2c02326f 100644 --- a/deepcave/runs/__init__.py +++ b/deepcave/runs/__init__.py @@ -939,7 +939,9 @@ def check_equality( continue if k not in m2 or m2[k] != v: - raise NotMergeableError("Meta data of runs are not equal.", RunInequality.INEQ_META) + raise NotMergeableError( + "Meta data of runs are not equal.", RunInequality.INEQ_META + ) result["meta"] = m1 @@ -951,7 +953,9 @@ def check_equality( for run in runs: cs2 = run.configspace if cs1 != cs2: - raise NotMergeableError("Configspace of runs are not equal.", RunInequality.INEQ_CONFIGSPACE) + raise NotMergeableError( + "Configspace of runs are not equal.", RunInequality.INEQ_CONFIGSPACE + ) result["configspace"] = cs1 @@ -978,7 +982,9 @@ def check_equality( continue if len(o1) != len(o2): - raise NotMergeableError("Objectives of runs are not equal.", RunInequality.INEQ_OBJECTIVE) + raise NotMergeableError( + "Objectives of runs are not equal.", RunInequality.INEQ_OBJECTIVE + ) for o1_, o2_ in zip(o1, o2): o1_.merge(o2_) @@ -988,4 +994,4 @@ def check_equality( if meta: result["meta"]["objectives"] = serialized_objectives - return result \ No newline at end of file + return result diff --git a/deepcave/runs/converters/bohb.py b/deepcave/runs/converters/bohb.py index 9bf9a05d..52321caf 100644 --- a/deepcave/runs/converters/bohb.py +++ b/deepcave/runs/converters/bohb.py @@ -49,7 +49,6 @@ def from_path(cls, path): first_starttime = None for bohb_run in bohb.get_all_runs(): - times = bohb_run.time_stamps starttime = times["started"] endtime = times["finished"] diff --git a/deepcave/runs/exceptions.py b/deepcave/runs/exceptions.py index 14cd2ec3..c7ac65d9 100644 --- a/deepcave/runs/exceptions.py +++ b/deepcave/runs/exceptions.py @@ -1,4 +1,6 @@ from enum import Enum + + class NotValidRunError(Exception): """Raised if directory is not a valid run.""" @@ -10,12 +12,11 @@ class NotMergeableError(Exception): pass + class RunInequality(Enum): """Check why runs were not compatible.""" + INEQ_META = 1 INEQ_OBJECTIVE = 2 INEQ_BUDGET = 3 INEQ_CONFIGSPACE = 4 - - - diff --git a/examples/record/mnist_pytorch.py b/examples/record/mnist_pytorch.py index b50704cf..c11233df 100644 --- a/examples/record/mnist_pytorch.py +++ b/examples/record/mnist_pytorch.py @@ -71,7 +71,6 @@ def prepare_data(self): MNIST(self.data_dir, train=False, download=True) def setup(self, stage=None): - # Assign train/val datasets for use in dataloaders if stage == "fit" or stage is None: mnist_full = MNIST(self.data_dir, train=True, transform=self.transform)