Git Product home page Git Product logo

-.class-prototype.-q_learning's Introduction

-.CLASS-PROTOTYPE.-Q_Learning

Requirements

  • Python Mode for Processing 3 by Jonathan Feinberg

Description

Q Learning algorithm developed for the class of cognitive and adaptive agents.

It simulates an agent moving through the board, measuring the utility and policy of every state that it move on.

Using Q(s,a) <- Q(s,a) + alpha[r + gama * max(Q(s+1,a)) - Q(s,a)] to calculate the utility

System after the auto interaction

How to use

It has two modes, one that it is manually moved, and other that it moves seeking for the highest utility value, to get to the terminal state, and both can be used simultaneously.

Press "W" to move up, "D" to move right, "S" to move down and "A" to move left.

Press the space bar to run it automatically until it finds the terminal states.

Press "R" to restart the board, utilities and agent.

The QLearning class has some parameters.

QLearning( r, d, ui_width, ui_height, dI, dJ ,rows = 3, cols = 2, a = 0.5, g = 0.8)

  • r : Is the immediate reward of the movement
  • d : Is the punishment to when the agent hits the wall
  • ui_width : Is the width value where the board will be draw
  • ui_height : Is the height value where the board will be draw
  • dI : Is the initial "i" position of the agent and can not be greater than the number of rows
  • dJ : Is the initial "j" position of the agent and can not be greater than the number of columns
  • rows : Is the number of rows of the board, by default it is 3
  • cols : Is the number of columns of the board, by default it is 2
  • a : Alpha is the learning rate, by default it is 0.5
  • g : Gama is the discount factor, by default it is 0.8

To set a state to be terminal, it has to be done in the QLearning.gridInit() method, by invoking the setTerminal() method of the cell you want to be a terminal

-.class-prototype.-q_learning's People

Contributors

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