MilesCranmer commited on
Commit
d96df3e
1 Parent(s): 8ff33c6

More documentation

Browse files
Files changed (1) hide show
  1. eureqa.jl +12 -5
eureqa.jl CHANGED
@@ -2,23 +2,30 @@
2
  plus(x::Float64, y::Float64) = x+y
3
  mult(x::Float64, y::Float64) = x*y;
4
 
 
 
5
  # (Apparently using const for globals helps speed)
6
- const binops = [plus, mult]
7
  const unaops = [sin, cos, exp]
 
8
 
9
  const nvar = 5;
10
- const X = rand(100, nvar)
11
-
12
  # Here is the function we want to learn (x2^2 + cos(x3) + 5)
 
 
 
 
13
  const y = ((cx,)->cx^2).(X[:, 2]) + cos.(X[:, 3]) .+ 5.0;
 
14
 
 
 
15
  # How much to punish complexity
16
  const parsimony = 0.01
17
  # How much to scale temperature by (T between 0 and 1)
18
  const alpha = 10.0
19
  const maxsize = 20
20
-
21
-
22
 
23
  id = (x,) -> x
24
  const nuna = size(unaops)[1]
 
2
  plus(x::Float64, y::Float64) = x+y
3
  mult(x::Float64, y::Float64) = x*y;
4
 
5
+ ##########################
6
+ # # Allowed operators
7
  # (Apparently using const for globals helps speed)
8
+ const binops = [plus, mult, (x, y)->x^2*y]
9
  const unaops = [sin, cos, exp]
10
+ ##########################
11
 
12
  const nvar = 5;
 
 
13
  # Here is the function we want to learn (x2^2 + cos(x3) + 5)
14
+ #
15
+ ##########################
16
+ # # Dataset to learn
17
+ const X = rand(100, nvar)
18
  const y = ((cx,)->cx^2).(X[:, 2]) + cos.(X[:, 3]) .+ 5.0;
19
+ ##########################
20
 
21
+ ##################
22
+ # Hyperparameters
23
  # How much to punish complexity
24
  const parsimony = 0.01
25
  # How much to scale temperature by (T between 0 and 1)
26
  const alpha = 10.0
27
  const maxsize = 20
28
+ ##################
 
29
 
30
  id = (x,) -> x
31
  const nuna = size(unaops)[1]