Skip to content

Commit 36ef91c

Browse files
committed
fixed some pre-commit issues
1 parent fb55f8f commit 36ef91c

File tree

9 files changed

+308
-11
lines changed

9 files changed

+308
-11
lines changed

deepcave/runs/converters/raytune.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def hash(self) -> str:
5656
if file.is_file() and file.name.startswith("experiment_stat")
5757
]
5858
# Use hash of experiment_stat as id
59-
return file_to_hash(hash_file) # type: ignore
59+
return file_to_hash(hash_file[0])
6060

6161
@property
6262
def latest_change(self) -> float:
@@ -88,14 +88,14 @@ def from_path(cls, path: Path) -> "RayTuneRun":
8888
RayTuneRun
8989
The run.
9090
"""
91-
configspace = None
91+
configspace_new: dict
9292
hp_names = {}
9393
analysis = None
9494
analysis = ExperimentAnalysis(str(path)).results
9595

9696
# Get the information of the configspace
9797
if not os.path.isfile(str(path) + "/configspace.json"):
98-
configspace = { # type: ignore
98+
configspace_new = {
9999
"name": None,
100100
"hyperparameters": [],
101101
"conditions": [],
@@ -115,12 +115,12 @@ def from_path(cls, path: Path) -> "RayTuneRun":
115115
if isinstance(value, str):
116116
for key, values in hp_names.items():
117117
values_set = set(values)
118-
configspace["hyperparameters"].append( # type: ignore
118+
configspace_new["hyperparameters"].append(
119119
{"type": "categorical", "name": key, "choices": list(values_set)}
120120
)
121121
else:
122122
for key, values in hp_names.items():
123-
configspace["hyperparameters"].append( # type: ignore
123+
configspace_new["hyperparameters"].append(
124124
{
125125
"type": "uniform_" + type(values[0]).__name__,
126126
"name": key,
@@ -130,10 +130,10 @@ def from_path(cls, path: Path) -> "RayTuneRun":
130130
}
131131
)
132132
with open(str(path) + "/configspace.json", "w") as f:
133-
json.dump(configspace, f)
133+
json.dump(configspace_new, f)
134134

135135
# Convert into a Configuration Space object
136-
configspace = ConfigurationSpace.from_json(path / "configspace.json") # type: ignore
136+
configspace = ConfigurationSpace.from_json(path / "configspace.json")
137137
file_path = str(path) + "/experiment_state*"
138138
for filename in glob.glob(file_path):
139139
with open(filename, "r") as f:
@@ -142,7 +142,7 @@ def from_path(cls, path: Path) -> "RayTuneRun":
142142
obj = json.loads(nested_json_str)["trainable_name"]
143143

144144
objective = Objective(obj)
145-
run = RayTuneRun(path.stem, configspace=configspace, objectives=objective) # type: ignore
145+
run = RayTuneRun(path.stem, configspace=configspace, objectives=objective)
146146

147147
config = None
148148
# Get all information of the run
@@ -184,14 +184,12 @@ def from_path(cls, path: Path) -> "RayTuneRun":
184184
# TODO: Warning also in configspace.json -> Wie?
185185
# TODO: Warning that all get treated as uniform
186186
# TODO: Warning objective bounds & optimize goal
187-
# TODO: Store results? Where?
188187
# TODO: Test other functions of
189188
# TODO: Test for mutliple search variants
190189
# TODO: put raytune in doc install
191190
# TODO: Did pyarrow update break anything?
192191
# TODO: ignores rausnehmen
193192
# TODO: adjust git ignore
194-
os.remove(path / "configspace.json")
195193

196194
return run
197195

logs/RayTune/run_1/configs.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"6a64c_00005": {
3+
"x": 3,
4+
"y": 4
5+
},
6+
"6a64c_00002": {
7+
"x": 3,
8+
"y": 1
9+
},
10+
"6a64c_00000": {
11+
"x": 1,
12+
"y": 1
13+
},
14+
"6a64c_00016": {
15+
"x": 2,
16+
"y": 7
17+
},
18+
"6a64c_00013": {
19+
"x": 2,
20+
"y": 4
21+
},
22+
"6a64c_00009": {
23+
"x": 1,
24+
"y": 1
25+
},
26+
"6a64c_00012": {
27+
"x": 1,
28+
"y": 4
29+
},
30+
"6a64c_00003": {
31+
"x": 1,
32+
"y": 4
33+
},
34+
"6a64c_00006": {
35+
"x": 1,
36+
"y": 7
37+
},
38+
"6a64c_00014": {
39+
"x": 3,
40+
"y": 4
41+
},
42+
"6a64c_00008": {
43+
"x": 3,
44+
"y": 7
45+
},
46+
"6a64c_00017": {
47+
"x": 3,
48+
"y": 7
49+
},
50+
"6a64c_00011": {
51+
"x": 3,
52+
"y": 1
53+
},
54+
"6a64c_00007": {
55+
"x": 2,
56+
"y": 7
57+
},
58+
"6a64c_00004": {
59+
"x": 2,
60+
"y": 4
61+
},
62+
"6a64c_00010": {
63+
"x": 2,
64+
"y": 1
65+
},
66+
"6a64c_00015": {
67+
"x": 1,
68+
"y": 7
69+
},
70+
"6a64c_00001": {
71+
"x": 2,
72+
"y": 1
73+
}
74+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": null, "hyperparameters": [{"type": "uniform_int", "name": "x", "lower": 1, "upper": 3, "default_value": 2}, {"type": "uniform_int", "name": "y", "lower": 1, "upper": 7, "default_value": 4}], "conditions": [], "forbiddens": [], "python_module_version": "1.2.0", "format_version": 0.4}

logs/RayTune/run_1/results.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"6a64c_00005": [
3+
"score",
4+
13
5+
],
6+
"6a64c_00002": [
7+
"score",
8+
10
9+
],
10+
"6a64c_00000": [
11+
"score",
12+
2
13+
],
14+
"6a64c_00016": [
15+
"score",
16+
11
17+
],
18+
"6a64c_00013": [
19+
"score",
20+
8
21+
],
22+
"6a64c_00009": [
23+
"score",
24+
2
25+
],
26+
"6a64c_00012": [
27+
"score",
28+
5
29+
],
30+
"6a64c_00003": [
31+
"score",
32+
5
33+
],
34+
"6a64c_00006": [
35+
"score",
36+
8
37+
],
38+
"6a64c_00014": [
39+
"score",
40+
13
41+
],
42+
"6a64c_00008": [
43+
"score",
44+
16
45+
],
46+
"6a64c_00017": [
47+
"score",
48+
16
49+
],
50+
"6a64c_00011": [
51+
"score",
52+
10
53+
],
54+
"6a64c_00007": [
55+
"score",
56+
11
57+
],
58+
"6a64c_00004": [
59+
"score",
60+
8
61+
],
62+
"6a64c_00010": [
63+
"score",
64+
5
65+
],
66+
"6a64c_00015": [
67+
"score",
68+
8
69+
],
70+
"6a64c_00001": [
71+
"score",
72+
5
73+
]
74+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": null, "hyperparameters": [{"type": "uniform_float", "name": "x", "lower": 1.5, "upper": 3.2, "default_value": 2.35}, {"type": "uniform_float", "name": "y", "lower": 4.2, "upper": 13.4, "default_value": 8.8}], "conditions": [], "forbiddens": [], "python_module_version": "1.2.0", "format_version": 0.4}

logs/RayTune/run_3/configs.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"409ac_00001": {
3+
"x": "beta",
4+
"y": "delta"
5+
},
6+
"409ac_00007": {
7+
"x": "beta",
8+
"y": "zeta"
9+
},
10+
"409ac_00015": {
11+
"x": "alpha",
12+
"y": "zeta"
13+
},
14+
"409ac_00012": {
15+
"x": "alpha",
16+
"y": "epsilon"
17+
},
18+
"409ac_00008": {
19+
"x": "gamma",
20+
"y": "zeta"
21+
},
22+
"409ac_00005": {
23+
"x": "gamma",
24+
"y": "epsilon"
25+
},
26+
"409ac_00002": {
27+
"x": "gamma",
28+
"y": "delta"
29+
},
30+
"409ac_00009": {
31+
"x": "alpha",
32+
"y": "delta"
33+
},
34+
"409ac_00011": {
35+
"x": "gamma",
36+
"y": "delta"
37+
},
38+
"409ac_00010": {
39+
"x": "beta",
40+
"y": "delta"
41+
},
42+
"409ac_00013": {
43+
"x": "beta",
44+
"y": "epsilon"
45+
},
46+
"409ac_00016": {
47+
"x": "beta",
48+
"y": "zeta"
49+
},
50+
"409ac_00006": {
51+
"x": "alpha",
52+
"y": "zeta"
53+
},
54+
"409ac_00003": {
55+
"x": "alpha",
56+
"y": "epsilon"
57+
},
58+
"409ac_00000": {
59+
"x": "alpha",
60+
"y": "delta"
61+
},
62+
"409ac_00017": {
63+
"x": "gamma",
64+
"y": "zeta"
65+
},
66+
"409ac_00014": {
67+
"x": "gamma",
68+
"y": "epsilon"
69+
},
70+
"409ac_00004": {
71+
"x": "beta",
72+
"y": "epsilon"
73+
}
74+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": null, "hyperparameters": [{"type": "categorical", "name": "x", "choices": ["beta", "alpha", "gamma"]}, {"type": "categorical", "name": "y", "choices": ["epsilon", "zeta", "delta"]}], "conditions": [], "forbiddens": [], "python_module_version": "1.2.0", "format_version": 0.4}

logs/RayTune/run_3/results.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"409ac_00001": [
3+
"score",
4+
"betadelta"
5+
],
6+
"409ac_00007": [
7+
"score",
8+
"betazeta"
9+
],
10+
"409ac_00015": [
11+
"score",
12+
"alphazeta"
13+
],
14+
"409ac_00012": [
15+
"score",
16+
"alphaepsilon"
17+
],
18+
"409ac_00008": [
19+
"score",
20+
"gammazeta"
21+
],
22+
"409ac_00005": [
23+
"score",
24+
"gammaepsilon"
25+
],
26+
"409ac_00002": [
27+
"score",
28+
"gammadelta"
29+
],
30+
"409ac_00009": [
31+
"score",
32+
"alphadelta"
33+
],
34+
"409ac_00011": [
35+
"score",
36+
"gammadelta"
37+
],
38+
"409ac_00010": [
39+
"score",
40+
"betadelta"
41+
],
42+
"409ac_00013": [
43+
"score",
44+
"betaepsilon"
45+
],
46+
"409ac_00016": [
47+
"score",
48+
"betazeta"
49+
],
50+
"409ac_00006": [
51+
"score",
52+
"alphazeta"
53+
],
54+
"409ac_00003": [
55+
"score",
56+
"alphaepsilon"
57+
],
58+
"409ac_00000": [
59+
"score",
60+
"alphadelta"
61+
],
62+
"409ac_00017": [
63+
"score",
64+
"gammazeta"
65+
],
66+
"409ac_00014": [
67+
"score",
68+
"gammaepsilon"
69+
],
70+
"409ac_00004": [
71+
"score",
72+
"betaepsilon"
73+
]
74+
}

tests/test_runs/test_converter/test_raytune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class TestRayTune(unittest.TestCase):
88
def test_test(self):
9-
RayTuneRun.from_path(Path("/Users/krissi/Documents/DeepCAVE/logs/RayTune/run_2"))
9+
RayTuneRun.from_path(Path("/Users/krissi/Documents/DeepCAVE/logs/RayTune/run_3"))
1010

1111

1212
if __name__ == "__main__":

0 commit comments

Comments
 (0)