MilesCranmer commited on
Commit
dadf84b
1 Parent(s): eb8a07c

Adjust hyperparameters based on 500 trial search

Browse files
Files changed (1) hide show
  1. eureqa.py +17 -20
eureqa.py CHANGED
@@ -5,24 +5,23 @@ import pathlib
5
  import numpy as np
6
  import pandas as pd
7
 
8
-
9
- def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=10,
10
  maxsize=20, migration=True,
11
- hofMigration=True, fractionReplacedHof=0.1,
12
  shouldOptimizeConstants=True,
13
  binary_operators=["plus", "mult"],
14
  unary_operators=["cos", "exp", "sin"],
15
- niterations=20, npop=100, annealing=True,
16
- ncyclesperiteration=5000, fractionReplaced=0.1,
17
- topn=10, equation_file='hall_of_fame.csv',
18
  test='simple1',
19
- weightMutateConstant=4.0,
20
- weightMutateOperator=0.5,
21
- weightAddNode=0.5,
22
- weightDeleteNode=0.5,
23
- weightSimplify=0.05,
24
- weightRandomize=0.25,
25
- weightDoNothing=1.0,
26
  timeout=None,
27
  ):
28
  """ Runs symbolic regression in Julia, to fit y given X.
@@ -160,20 +159,18 @@ const y = convert(Array{Float32, 1}, """f"{y_str})""""
160
 
161
 
162
 
163
-
164
-
165
  if __name__ == "__main__":
166
  parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
167
 
168
  parser.add_argument("--threads", type=int, default=4, help="Number of threads")
169
  parser.add_argument("--parsimony", type=float, default=0.001, help="How much to punish complexity")
170
- parser.add_argument("--alpha", type=int, default=10, help="Scaling of temperature")
171
  parser.add_argument("--maxsize", type=int, default=20, help="Max size of equation")
172
  parser.add_argument("--niterations", type=int, default=20, help="Number of total migration periods")
173
- parser.add_argument("--npop", type=int, default=100, help="Number of members per population")
174
- parser.add_argument("--ncyclesperiteration", type=int, default=5000, help="Number of evolutionary cycles per migration")
175
- parser.add_argument("--topn", type=int, default=10, help="How many best species to distribute from each population")
176
- parser.add_argument("--fractionReplacedHof", type=float, default=0.1, help="Fraction of population to replace with hall of fame")
177
  parser.add_argument("--fractionReplaced", type=float, default=0.1, help="Fraction of population to replace with best from other populations")
178
  parser.add_argument("--migration", type=bool, default=True, help="Whether to migrate")
179
  parser.add_argument("--hofMigration", type=bool, default=True, help="Whether to have hall of fame migration")
 
5
  import numpy as np
6
  import pandas as pd
7
 
8
+ def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=2.4,
 
9
  maxsize=20, migration=True,
10
+ hofMigration=True, fractionReplacedHof=0.15,
11
  shouldOptimizeConstants=True,
12
  binary_operators=["plus", "mult"],
13
  unary_operators=["cos", "exp", "sin"],
14
+ niterations=20, npop=120, annealing=True,
15
+ ncyclesperiteration=12000, fractionReplaced=0.1,
16
+ topn=2, equation_file='hall_of_fame.csv',
17
  test='simple1',
18
+ weightMutateConstant=8.0,
19
+ weightMutateOperator=0.7,
20
+ weightAddNode=1.2,
21
+ weightDeleteNode=0.17,
22
+ weightSimplify=0.07,
23
+ weightRandomize=0.18,
24
+ weightDoNothing=1.7,
25
  timeout=None,
26
  ):
27
  """ Runs symbolic regression in Julia, to fit y given X.
 
159
 
160
 
161
 
 
 
162
  if __name__ == "__main__":
163
  parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
164
 
165
  parser.add_argument("--threads", type=int, default=4, help="Number of threads")
166
  parser.add_argument("--parsimony", type=float, default=0.001, help="How much to punish complexity")
167
+ parser.add_argument("--alpha", type=int, default=2.4, help="Scaling of temperature")
168
  parser.add_argument("--maxsize", type=int, default=20, help="Max size of equation")
169
  parser.add_argument("--niterations", type=int, default=20, help="Number of total migration periods")
170
+ parser.add_argument("--npop", type=int, default=120, help="Number of members per population")
171
+ parser.add_argument("--ncyclesperiteration", type=int, default=12000, help="Number of evolutionary cycles per migration")
172
+ parser.add_argument("--topn", type=int, default=2, help="How many best species to distribute from each population")
173
+ parser.add_argument("--fractionReplacedHof", type=float, default=0.15, help="Fraction of population to replace with hall of fame")
174
  parser.add_argument("--fractionReplaced", type=float, default=0.1, help="Fraction of population to replace with best from other populations")
175
  parser.add_argument("--migration", type=bool, default=True, help="Whether to migrate")
176
  parser.add_argument("--hofMigration", type=bool, default=True, help="Whether to have hall of fame migration")