Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
69c3f28
1
Parent(s):
5fcecfa
Give full list of operators to eureqa
Browse files
README.md
CHANGED
@@ -5,14 +5,65 @@ Uses regularized evolution and simulated annealing.
|
|
5 |
|
6 |
## Running:
|
7 |
|
8 |
-
You can
|
|
|
9 |
```bash
|
10 |
python eureqa.py --threads 8 --binary-operators plus mult
|
11 |
```
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
|
18 |
|
|
|
5 |
|
6 |
## Running:
|
7 |
|
8 |
+
You can either call the program using `eureqa` from `eureqa.py`,
|
9 |
+
or execute the program from the command line with, for example:
|
10 |
```bash
|
11 |
python eureqa.py --threads 8 --binary-operators plus mult
|
12 |
```
|
13 |
|
14 |
+
Here is the full list of arguments:
|
15 |
+
```
|
16 |
+
usage: eureqa.py [-h] [--threads THREADS] [--parsimony PARSIMONY]
|
17 |
+
[--alpha ALPHA] [--maxsize MAXSIZE]
|
18 |
+
[--niterations NITERATIONS] [--npop NPOP]
|
19 |
+
[--ncyclesperiteration NCYCLESPERITERATION] [--topn TOPN]
|
20 |
+
[--fractionReplacedHof FRACTIONREPLACEDHOF]
|
21 |
+
[--fractionReplaced FRACTIONREPLACED] [--migration MIGRATION]
|
22 |
+
[--hofMigration HOFMIGRATION]
|
23 |
+
[--shouldOptimizeConstants SHOULDOPTIMIZECONSTANTS]
|
24 |
+
[--annealing ANNEALING]
|
25 |
+
[--binary-operators BINARY_OPERATORS [BINARY_OPERATORS ...]]
|
26 |
+
[--unary-operators UNARY_OPERATORS]
|
27 |
+
|
28 |
+
optional arguments:
|
29 |
+
-h, --help show this help message and exit
|
30 |
+
--threads THREADS Number of threads (default: 4)
|
31 |
+
--parsimony PARSIMONY
|
32 |
+
How much to punish complexity (default: 0.001)
|
33 |
+
--alpha ALPHA Scaling of temperature (default: 10)
|
34 |
+
--maxsize MAXSIZE Max size of equation (default: 20)
|
35 |
+
--niterations NITERATIONS
|
36 |
+
Number of total migration periods (default: 20)
|
37 |
+
--npop NPOP Number of members per population (default: 100)
|
38 |
+
--ncyclesperiteration NCYCLESPERITERATION
|
39 |
+
Number of evolutionary cycles per migration (default:
|
40 |
+
5000)
|
41 |
+
--topn TOPN How many best species to distribute from each
|
42 |
+
population (default: 10)
|
43 |
+
--fractionReplacedHof FRACTIONREPLACEDHOF
|
44 |
+
Fraction of population to replace with hall of fame
|
45 |
+
(default: 0.1)
|
46 |
+
--fractionReplaced FRACTIONREPLACED
|
47 |
+
Fraction of population to replace with best from other
|
48 |
+
populations (default: 0.1)
|
49 |
+
--migration MIGRATION
|
50 |
+
Whether to migrate (default: True)
|
51 |
+
--hofMigration HOFMIGRATION
|
52 |
+
Whether to have hall of fame migration (default: True)
|
53 |
+
--shouldOptimizeConstants SHOULDOPTIMIZECONSTANTS
|
54 |
+
Whether to use classical optimization on constants
|
55 |
+
before every migration (doesn't impact performance
|
56 |
+
that much) (default: True)
|
57 |
+
--annealing ANNEALING
|
58 |
+
Whether to use simulated annealing (default: True)
|
59 |
+
--binary-operators BINARY_OPERATORS [BINARY_OPERATORS ...]
|
60 |
+
Binary operators. Make sure they are defined in
|
61 |
+
operators.jl (default: ['plus', 'mul'])
|
62 |
+
--unary-operators UNARY_OPERATORS
|
63 |
+
Unary operators. Make sure they are defined in
|
64 |
+
operators.jl (default: ['exp', 'sin', 'cos'])
|
65 |
+
```
|
66 |
+
|
67 |
|
68 |
|
69 |
|
eureqa.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os
|
2 |
-
from argparse import ArgumentParser
|
3 |
from collections import namedtuple
|
4 |
|
5 |
|
@@ -71,7 +71,8 @@ def eureqa(threads=4, parsimony=1e-3, alpha=10,
|
|
71 |
|
72 |
|
73 |
if __name__ == "__main__":
|
74 |
-
parser = ArgumentParser()
|
|
|
75 |
parser.add_argument("--threads", type=int, default=4, help="Number of threads")
|
76 |
parser.add_argument("--parsimony", type=float, default=0.001, help="How much to punish complexity")
|
77 |
parser.add_argument("--alpha", type=int, default=10, help="Scaling of temperature")
|
|
|
1 |
import os
|
2 |
+
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
|
3 |
from collections import namedtuple
|
4 |
|
5 |
|
|
|
71 |
|
72 |
|
73 |
if __name__ == "__main__":
|
74 |
+
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
75 |
+
|
76 |
parser.add_argument("--threads", type=int, default=4, help="Number of threads")
|
77 |
parser.add_argument("--parsimony", type=float, default=0.001, help="How much to punish complexity")
|
78 |
parser.add_argument("--alpha", type=int, default=10, help="Scaling of temperature")
|