-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathexperiment.py
More file actions
27 lines (25 loc) · 849 Bytes
/
experiment.py
File metadata and controls
27 lines (25 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Tournament play experiment."""
from __future__ import absolute_import
import net_builder
import gp
import cPickle
# Use cuda ?
CUDA_ = True
if __name__=='__main__':
# setup a tournament!
nb_evolution_steps = 10
tournament = \
gp.TournamentOptimizer(
population_sz=50,
init_fn=net_builder.randomize_network,
mutate_fn=net_builder.mutate_net,
nb_workers=3,
use_cuda=True)
for i in range(nb_evolution_steps):
print('\nEvolution step:{}'.format(i))
print('================')
tournament.step()
# keep track of the experiment results & corresponding architectures
name = "tourney_{}".format(i)
cPickle.dump(tournament.stats, open(name + '.stats','wb'))
cPickle.dump(tournament.history, open(name +'.pop','wb'))