Giter Club home page Giter Club logo

reinforcement-learning's Introduction

Overview

Implement reinforcement learning algorithm to find policies for frozenlake environment.

Reinforcement learning algorithms implemented:

  1. Model based tabular algorithms:
    • Policy iteration
    • Value iteration
    • Policy improvement
  2. Model free tabular algorithms:
    • SARSA control
    • Q-learning control
  3. Model free non-tabular algorithms:
    • SARSA control with Linear function approximation
    • Q-learning with Linear function approximation

Requirements

Unzip the folder, cd onto the project directory and run pip install -r requirements.txt from terminal to install the required dependencies.

  • python version should be 3.7 or above
  • numpy version should be 1.19.2 or above
  • matplotlib version should be 3.3.2 or above

Execution

  • Run python main_implementation.py file to run the reinforcement learning algorithms on the environments.
  • Run python run_env.py file to manually run the small frozenlake environment.

Additional Information

Main implementation

  • small_lake_implementation() method in main_implementation.py displays the policy and values for the small frozenlake, comment out line 135 if you want to execute only for small frozenlake.
  • big_lake_implementation() method in main_implementation.py displays the policy and values for the big frozenlake, comment out line 136 if you want to execute only for big frozenlake.

Run environment

  • run_env.py runs the small frozenlake environment by default.
  • To manually run the big frozenlake environment, comment line 85 and uncomment line 86

Data Collector

  • Data collector is used to visualize the convergence of the algorithms.
  • It computes mean squared error for value when compared to optimal value.
  • It computes the classification error for policy when compared to optimal policy.
  • It has been commented out as it affects performance. Follow the below instructions to use data collector.
Add below to the algorithm to store the error for visualization.
    
    DataCollectorSingleton.instance().calculate_error("Algorithm name", policy, value)
   
Add the below to the main_implementation.py to visualize the errors

before running algorithms:

    DataCollectorSingleton.instance().set_optimal_policy_value("env name", "env optimal policy value path <.npy file>")
    
after running algorithms:

    plot_errors(*DataCollectorSingleton.instance().get_errors()) 

Contributors

reinforcement-learning's People

Contributors

ofyildirim avatar sudiptamondal1802 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.