This project compares three different approaches for beating Lunar Lander using OpenAI's Gym environment. Firstly, I have fit a range of typical machine learning models to a large dataset of expert players states (e.g. co-ordinartes, velocity & leg status) and actions (e.g. fire left, right, up or do nothing). Secondly, I have fit a CNN to a large dataset of expert players images (screenshots of live play) and actions (e.g. fire left, right, up or do nothing) which are stored as the last digit of the filename. Finally, I have trained a Deep Q-Learning model by allowing it to play for half a million steps of gameplay and rewarding based on its score.
All three approaches are saved and then analysed in a jupyter notebook.
Try the game yourself by running python play.py
!
LunarLanderStateVectors.csv
and thedata
folder contain the training data for the first two approaches respectively.states_model.ipynb
,images_model.ipynb
anddeepqlearning_model.ipynb
are the three notebooks in which the different approaches applied andevaluation.ipynb
is where the resulting performances are compared.task1.mod
,task2.mod
anddqn_LunarLander-v2_weights.h5f
are files containing the best performing models weights.lunar_lander_ml_images_player.py
,lunar_lander_ml_states_player.py
andlunar_lander_reinforcement_learning.py
are python files that play their respective models against the lunar lander game.
After cloning the repo simply run the following lines in terminal to unzip the (rather large) image data:
unzip data/data.zip
cd data; \rm -rf data*
Then run any of the .py
files to watch the different models attempt to beat the game or check out the ipynb
files to see the different training approaches and an evaluation of their performances.