Skip to content
forked from jz95/RLPractical

Algorithm implements for lecture Reinforcement Learning in University of Edinburgh.

License

Notifications You must be signed in to change notification settings

yw10/RLPractical

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Algorithm implements for lecture Reinforcement Learning in University of Edinburgh.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 97.9%
  • Python 2.1%