Giter Site home page Giter Site logo

mapaydar / spinning-up-a-pong-ai-with-deep-rl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mtrazzi/spinning-up-a-pong-ai-with-deep-rl

0.0 2.0 0.0 4.52 MB

Code for "Spinning Up a Pong AI With Deep RL" on FloydHub.

Home Page: https://blog.floydhub.com/spinning-up-with-deep-reinforcement-learning/

License: MIT License

Jupyter Notebook 55.74% Python 44.26%

spinning-up-a-pong-ai-with-deep-rl's Introduction

Spinning Up a Pong AI With Deep Reinforcement Learning

the hard-coded AI that only follows the ball (left) vs. our trained AI

Run on FloydHub

Note: These are the Jupyter Notebooks for my article Spinning Up a Pong AI With Deep Reinforcement Learning on FloydHub.

Within a few years, Deep Reinforcement Learning will completely transform robotics, an industry with the potential to automate 64 percent of manufacturing. Hard-to-engineer behaviors will become a piece of cake, so long as there are enough Deep RL practitioners to implement them.

The following notebooks (file ending with .ipynb) detail how to train a model in Keras that plays the game of Pong using simple Policy Gradient techniques:

Files overview

#Main notebooks
  |train.ipynb                             #Main notebook to train the Pong agent in Keras
  |train-with-log.ipynb                    #Same as above but with tensorflow logs and model saving/loading

#Demo notebooks
  |demo.ipynb                              #Simple notebook to generate a gif with a random model
  |demo_black_and_white.ipynb              #Same as above but generate the gif for the pre-processed frame diff

#Utils
  |support.py                              #To support the gif generation
  |easy_tf_log.py                          #Tool to easily plot variable
  |karpathy.py                             #Functions used in karpathy's original RL Pong post

#FloydHub specific  
  |floyd.yml                               #Tells what to execute when launching a job
  |floyd_requirements.txt                  #Necessary packages to install
  
#Trained weights
  |my_model_weights.h5                     #Saved weights after training
  

Demo of random agent

Gif generated with demo.ipynb:

random agent

Gif generated with demo_black_and_white.ipynb:

random agent

Pre-processed frames in black and white

Run the code on FloydHub

Run on FloydHub

Click the above blue button to open a Workspace on FloydHub where you will find the same environment.

Local

pip install keras gym jupyter
git clone https://github.com/mtrazzi/spinning-up-a-Pong-AI-with-deep-RL
cd spinning-up-a-Pong-AI-with-deep-RL
jupyter notebook

Go do the desired notebook, files that end with '.ipynb'. To run the model, go to the menu then click on Cell > Run all

Credits

spinning-up-a-pong-ai-with-deep-rl's People

Contributors

mtrazzi avatar

Watchers

James Cloos avatar Amin Paydar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.