diff --git a/README.md b/README.md index 3ea6b25..9ed7573 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/load.npy b/load.npy index 1aa4acb..48247e2 100644 Binary files a/load.npy and b/load.npy differ diff --git a/train.py b/train.py index ce1d60b..36379e4 100644 --- a/train.py +++ b/train.py @@ -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)