Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
c3d54db
1
Parent(s):
d3b42d5
Add verbose printing option
Browse files- eureqa.jl +9 -1
- paralleleureqa.jl +1 -1
eureqa.jl
CHANGED
@@ -433,7 +433,8 @@ end
|
|
433 |
function run(
|
434 |
pop::Population,
|
435 |
ncycles::Int,
|
436 |
-
annealing::Bool=false
|
|
|
437 |
)::Population
|
438 |
pop = deepcopy(pop)
|
439 |
|
@@ -444,6 +445,13 @@ function run(
|
|
444 |
else
|
445 |
pop = regEvolCycle(pop, 1.0)
|
446 |
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
end
|
448 |
return pop
|
449 |
end
|
|
|
433 |
function run(
|
434 |
pop::Population,
|
435 |
ncycles::Int,
|
436 |
+
annealing::Bool=false;
|
437 |
+
verbose::Int=0
|
438 |
)::Population
|
439 |
pop = deepcopy(pop)
|
440 |
|
|
|
445 |
else
|
446 |
pop = regEvolCycle(pop, 1.0)
|
447 |
end
|
448 |
+
if verbose > 0 && (iT % verbose == 0)
|
449 |
+
# Get best 10 models from each evolution. Copy because we re-assign later.
|
450 |
+
bestPops = bestSubPop(pop)
|
451 |
+
bestCurScoreIdx = argmin([bestPops.members[member].score for member=1:bestPops.n])
|
452 |
+
bestCurScore = bestPops.members[bestCurScoreIdx].score
|
453 |
+
println(bestCurScore, " is the score for ", stringTree(bestPops.members[bestCurScoreIdx].tree))
|
454 |
+
end
|
455 |
end
|
456 |
return pop
|
457 |
end
|
paralleleureqa.jl
CHANGED
@@ -17,7 +17,7 @@ for k=1:niterations
|
|
17 |
|
18 |
# Spawn threads to run indepdent evolutions, then gather them
|
19 |
@inbounds Threads.@threads for i=1:nthreads
|
20 |
-
allPops[i] = run(allPops[i], ncyclesperiteration, annealing)
|
21 |
end
|
22 |
|
23 |
# Get best 10 models from each evolution. Copy because we re-assign later.
|
|
|
17 |
|
18 |
# Spawn threads to run indepdent evolutions, then gather them
|
19 |
@inbounds Threads.@threads for i=1:nthreads
|
20 |
+
allPops[i] = run(allPops[i], ncyclesperiteration, annealing, verbose=1000)
|
21 |
end
|
22 |
|
23 |
# Get best 10 models from each evolution. Copy because we re-assign later.
|