Giter Site home page Giter Site logo

rl_tile_encoding's Introduction

rl_tile_encoding

Tile encoding for reinforcement learning Q value function approximation

This repository implements TD(lambda) algorithm using CMAC tiling as a linear function approximation. It also includes SARSA and Qlearning implementation, tested on the mountain car example. The CMAC tiling is based on code written by Sridhar Mahadevan and Richard Sutton, with few modifications. Code can be found here - http://webdocs.cs.ualberta.ca/~sutton/MountainCar/MountainCar.html ("Mahadevan's earlier C++ version w/ X11") Additional details can be found in Sutton & Barto. The implementation itself is very straight forward, once the idea is clear.

Starting condition:

  • we have a set of continuous variables.
  • tabular Q learning may take too much memory and/or the discretization will degrade learning.
  • we want to be able generalize between states.

Algorithm:

  • decide on binning of the continuous variables
  • for each variable, set up N tiles
  • each tile will have different offset. The offset will be a number between 0 and the size of the variable bin.
  • a state is represented by a tile.

Function approximation:

  • assuming that we have N variables (V0.. VN-1), each has Bi bins, T tiles, and A actions, we will have a total of sum(Bi,i=1..N-1) * T * A functions.

Example:

  • a single continuous variable ranging from 0.3 .. 2.0. We want to have 13 bins and 3 tiles.

  • size of each bin is (2.0 - 0.3) / 13 = 0.13

  • set a (random) offset per tile. e.g.

    • offset(tile0) = 0 * 0.13
    • offset(tile1) = 0.4 * 0.13
    • offset(tile2) = 0.8 * 0.13
  • for a value of 0.99 for the continuous variable, here is the value for each tile:

    • tile0: int((0.99 - 0.3 - 0 * 0.13) / 0.13) = 5
    • tile1: int((0.99 - 0.3 - 0.4 * 0.13) / 0.13) = 4
    • tile2: int((0.99 - 0.3 - 0.8 * 0.13) / 0.13) = 4
  • Note that having a single tile (N=1) is identical to tabular based method.

rl_tile_encoding's People

Contributors

aiziky avatar yaizik 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.