GithubHelp home page GithubHelp logo

gefgu / dqn_mountain_car Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 591 KB

In this project, I created a Deep Q-Learning that reaches the goal of the Mountain Car Game.

License: MIT License

Python 100.00%
openai-gym dqn pytorch python machine-learning reinforcement-learning reinforcement-learning-algorithms

dqn_mountain_car's Introduction

DQN Model Playing The Mountain Car Game

Gif Of Model after being trained for 1 million frames

Introduction

In this project, I created a Deep Q-Learning that reaches the goal of the Mountain Car Game. It trained for 1 million steps and reached the result you see above.

Installation

These steps helps you install OpenAi Gym in a Windows Environment. If this isn't your case, you can follow a similar approach suited to your OS.

These steps are based on this tutorial

Install Microsoft Visual C++ Build Tools for Visual Studio 2019 here:

Screenshot showing here to download the Build Tools for Visual Studio 2019

Using conda, create an env.

conda create -n env_name python=3.8 pip
conda activate env_name

Then, install the necessary packages:

Minimum install of OpenAI Gym:

pip install gym

Package to run the ToyText Environments:

conda install pystan

To run the Atari environments:

pip install -f https://github.com/Kojoley/atari-py/releases atari_py

To run the Box2D environments:

conda install swig
pip install Box2D

To generate the .gif files:

pip install moviepy

To run the tests:

pip install pytest

Install Pytorch here.

Install Xming to display your model playing the environments.

Usage

You can train a model, view a model in action, and generate a gif directly from the command-line:

Trains a model using the hyperparameters defined on src/config.py. You can also specify a model_name as an argument (should include the extension ".pt").

python -m src.train -model_name my_model.pt

View a model in action. You can specify the model_name (it should be one from the models folder). Must have Xming installed on your computer.

python -m src.show_model -model_name my_model.pt

Generate Gif. You can specify the model_name (it should be one from the models folder) and the name of the gif file (should include the extension ".gif").

python -m src.generate_gif -model_name my_model.pt -gif_name my_gif.gif

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Questions?

Send me a message at: https://www.linkedin.com/in/gustavobruno-developer/

License

MIT

dqn_mountain_car's People

Stargazers

 avatar  avatar  avatar

Watchers

 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.