MilesCranmer commited on
Commit
d781e18
2 Parent(s): 211c6a7 399aef5

Merge branch 'master' of github.com:MilesCranmer/PySR into master

Browse files
Files changed (4) hide show
  1. TODO.md +3 -0
  2. docs/operators.md +1 -1
  3. julia/operators.jl +1 -0
  4. pysr/sr.py +1 -0
TODO.md CHANGED
@@ -79,6 +79,8 @@
79
  ## Algorithmic performance ideas:
80
 
81
  - [ ] Use package compiler and compile sr.jl into a standalone binary that can be used by pysr.
 
 
82
  - [ ] Idea: use gradient of equation with respect to each operator (perhaps simply add to each operator) to tell which part is the most "sensitive" to changes. Then, perhaps insert/delete/mutate on that part of the tree?
83
  - [ ] Start populations staggered; so that there is more frequent printing (and pops that start a bit later get hall of fame already)?
84
  - [ ] Consider adding mutation for constant<->variable
@@ -94,6 +96,7 @@
94
 
95
  ## Code performance ideas:
96
 
 
97
  - [ ] Try defining a binary tree as an array, rather than a linked list. See https://stackoverflow.com/a/6384714/2689923
98
  - [ ] Add true multi-node processing, with MPI, or just file sharing. Multiple populations per core.
99
  - Ongoing in cluster branch
 
79
  ## Algorithmic performance ideas:
80
 
81
  - [ ] Use package compiler and compile sr.jl into a standalone binary that can be used by pysr.
82
+ - [ ] When doing equation warmup, only migrate those equations with almost the same complexity. Rather than having to consider simple equations later in the game.
83
+ - [ ] Right now we only update the score based on some. Need to update score based on entire data! Note that optimizer only is used sometimes.
84
  - [ ] Idea: use gradient of equation with respect to each operator (perhaps simply add to each operator) to tell which part is the most "sensitive" to changes. Then, perhaps insert/delete/mutate on that part of the tree?
85
  - [ ] Start populations staggered; so that there is more frequent printing (and pops that start a bit later get hall of fame already)?
86
  - [ ] Consider adding mutation for constant<->variable
 
96
 
97
  ## Code performance ideas:
98
 
99
+ - [ ] How hard is it to turn the recursive array evaluation into a for loop?
100
  - [ ] Try defining a binary tree as an array, rather than a linked list. See https://stackoverflow.com/a/6384714/2689923
101
  - [ ] Add true multi-node processing, with MPI, or just file sharing. Multiple populations per core.
102
  - Ongoing in cluster branch
docs/operators.md CHANGED
@@ -8,7 +8,7 @@ of these and other valid operators are stated below.
8
 
9
  **Binary**
10
 
11
- `plus`, `mult`, `pow`, `div`, `greater`, `mod`, `beta`, `logical_or`,
12
  `logical_and`
13
 
14
  **Unary**
 
8
 
9
  **Binary**
10
 
11
+ `plus`, `sub`, `mult`, `pow`, `div`, `greater`, `mod`, `beta`, `logical_or`,
12
  `logical_and`
13
 
14
  **Unary**
julia/operators.jl CHANGED
@@ -13,6 +13,7 @@ import Base.FastMath: sqrt_llvm_fast, neg_float_fast,
13
  # Use some fast operators from https://github.com/JuliaLang/julia/blob/81597635c4ad1e8c2e1c5753fda4ec0e7397543f/base/fastmath.jl
14
  # Define allowed operators. Any julia operator can also be used.
15
  plus(x::Float32, y::Float32)::Float32 = add_float_fast(x, y) #Do not change the name of this operator.
 
16
  mult(x::Float32, y::Float32)::Float32 = mul_float_fast(x, y) #Do not change the name of this operator.
17
  pow(x::Float32, y::Float32)::Float32 = sign_fast(x)*ccall(("powf",libm), Float32, (Float32,Float32), abs_fast(x), y)
18
  div(x::Float32, y::Float32)::Float32 = div_float_fast(x, y)
 
13
  # Use some fast operators from https://github.com/JuliaLang/julia/blob/81597635c4ad1e8c2e1c5753fda4ec0e7397543f/base/fastmath.jl
14
  # Define allowed operators. Any julia operator can also be used.
15
  plus(x::Float32, y::Float32)::Float32 = add_float_fast(x, y) #Do not change the name of this operator.
16
+ sub(x::Float32, y::Float32)::Float32 = sub_float_fast(x, y) #Do not change the name of this operator.
17
  mult(x::Float32, y::Float32)::Float32 = mul_float_fast(x, y) #Do not change the name of this operator.
18
  pow(x::Float32, y::Float32)::Float32 = sign_fast(x)*ccall(("powf",libm), Float32, (Float32,Float32), abs_fast(x), y)
19
  div(x::Float32, y::Float32)::Float32 = div_float_fast(x, y)
pysr/sr.py CHANGED
@@ -17,6 +17,7 @@ sympy_mappings = {
17
  'div': lambda x, y : x/y,
18
  'mult': lambda x, y : x*y,
19
  'plus': lambda x, y : x + y,
 
20
  'neg': lambda x : -x,
21
  'pow': lambda x, y : sympy.sign(x)*abs(x)**y,
22
  'cos': lambda x : sympy.cos(x),
 
17
  'div': lambda x, y : x/y,
18
  'mult': lambda x, y : x*y,
19
  'plus': lambda x, y : x + y,
20
+ 'sub': lambda x, y : x - y,
21
  'neg': lambda x : -x,
22
  'pow': lambda x, y : sympy.sign(x)*abs(x)**y,
23
  'cos': lambda x : sympy.cos(x),