fix: use a random seed to increase reproducibility

fix: mention training time
This commit is contained in:
Mahdi Dibaiee 2017-04-03 12:10:32 +04:30
parent 42bff3bbc7
commit 1b401f80e6
3 changed files with 4 additions and 2 deletions

View File

@ -3,10 +3,10 @@ Playing Flappy Bird using Evolution Strategies
After reading [Evolution Strategies as a Scalable Alternative to Reinforcement Learning](https://blog.openai.com/evolution-strategies/), I wanted to experiment something using Evolution Strategies, and Flappy Bird has always been one of my favorites when it comes to Game experiments. A simple yet challenging game.
The model learns to play very well after ~3000 iterations, but not completely flawless and it usually loses in difficult cases (high difference between two wall entrances).
The model learns to play very well after ~3000 epochs, but not completely flawless and it usually loses in difficult cases (high difference between two wall entrances).
Training process is pretty fast as there is no backpropagation, and is not very costy in terms of memory as there is no need to record actions as in policy gradients.
Here is a demonstration of the model after ~3000 iterations (less than an hour of training):
Here is a demonstration of the model after ~3000 epochs (~5 minutes on an Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz):
![after training](/demo/flappy-success.gif)

BIN
load.npy

Binary file not shown.

View File

@ -11,6 +11,8 @@ import os
es = EvolutionStrategy(fn=play, noisep=50, sigma=0.1, alpha=0.001, layer_sizes=[[4, 500], [500, 1]], input_size=4)
load = path.join(path.dirname(__file__), 'load.npy')
np.random.seed(0)
# if load.npy exists, load the parameters from it
if path.exists(load):
es.layers = np.load(load)