Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
311797d
1
Parent(s):
3336e27
Fix issue with empty hall of fame
Browse files- benchmark.jl +7 -3
- eureqa.jl +1 -1
- paralleleureqa.jl +3 -3
benchmark.jl
CHANGED
@@ -6,14 +6,17 @@ fullRun(3,
|
|
6 |
annealing=true,
|
7 |
ncyclesperiteration=100,
|
8 |
fractionReplaced=0.1f0,
|
9 |
-
verbosity=0
|
|
|
|
|
10 |
|
11 |
t = @benchmark(fullRun(3,
|
12 |
npop=100,
|
13 |
annealing=true,
|
14 |
ncyclesperiteration=100,
|
15 |
fractionReplaced=0.1f0,
|
16 |
-
verbosity=0
|
|
|
17 |
), evals=10)
|
18 |
|
19 |
tnoanneal = @benchmark(fullRun(3,
|
@@ -21,7 +24,8 @@ tnoanneal = @benchmark(fullRun(3,
|
|
21 |
annealing=false,
|
22 |
ncyclesperiteration=100,
|
23 |
fractionReplaced=0.1f0,
|
24 |
-
verbosity=0
|
|
|
25 |
), evals=10)
|
26 |
|
27 |
println("The median time is $(median(t)) with annealing, $(median(tnoanneal)) without")
|
|
|
6 |
annealing=true,
|
7 |
ncyclesperiteration=100,
|
8 |
fractionReplaced=0.1f0,
|
9 |
+
verbosity=0,
|
10 |
+
topn=10
|
11 |
+
)
|
12 |
|
13 |
t = @benchmark(fullRun(3,
|
14 |
npop=100,
|
15 |
annealing=true,
|
16 |
ncyclesperiteration=100,
|
17 |
fractionReplaced=0.1f0,
|
18 |
+
verbosity=0,
|
19 |
+
topn=10
|
20 |
), evals=10)
|
21 |
|
22 |
tnoanneal = @benchmark(fullRun(3,
|
|
|
24 |
annealing=false,
|
25 |
ncyclesperiteration=100,
|
26 |
fractionReplaced=0.1f0,
|
27 |
+
verbosity=0,
|
28 |
+
topn=10
|
29 |
), evals=10)
|
30 |
|
31 |
println("The median time is $(median(t)) with annealing, $(median(tnoanneal)) without")
|
eureqa.jl
CHANGED
@@ -415,7 +415,7 @@ function bestOfSample(pop::Population)::PopMember
|
|
415 |
end
|
416 |
|
417 |
# Return best 10 examples
|
418 |
-
function bestSubPop(pop::Population; topn::
|
419 |
best_idx = sortperm([pop.members[member].score for member=1:pop.n])
|
420 |
return Population(pop.members[best_idx[1:topn]])
|
421 |
end
|
|
|
415 |
end
|
416 |
|
417 |
# Return best 10 examples
|
418 |
+
function bestSubPop(pop::Population; topn::Integer=10)::Population
|
419 |
best_idx = sortperm([pop.members[member].score for member=1:pop.n])
|
420 |
return Population(pop.members[best_idx[1:topn]])
|
421 |
end
|
paralleleureqa.jl
CHANGED
@@ -19,7 +19,7 @@ function fullRun(niterations::Integer;
|
|
19 |
ncyclesperiteration::Integer=3000,
|
20 |
fractionReplaced::Float32=0.1f0,
|
21 |
verbosity::Integer=0,
|
22 |
-
topn::
|
23 |
)
|
24 |
debug(verbosity, "Lets try to learn (x2^2 + cos(x3)) using regularized evolution from scratch")
|
25 |
debug(verbosity, "Running with $nthreads threads")
|
@@ -82,11 +82,11 @@ function fullRun(niterations::Integer;
|
|
82 |
end
|
83 |
|
84 |
# Hall of fame migration
|
85 |
-
if hofMigration
|
86 |
for j=1:nthreads
|
87 |
for k in rand(1:npop, Integer(npop*fractionReplacedHof))
|
88 |
# Copy in case one gets used twice
|
89 |
-
allPops[j].members[k] = deepcopy(dominating[rand(
|
90 |
end
|
91 |
end
|
92 |
end
|
|
|
19 |
ncyclesperiteration::Integer=3000,
|
20 |
fractionReplaced::Float32=0.1f0,
|
21 |
verbosity::Integer=0,
|
22 |
+
topn::Integer=10
|
23 |
)
|
24 |
debug(verbosity, "Lets try to learn (x2^2 + cos(x3)) using regularized evolution from scratch")
|
25 |
debug(verbosity, "Running with $nthreads threads")
|
|
|
82 |
end
|
83 |
|
84 |
# Hall of fame migration
|
85 |
+
if hofMigration && size(dominating)[1] > 0
|
86 |
for j=1:nthreads
|
87 |
for k in rand(1:npop, Integer(npop*fractionReplacedHof))
|
88 |
# Copy in case one gets used twice
|
89 |
+
allPops[j].members[k] = deepcopy(dominating[rand(1:size(dominating)[1])])
|
90 |
end
|
91 |
end
|
92 |
end
|