Giter Site home page Giter Site logo

cartpole's Introduction

Cartpole

Reinforcement learning solution to the Cartpole environment from OpenAI gym.

This agent uses a Q-learning approach to learn how to balance the pole by moving the cart, given the horizontal position- and velocity of the cart in addition to the angle and angle velocity of the pole.

Installation

Clone the repository

git clone https://github.com/Agnar22/Cartpole.git

navigate into the project folder

cd Cartpole

install requirements

pip install -r requirements.txt

if everything went well, you should now be able to run the code

python3 Main.py

Motivation

This project served several purposes. I wanted to try out the entry level RL problem from OpenAI gym, Cartpole, as well as learn how to implement the suggested solution from scratch. Being familiar with Q-learning also has other advantages due to the applicability of this algorithm in the RL world; for instance, it may be applied to the other "Classic controll" problems from Open AI gym because it is a model-free algorithm that is able to handle stochastic transitions and rewards. Additionally, it is a precursor of Deep Q-networks, thus it is fundamental to have a certain understanding of Q-learning before moving onwards to DQN.

Results

The problem is easily solvable with q-learning, as demonstrated above (episodes from various parts of the training are shown). It needed about 3000 episodes to reach the final fitness where it perfectly balances the pole in the middle of the screen (wait until the end of the gif).

Other resources

cartpole's People

Contributors

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