Giter VIP home page Giter VIP logo

deep-rl-mountain-car's Introduction

#Deep RL - Mountain Car Domain This is my implementation of Mountain Car domain in reinforcement learning using neural network function approximation with Keras Deep Learning Library.
To the best of my knowledge, this is the first opensource code for solving Mountain Car RL problem using DQN.
I am motivated by this simple example of Keras playing catch
My code is adapted from the above incorporated with Mountain car domain.

DQN implementation

DQN implementation is based on the paper:
Mnih, V., Kavukcuoglu, K., Silver, D., Graves, A., Antonoglou, I., Wierstra, D., & Riedmiller, M. (2013). Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602.

Mountain Car Domain

Mountain car is standard platform for testing RL algorithms in which a underpowered car tries to reach a goal position uphill by moving to and fro the hill valley. The state space of the car is continuous and consist of its position and velocity. At every state, it can choose out of 3 possible actions -- move forward, backward or stay. Refer to this Wikipedia article for more information.

alt tag

The figure above (from Wikipedia) shows the problem, where car in starting position and star is the goal position.

Files

  1. MountainCar.py -- Define the class of Mountain Car environment - transition from one state to another given an action and returning reward.
  2. MCqlearn.py -- DQN implementation for Q-learning.
  3. MCtest.py -- Testing the learned policy.

Training

DQN is trained for 1000 successful episodes of the problem. The specific parameters of the algorithm are given in the MCqlearn.py file. To train the DQN network, symply run the training file:

python MCqlearn.py

After training, the network parameters are stored in .json and .h5 file.

Testing

Once the network is trained and parameters are saved in .json and .h5 file, testing can be done. To test the network, run the file:

python MCqtest.py

The initial state and other parameters of Mountain Car domain can be set up in this file.
It is interesting to note that though the network is trained only for one initial state and one range of Mountain Car domain, it is able to generalize and success during testing for arbitrary initial states and range of the domain.

Dependencies

  1. Python3
  2. Keras
  3. Numpy

deep-rl-mountain-car's People

Contributors

vikasjiitk 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.