MilesCranmer commited on
Commit
dcb0894
1 Parent(s): c4bc4e3

Update hyperparams and docs to insertionOp

Browse files
Files changed (4) hide show
  1. README.md +4 -4
  2. eureqa.jl +0 -1
  3. eureqa.py +16 -16
  4. operators.jl +2 -2
README.md CHANGED
@@ -59,11 +59,11 @@ which gives:
59
  ### API
60
 
61
  What follows is the API reference for running the numpy interface.
62
- Note that most parameters here
63
- have been tuned with ~1000 trials over several example
64
- equations, so you likely don't need to tune them yourself.
65
  However, you should adjust `threads`, `niterations`,
66
- `binary_operators`, `unary_operators`, and `maxsize` to your requirements.
 
67
 
68
  The program will output a pandas DataFrame containing the equations,
69
  mean square error, and complexity. It will also dump to a csv
 
59
  ### API
60
 
61
  What follows is the API reference for running the numpy interface.
62
+ You likely don't need to tune the hyperparameters yourself,
63
+ but if you would like, you can use `hyperopt.py` as an example.
 
64
  However, you should adjust `threads`, `niterations`,
65
+ `binary_operators`, `unary_operators`, and `maxsize`
66
+ to your requirements.
67
 
68
  The program will output a pandas DataFrame containing the equations,
69
  mean square error, and complexity. It will also dump to a csv
eureqa.jl CHANGED
@@ -739,7 +739,6 @@ function fullRun(niterations::Integer;
739
  # Spawn threads to run indepdent evolutions, then gather them
740
  @inbounds Threads.@threads for i=1:nthreads
741
  allPops[i] = run(allPops[i], ncyclesperiteration, annealing, verbosity=verbosity)
742
- topn = npop
743
  bestSubPops[i] = bestSubPop(allPops[i], topn=topn)
744
  for j=1:bestSubPops[i].n
745
  bestSubPops[i].members[j].tree = simplifyTree(bestSubPops[i].members[j].tree)
 
739
  # Spawn threads to run indepdent evolutions, then gather them
740
  @inbounds Threads.@threads for i=1:nthreads
741
  allPops[i] = run(allPops[i], ncyclesperiteration, annealing, verbosity=verbosity)
 
742
  bestSubPops[i] = bestSubPop(allPops[i], topn=topn)
743
  for j=1:bestSubPops[i].n
744
  bestSubPops[i].members[j].tree = simplifyTree(bestSubPops[i].members[j].tree)
eureqa.py CHANGED
@@ -6,21 +6,21 @@ import numpy as np
6
  import pandas as pd
7
 
8
  # Dumped from hyperparam optimization
9
- default_alpha = 3.861222
10
- default_fractionReplaced = 0.057940
11
- default_fractionReplacedHof = 0.206182
12
- default_npop = 124.000000
13
- default_weightAddNode = 1.599672
14
- default_weightInsertNode = 1.599672
15
- default_weightDeleteNode = 0.049554
16
- default_weightMutateConstant = 5.295328
17
- default_weightMutateOperator = 0.465999
18
- default_weightRandomize = 0.184765
19
- default_weightSimplify = 0.149432
20
- default_weightDoNothing = 1.000000
21
- default_result = 0.028084
22
- default_topn = 10
23
- default_parsimony = 1e-3
24
 
25
 
26
  def eureqa(X=None, y=None, threads=4,
@@ -33,7 +33,7 @@ def eureqa(X=None, y=None, threads=4,
33
  fractionReplaced=default_fractionReplaced,
34
  fractionReplacedHof=default_fractionReplacedHof,
35
  npop=int(default_npop),
36
- parsimony=1e-3,
37
  migration=True,
38
  hofMigration=True,
39
  shouldOptimizeConstants=True,
 
6
  import pandas as pd
7
 
8
  # Dumped from hyperparam optimization
9
+ default_alpha = 5
10
+ default_fractionReplaced = 0.1
11
+ default_fractionReplacedHof = 0.1
12
+ default_npop = 200
13
+ default_weightAddNode = 1
14
+ default_weightInsertNode = 1
15
+ default_weightDeleteNode = 1
16
+ default_weightMutateConstant = 10
17
+ default_weightMutateOperator = 1
18
+ default_weightRandomize = 1
19
+ default_weightSimplify = 1
20
+ default_weightDoNothing = 1
21
+ default_result = 1
22
+ default_topn = 10
23
+ default_parsimony = 0.0
24
 
25
 
26
  def eureqa(X=None, y=None, threads=4,
 
33
  fractionReplaced=default_fractionReplaced,
34
  fractionReplacedHof=default_fractionReplacedHof,
35
  npop=int(default_npop),
36
+ parsimony=default_parsimony,
37
  migration=True,
38
  hofMigration=True,
39
  shouldOptimizeConstants=True,
operators.jl CHANGED
@@ -1,6 +1,6 @@
1
  # Define allowed operators. Any julia operator can also be used.
2
- plus(x::Float32, y::Float32)::Float32 = x+y
3
- mult(x::Float32, y::Float32)::Float32 = x*y
4
  pow(x::Float32, y::Float32)::Float32 = sign(x)*abs(x)^y
5
  div(x::Float32, y::Float32)::Float32 = x/y
6
  loga(x::Float32)::Float32 = log(abs(x) + 1)
 
1
  # Define allowed operators. Any julia operator can also be used.
2
+ plus(x::Float32, y::Float32)::Float32 = x+y #Do not change the name of this operator.
3
+ mult(x::Float32, y::Float32)::Float32 = x*y #Do not change the name of this operator.
4
  pow(x::Float32, y::Float32)::Float32 = sign(x)*abs(x)^y
5
  div(x::Float32, y::Float32)::Float32 = x/y
6
  loga(x::Float32)::Float32 = log(abs(x) + 1)