Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
597f1d0
1
Parent(s):
7d1a81e
Average over more tests for hyperparam search
Browse files- hyperparamopt.py +13 -12
hyperparamopt.py
CHANGED
@@ -33,22 +33,23 @@ def run_trial(args):
|
|
33 |
raise ValueError("Takes too long")
|
34 |
|
35 |
maxTime = 60
|
36 |
-
ntrials =
|
37 |
equation_file=f'hall_of_fame_{np.random.rand():f}.csv'
|
38 |
|
39 |
try:
|
40 |
trials = []
|
41 |
-
for i in range(1,
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
52 |
except ValueError:
|
53 |
return {
|
54 |
'status': 'ok', # or 'fail' if nan loss
|
|
|
33 |
raise ValueError("Takes too long")
|
34 |
|
35 |
maxTime = 60
|
36 |
+
ntrials = 3 #3
|
37 |
equation_file=f'hall_of_fame_{np.random.rand():f}.csv'
|
38 |
|
39 |
try:
|
40 |
trials = []
|
41 |
+
for i in range(1, 6):
|
42 |
+
for j in range(ntrials):
|
43 |
+
trial = eureqa.eureqa(
|
44 |
+
test=f"simple{i}",
|
45 |
+
threads=4,
|
46 |
+
binary_operators=["plus", "mult", "pow", "div"],
|
47 |
+
unary_operators=["cos", "exp", "sin", "log"],
|
48 |
+
equation_file=equation_file,
|
49 |
+
timeout=maxTime,
|
50 |
+
**args)
|
51 |
+
if len(trial) == 0: raise ValueError
|
52 |
+
trials.append([np.min(trial['MSE'])])
|
53 |
except ValueError:
|
54 |
return {
|
55 |
'status': 'ok', # or 'fail' if nan loss
|