Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
2b01937
1
Parent(s):
8cfda07
Add printing of score function from 2006.11287
Browse files- README.md +2 -0
- julia/sr.jl +17 -6
README.md
CHANGED
@@ -272,6 +272,8 @@ pd.DataFrame, Results dataframe, giving complexity, MSE, and equations
|
|
272 |
- [x] Rename package to avoid trademark issues
|
273 |
- PySR?
|
274 |
- [x] Put on PyPI
|
|
|
|
|
275 |
- [ ] Use @fastmath
|
276 |
- [ ] Refresh screen rather than dumping to stdout?
|
277 |
- [ ] Test suite
|
|
|
272 |
- [x] Rename package to avoid trademark issues
|
273 |
- PySR?
|
274 |
- [x] Put on PyPI
|
275 |
+
- [x] Treat baseline as a solution.
|
276 |
+
- [x] Print score alongside MSE: \delta \log(MSE)/\delta \log(complexity)
|
277 |
- [ ] Use @fastmath
|
278 |
- [ ] Refresh screen rather than dumping to stdout?
|
279 |
- [ ] Test suite
|
julia/sr.jl
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import Optim
|
|
|
2 |
|
3 |
const maxdegree = 2
|
4 |
const actualMaxsize = maxsize + maxdegree
|
@@ -844,11 +845,16 @@ function fullRun(niterations::Integer;
|
|
844 |
elapsed = time() - last_print_time
|
845 |
if elapsed > print_every_n_seconds
|
846 |
# Dominating pareto curve - must be better than all simpler equations
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
|
|
|
|
|
|
|
|
|
|
852 |
for size=1:actualMaxsize
|
853 |
if hallOfFame.exists[size]
|
854 |
member = hallOfFame.members[size]
|
@@ -856,7 +862,12 @@ function fullRun(niterations::Integer;
|
|
856 |
numberSmallerAndBetter = sum([curMSE > MSE(evalTreeArray(hallOfFame.members[i].tree), y) for i=1:(size-1)])
|
857 |
betterThanAllSmaller = (numberSmallerAndBetter == 0)
|
858 |
if betterThanAllSmaller
|
859 |
-
|
|
|
|
|
|
|
|
|
|
|
860 |
end
|
861 |
end
|
862 |
end
|
|
|
1 |
import Optim
|
2 |
+
using Printf
|
3 |
|
4 |
const maxdegree = 2
|
5 |
const actualMaxsize = maxsize + maxdegree
|
|
|
845 |
elapsed = time() - last_print_time
|
846 |
if elapsed > print_every_n_seconds
|
847 |
# Dominating pareto curve - must be better than all simpler equations
|
848 |
+
@printf("\n")
|
849 |
+
@printf("Cycles per second: %.3e\n", round(num_equations/elapsed, sigdigits=3))
|
850 |
+
@printf("Hall of Fame:\n")
|
851 |
+
@printf("-----------------------------------------\n")
|
852 |
+
@printf("%-10s %-8s %-8s %-8s\n", "Complexity", "MSE", "Score", "Equation")
|
853 |
+
curMSE = baselineSSE ./ len
|
854 |
+
@printf("%-10d %-5.3e %-8s %-.f\n", 0, curMSE, "NaN", avgy)
|
855 |
+
lastMSE = curMSE
|
856 |
+
lastComplexity = size
|
857 |
+
|
858 |
for size=1:actualMaxsize
|
859 |
if hallOfFame.exists[size]
|
860 |
member = hallOfFame.members[size]
|
|
|
862 |
numberSmallerAndBetter = sum([curMSE > MSE(evalTreeArray(hallOfFame.members[i].tree), y) for i=1:(size-1)])
|
863 |
betterThanAllSmaller = (numberSmallerAndBetter == 0)
|
864 |
if betterThanAllSmaller
|
865 |
+
delta_c = size - lastComplexity
|
866 |
+
delta_l_mse = log(curMSE) - log(lastMSE)
|
867 |
+
score = convert(Float32, -delta_l_mse/log(delta_c))
|
868 |
+
@printf("%-10d %-5.3e %-5.3e %-s\n" , size, curMSE, score, stringTree(member.tree))
|
869 |
+
lastMSE = curMSE
|
870 |
+
lastComplexity = size
|
871 |
end
|
872 |
end
|
873 |
end
|