Skip to content

Commit 251df2a

Browse files
authored
Merge pull request #207 from automl/revert-206-revert-205-development
Revert "Revert "Version 1.3.3""
2 parents f697de3 + d72bc71 commit 251df2a

21 files changed

+448
-98
lines changed

.github/workflows/docs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ env:
2626
jobs:
2727
build-and-deploy:
2828
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
actions: read
2932
defaults:
3033
run:
3134
shell: bash # Default to using bash on all

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Version 1.3.4
2+
3+
## Installation
4+
- Numpy will be installed via conda instead of pip to fix linkage
5+
6+
# Version 1.3.3
7+
8+
## Converters
9+
- Add for each converter a method to check whether a run is valid.
10+
- Change rst docs of converters.
11+
12+
## General Layout
13+
- Fix navigation and button problems in general layout.
14+
- Change general layout to be more intuitiv.
15+
116
# Version 1.3.2
217

318
## Features

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ FLAKE8 ?= flake8
4545
install:
4646
$(PIP) install -e .
4747

48+
# Fix numpy as version 2.1.0 will drop support for Python 3.9
4849
install-dev:
50+
conda install -y numpy=2.0.1
4951
$(PIP) install -e ".[dev]"
5052
pre-commit install
5153

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ DeepCAVE comes with some pre-evaluated runs to get a feeling for what DeepCAVE c
6969

7070
If you cloned the repository from GitHub via `git clone https://github.com/automl/DeepCAVE.git`,
7171
you can try out some examples by exploring the `logs` directory inside the DeepCAVE dashboard.
72-
For example, if you navigate to `logs/DeepCAVE`, you can view the run `mnist_pytorch` if you hit
73-
the `+` button left to it.
72+
For example, if you navigate to `logs/DeepCAVE/mnist_pytorch`, you can view its runs if you hit
73+
the `+` button left to them.
7474

7575

7676
## Features

deepcave/layouts/general.py

