Code Monkey home page Code Monkey logo

rlpractical's Introduction

RLPractical

This python library is meant to help the students choosing Reinforcement Learning in University of Edinburgh. Basic algorithms mentioned in the lecture or on the textbook would be implemented. Note: It's still an unstable version. API migh change later on. And Docs are still incompelte.

Clone this repo and install rlp.

git clone https://github.com/JZ95/RLPractical.git
cd RLPractical
python setup.py install

or use develop mode:

python setup.py develop

open python shell, and type the following command to test if install successfully

import rlp

Example

from rlp.envs import MultiArmedBandit
from rlp.agents import EpsGreedy

means = np.random.normal(0, 1, 10)               # assign mean rewards for 10 arms
stds = np.ones(10)                               # assign std for 10 arms
initQ = np.zeros(10)                         	 # assign inital action-value estimates Q0

bandit = MultiArmedBandit(k=10, means=means, stds=stds)
agent = EpsGreedy(eps=0.1, Q0=initQ)             # build eps(0.1)-greedy agent

# run agent 1000 timesteps
for _ in range(1000):
    At = agent.action()                          # agent selects action
    Rt = bandit.reward(At)                       # environment gives reward based on agent's action
    agent.get_reward(Rt)                         # agent reveives reward and updates status
    agent.update()

Run Notebooks

Please install jupyter first. After installing jupyter and rlp, open NoteBook Server.

jupyter notebook

Open an another shell and

cd notebooks

See the notebooks and have fun with tuning params.

ScreenShot

๐Ÿบ ENJOY!

rlpractical's People

Contributors

jz95 avatar

Watchers

James Cloos avatar Andrew Yao 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.