Spaces:
Running
Running
Commit
·
03d4ec3
1
Parent(s):
96afc52
Accidentally redefine list
Browse files- benchmarks/hyperparamopt.py +11 -11
benchmarks/hyperparamopt.py
CHANGED
|
@@ -62,7 +62,7 @@ def run_trial(args):
|
|
| 62 |
|
| 63 |
print(f"Starting", str(args))
|
| 64 |
try:
|
| 65 |
-
|
| 66 |
for i in range(len(eval_str)):
|
| 67 |
print(f"Starting test {i}")
|
| 68 |
for j in range(ntrials):
|
|
@@ -81,15 +81,15 @@ def run_trial(args):
|
|
| 81 |
)
|
| 82 |
if len(trial) == 0:
|
| 83 |
raise ValueError
|
| 84 |
-
|
| 85 |
np.min(trial["MSE"]) ** 0.5 / np.std(eval(eval_str[i - 1]))
|
| 86 |
)
|
| 87 |
-
print(f"Test {i} trial {j} with", str(args), f"got {
|
| 88 |
|
| 89 |
except ValueError:
|
| 90 |
print(f"Broken", str(args))
|
| 91 |
return {"status": "ok", "loss": np.inf} # or 'fail' if nan loss
|
| 92 |
-
loss = np.average(
|
| 93 |
print(f"Finished with {loss}", str(args))
|
| 94 |
|
| 95 |
return {"status": "ok", "loss": loss} # or 'fail' if nan loss
|
|
@@ -127,15 +127,15 @@ def merge_trials(trials1, trials2_slice):
|
|
| 127 |
|
| 128 |
for trial in trials2_slice:
|
| 129 |
tid = trial["tid"] + max_tid + 1
|
| 130 |
-
|
| 131 |
tids=[None], specs=[None], results=[None], miscs=[None]
|
| 132 |
)
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
for key in
|
| 137 |
-
|
| 138 |
-
trials1.insert_trial_docs(
|
| 139 |
trials1.refresh()
|
| 140 |
return trials1
|
| 141 |
|
|
|
|
| 62 |
|
| 63 |
print(f"Starting", str(args))
|
| 64 |
try:
|
| 65 |
+
local_trials = []
|
| 66 |
for i in range(len(eval_str)):
|
| 67 |
print(f"Starting test {i}")
|
| 68 |
for j in range(ntrials):
|
|
|
|
| 81 |
)
|
| 82 |
if len(trial) == 0:
|
| 83 |
raise ValueError
|
| 84 |
+
local_trials.append(
|
| 85 |
np.min(trial["MSE"]) ** 0.5 / np.std(eval(eval_str[i - 1]))
|
| 86 |
)
|
| 87 |
+
print(f"Test {i} trial {j} with", str(args), f"got {local_trials[-1]}")
|
| 88 |
|
| 89 |
except ValueError:
|
| 90 |
print(f"Broken", str(args))
|
| 91 |
return {"status": "ok", "loss": np.inf} # or 'fail' if nan loss
|
| 92 |
+
loss = np.average(local_trials)
|
| 93 |
print(f"Finished with {loss}", str(args))
|
| 94 |
|
| 95 |
return {"status": "ok", "loss": loss} # or 'fail' if nan loss
|
|
|
|
| 127 |
|
| 128 |
for trial in trials2_slice:
|
| 129 |
tid = trial["tid"] + max_tid + 1
|
| 130 |
+
local_hyperopt_trial = Trials().new_trial_docs(
|
| 131 |
tids=[None], specs=[None], results=[None], miscs=[None]
|
| 132 |
)
|
| 133 |
+
local_hyperopt_trial[0] = trial
|
| 134 |
+
local_hyperopt_trial[0]["tid"] = tid
|
| 135 |
+
local_hyperopt_trial[0]["misc"]["tid"] = tid
|
| 136 |
+
for key in local_hyperopt_trial[0]["misc"]["idxs"].keys():
|
| 137 |
+
local_hyperopt_trial[0]["misc"]["idxs"][key] = [tid]
|
| 138 |
+
trials1.insert_trial_docs(local_hyperopt_trial)
|
| 139 |
trials1.refresh()
|
| 140 |
return trials1
|
| 141 |
|