MilesCranmer commited on
Commit
00136f0
1 Parent(s): f6dcb74

Print average speed of cycles

Browse files
Files changed (2) hide show
  1. README.md +3 -3
  2. julia/sr.jl +7 -0
README.md CHANGED
@@ -227,9 +227,7 @@ pd.DataFrame, Results dataframe, giving complexity, MSE, and equations
227
 
228
  # TODO
229
 
230
- - [ ] Print out speed of equation evaluation over time. Measure time it takes per
231
- - [ ] Refresh screen rather than dumping to stdout
232
- - [ ] Add ability to pass an operator as an anonymous function string. E.g., `binary_operators=["g(x, y) = x+y"]`.
233
  - [ ] Test suite
234
  - [ ] Add ability to save state from python
235
  - [ ] Add true multi-node processing, with MPI, or just file sharing. Multiple populations per core.
@@ -250,6 +248,8 @@ pd.DataFrame, Results dataframe, giving complexity, MSE, and equations
250
  - Current most expensive operations:
251
  - [ ] Calculating the loss function - there is duplicate calculations happening.
252
  - [x] Declaration of the weights array every iteration
 
 
253
  - [x] Add error bar capability (thanks Johannes Buchner for suggestion)
254
  - [x] Why don't the constants continually change? It should optimize them every time the equation appears.
255
  - Restart the optimizer to help with this.
 
227
 
228
  # TODO
229
 
230
+ - [ ] Refresh screen rather than dumping to stdout?
 
 
231
  - [ ] Test suite
232
  - [ ] Add ability to save state from python
233
  - [ ] Add true multi-node processing, with MPI, or just file sharing. Multiple populations per core.
 
248
  - Current most expensive operations:
249
  - [ ] Calculating the loss function - there is duplicate calculations happening.
250
  - [x] Declaration of the weights array every iteration
251
+ - [x] Print out speed of equation evaluation over time. Measure time it takes per cycle
252
+ - [x] Add ability to pass an operator as an anonymous function string. E.g., `binary_operators=["g(x, y) = x+y"]`.
253
  - [x] Add error bar capability (thanks Johannes Buchner for suggestion)
254
  - [x] Why don't the constants continually change? It should optimize them every time the equation appears.
255
  - Restart the optimizer to help with this.
julia/sr.jl CHANGED
@@ -755,6 +755,7 @@ function fullRun(niterations::Integer;
755
 
756
  for k=1:niterations
757
  # Spawn threads to run indepdent evolutions, then gather them
 
758
  @inbounds Threads.@threads for i=1:nthreads
759
  allPops[i] = run(allPops[i], ncyclesperiteration, verbosity=verbosity)
760
  for j=1:allPops[i].n
@@ -768,6 +769,10 @@ function fullRun(niterations::Integer;
768
  end
769
  bestSubPops[i] = bestSubPop(allPops[i], topn=topn)
770
  end
 
 
 
 
771
 
772
  # Get best 10 models from each evolution. Copy because we re-assign later.
773
  # bestPops = deepcopy(Population([member for pop in allPops for member in bestSubPop(pop).members]))
@@ -787,6 +792,8 @@ function fullRun(niterations::Integer;
787
  # Dominating pareto curve - must be better than all simpler equations
788
  dominating = PopMember[]
789
  open(hofFile, "w") do io
 
 
790
  debug(verbosity, "Hall of Fame:")
791
  debug(verbosity, "-----------------------------------------")
792
  debug(verbosity, "Complexity \t MSE \t Equation")
 
755
 
756
  for k=1:niterations
757
  # Spawn threads to run indepdent evolutions, then gather them
758
+ start_time = time()
759
  @inbounds Threads.@threads for i=1:nthreads
760
  allPops[i] = run(allPops[i], ncyclesperiteration, verbosity=verbosity)
761
  for j=1:allPops[i].n
 
769
  end
770
  bestSubPops[i] = bestSubPop(allPops[i], topn=topn)
771
  end
772
+ total_time = time() - start_time
773
+
774
+ number_equations_created = ncyclesperiteration * nthreads * npop / ns
775
+ equations_created_per_second = number_equations_created / total_time
776
 
777
  # Get best 10 models from each evolution. Copy because we re-assign later.
778
  # bestPops = deepcopy(Population([member for pop in allPops for member in bestSubPop(pop).members]))
 
792
  # Dominating pareto curve - must be better than all simpler equations
793
  dominating = PopMember[]
794
  open(hofFile, "w") do io
795
+ debug(verbosity, "\n")
796
+ debug(verbosity, "Total cycles per second: $(round(Int, equations_created_per_second, sigdigits=3))\n")
797
  debug(verbosity, "Hall of Fame:")
798
  debug(verbosity, "-----------------------------------------")
799
  debug(verbosity, "Complexity \t MSE \t Equation")