+42-18
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ def callback(run_paths: List[str]):
142142
# Add text to go to parent directory
143143
new_element = html.Div(
144144
[
145-
dbc.Button(
146-
"+", id={"type": "general-dynamic-add-run", "index": -1}, disabled=True
145+
html.I(
146+
className="fas fa-folder-open fa-lg",
147+
id={"type": "general-dynamic-add-run", "index": -1},
148+
style={"pointer-events": "none"},
147149
),
148150
dbc.Button(
149151
"..",
@@ -161,23 +163,45 @@ def callback(run_paths: List[str]):
161163

162164
for i, run_path in enumerate(run_paths):
163165
run_name = run_handler.get_run_name(run_path)
164-
new_element = html.Div(
165-
[
166-
dbc.Button("+", id={"type": "general-dynamic-add-run", "index": i}),
167-
dbc.Button(
168-
run_name,
169-
id={"type": "general-dynamic-change-directory", "index": i},
170-
color="link",
171-
),
172-
dcc.Store(
173-
id={"type": "general-dynamic-available-run-path", "index": i},
174-
data=run_path,
175-
),
176-
],
177-
className="mb-1",
178-
)
179-
children.append(new_element)
180166

167+
is_run = run_handler.is_run(run_path)
168+
# Differenciate between run and directory for visibility and usability reasons
169+
if is_run:
170+
new_element = html.Div(
171+
[
172+
dbc.Button(
173+
"+", id={"type": "general-dynamic-add-run", "index": i}, size="sm"
174+
),
175+
dbc.Button(
176+
run_name,
177+
id={"type": "general-dynamic-change-directory", "index": i},
178+
color="light",
179+
disabled=True,
180+
),
181+
dcc.Store(
182+
id={"type": "general-dynamic-available-run-path", "index": i},
183+
data=run_path,
184+
),
185+
],
186+
className="mb-1",
187+
)
188+
else:
189+
new_element = html.Div(
190+
[
191+
html.I(className="fas fa-folder fa-lg"),
192+
dbc.Button(
193+
run_name,
194+
id={"type": "general-dynamic-change-directory", "index": i},
195+
color="link",
196+
),
197+
dcc.Store(
198+
id={"type": "general-dynamic-available-run-path", "index": i},
199+
data=run_path,
200+
),
201+
],
202+
className="mb-1",
203+
)
204+
children.append(new_element)
181205
if len(children) == 0:
182206
return html.Div("No runs found.")
183207

deepcave/runs/converters/amltk.py

+23
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
from typing import Optional, Sequence, Union
2626

27+
import os
2728
import re
2829
from pathlib import Path
2930

@@ -215,3 +216,25 @@ def from_path(cls, path: Union[Path, str]) -> "AMLTKRun":
215216
)
216217

217218
return run
219+
220+
@classmethod
221+
def is_valid_run(cls, path_name: str) -> bool:
222+
"""
223+
Check whether the path name belongs to a valid amltk run.
224+
225+
Parameters
226+
----------
227+
path_name: str
228+
The path to check.
229+
230+
Returns
231+
-------
232+
bool
233+
True if path is valid run.
234+
False otherwise.
235+
"""
236+
if os.path.isfile(path_name + "/history.parquet") and os.path.isfile(
237+
path_name + "/configspace.json"
238+
):
239+
return True
240+
return False

deepcave/runs/converters/bohb.py

+21
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
from typing import Any, Dict, Union
2727

28+
import os
2829
from pathlib import Path
2930

3031
from ConfigSpace.configuration_space import ConfigurationSpace
@@ -177,3 +178,23 @@ def from_path(cls, path: Union[Path, str]) -> "BOHBRun":
177178
)
178179

179180
return run
181+
182+
@classmethod
183+
def is_valid_run(cls, path_name: str) -> bool:
184+
"""
185+
Check whether the path name belongs to a valid bohb run.
186+
187+
Parameters
188+
----------
189+
path_name: str
190+
The path to check.
191+
192+
Returns
193+
-------
194+
bool
195+
True if path is valid run.
196+
False otherwise.
197+
"""
198+
if os.path.isfile(path_name + "/configspace.json"):
199+
return True
200+
return False

deepcave/runs/converters/dataframe.py

+22
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,25 @@ def _extract_additional(
385385
additional = data.drop(hyperparameters + costs_metrics + budgets + seeds + meta)
386386
additional = dict(additional)
387387
return {key: value if pd.notna(value) else None for key, value in additional.items()}
388+
389+
@classmethod
390+
def is_valid_run(cls, path_name: str) -> bool:
391+
"""
392+
Check whether the path name belongs to a valid dataframe run.
393+
394+
Parameters
395+
----------
396+
path_name: str
397+
The path to check.
398+
399+
Returns
400+
-------
401+
bool
402+
True if path is valid run.
403+
False otherwise.
404+
"""
405+
if os.path.isfile(path_name + "/trials.csv") and os.path.isfile(
406+
path_name + "/configspace.csv"
407+
):
408+
return True
409+
return False

deepcave/runs/converters/deepcave.py

+21
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
from typing import Union
2626

27+
import os
2728
from pathlib import Path
2829

2930
from deepcave.runs.run import Run
@@ -92,3 +93,23 @@ def from_path(cls, path: Path) -> "DeepCAVERun":
9293
The DeepCAVE run.
9394
"""
9495
return DeepCAVERun(path.stem, path=Path(path))
96+
97+
@classmethod
98+
def is_valid_run(cls, path_name: str) -> bool:
99+
"""
100+
Check whether the path name belongs to a valid deepcave run.
101+
102+
Parameters
103+
----------
104+
path_name: str
105+
The path to check.
106+
107+
Returns
108+
-------
109+
bool
110+
True if path is valid run.
111+
False otherwise.
112+
"""
113+
if os.path.isfile(path_name + "history.jsonl"):
114+
return True
115+
return False

deepcave/runs/converters/optuna.py

+22
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,25 @@ def from_path(cls, path: Union[Path, str]) -> "OptunaRun":
285285
)
286286

287287
return run
288+
289+
@classmethod
290+
def is_valid_run(cls, path_name: str) -> bool:
291+
"""
292+
Check whether the path name belongs to a valid optuna run.
293+
294+
Parameters
295+
----------
296+
path_name: str
297+
The path to check.
298+
299+
Returns
300+
-------
301+
bool
302+
True if path is valid run.
303+
False otherwise.
304+
"""
305+
path = Path(path_name)
306+
pickle_files = list(path.glob("*.pkl"))
307+
if len(pickle_files) != 1:
308+
return False
309+
return True

deepcave/runs/converters/smac3v1.py

+23
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from typing import Optional, Union
2828

2929
import json
30+
import os
3031
from pathlib import Path
3132

3233
import numpy as np
@@ -217,3 +218,25 @@ def from_path(cls, path: Union[Path, str]) -> "SMAC3v1Run":
217218
)
218219

219220
return run
221+
222+
@classmethod
223+
def is_valid_run(cls, path_name: str) -> bool:
224+
"""
225+
Check whether the path name belongs to a valid smac3v1 run.
226+
227+
Parameters
228+
----------
229+
path_name: str
230+
The path to check.
231+
232+
Returns
233+
-------
234+
bool
235+
True if path is valid run.
236+
False otherwise.
237+
"""
238+
if os.path.isfile(path_name + "/runhistory.json") and os.path.isfile(
239+
path_name + "/configspace.json"
240+
):
241+
return True
242+
return False

0 commit comments

Comments
 (0)