Spaces:
Running
Running
Commit
·
2f6f790
1
Parent(s):
7b70a53
Calculate running average of speed
Browse files- julia/sr.jl +11 -2
julia/sr.jl
CHANGED
|
@@ -768,6 +768,7 @@ function fullRun(niterations::Integer;
|
|
| 768 |
last_print_time = time()
|
| 769 |
num_equations = 0.0
|
| 770 |
print_every_n_seconds = 5
|
|
|
|
| 771 |
|
| 772 |
for i=1:npopulations
|
| 773 |
# Start listening for each population to finish:
|
|
@@ -857,10 +858,18 @@ function fullRun(niterations::Integer;
|
|
| 857 |
end
|
| 858 |
sleep(1e-3)
|
| 859 |
elapsed = time() - last_print_time
|
| 860 |
-
if
|
|
|
|
| 861 |
# Dominating pareto curve - must be better than all simpler equations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 862 |
@printf("\n")
|
| 863 |
-
@printf("Cycles per second: %.3e\n", round(
|
| 864 |
@printf("Hall of Fame:\n")
|
| 865 |
@printf("-----------------------------------------\n")
|
| 866 |
@printf("%-10s %-8s %-8s %-8s\n", "Complexity", "MSE", "Score", "Equation")
|
|
|
|
| 768 |
last_print_time = time()
|
| 769 |
num_equations = 0.0
|
| 770 |
print_every_n_seconds = 5
|
| 771 |
+
equation_speed = Float32[]
|
| 772 |
|
| 773 |
for i=1:npopulations
|
| 774 |
# Start listening for each population to finish:
|
|
|
|
| 858 |
end
|
| 859 |
sleep(1e-3)
|
| 860 |
elapsed = time() - last_print_time
|
| 861 |
+
#Update if time has passed, and some new equations generated.
|
| 862 |
+
if elapsed > print_every_n_seconds && num_equations > 0.0
|
| 863 |
# Dominating pareto curve - must be better than all simpler equations
|
| 864 |
+
current_speed = num_equations/elapsed
|
| 865 |
+
average_over_m_measurements = 10 #for print_every...=5, this gives 50 second running average
|
| 866 |
+
push!(equation_speed, current_speed)
|
| 867 |
+
if length(equation_speed) > average_over_m_measurements
|
| 868 |
+
deleteat!(equation_speed, 1)
|
| 869 |
+
end
|
| 870 |
+
average_speed = sum(equation_speed)/length(equation_speed)
|
| 871 |
@printf("\n")
|
| 872 |
+
@printf("Cycles per second: %.3e\n", round(average_speed, sigdigits=3))
|
| 873 |
@printf("Hall of Fame:\n")
|
| 874 |
@printf("-----------------------------------------\n")
|
| 875 |
@printf("%-10s %-8s %-8s %-8s\n", "Complexity", "MSE", "Score", "Equation")
|