Reinforcement Learning Library.
Project description
rllib
Reinforcement Learning Library
Installation
pip install pytorch-rllib
Usage
Implemented agents:
- CrossEntropy
- Value / Policy Iteration
- Q-Learning
- Expected Value SARSA
- DQN
- Rainbow
- REINFORCE
- A2C
import gym
import numpy as np
from rllib.qlearning import QLearningAgent
from rllib.trainer import Trainer
from rllib.utils import set_global_seed
# make environment
env = gym.make("Taxi-v3")
set_global_seed(seed=42, env=env)
n_actions = env.action_space.n
# make agent
agent = QLearningAgent(
alpha=0.5,
epsilon=0.25,
discount=0.99,
n_actions=n_actions,
)
# train
trainer = Trainer(env=env)
rewards = trainer.train(
agent=agent,
n_sessions=1000,
)
print(f"Mean reward: {np.mean(rewards[-10:])}") # Mean reward: 8.0
More examples you can find here.
Requirements
Python >= 3.7
Citation
If you use rllib in a scientific publication, we would appreciate references to the following BibTex entry:
@misc{dayyass2022rllib,
author = {El-Ayyass, Dani},
title = {Reinforcement Learning Library},
howpublished = {\url{https://github.com/dayyass/rllib}},
year = {2022}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytorch-rllib-0.1.1.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file pytorch-rllib-0.1.1.tar.gz
.
File metadata
- Download URL: pytorch-rllib-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 184ab3c77afe424e1249b20bb6d6e6a75b2af61d8526f63bb9fb5eba165fd9fc |
|
MD5 | 706c1cf97b1def3e53f592771dcbcbd6 |
|
BLAKE2b-256 | 4623693e8a37b1bee9c4581d229a89ee61fffa8540b446b717b5184222f56202 |
File details
Details for the file pytorch_rllib-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pytorch_rllib-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8116b4dffb44e80d49e4a49b4e27c83bfeaf30faf5876fd336bae4027e4671d |
|
MD5 | 660ff46acdfcb85b156b8c40d880b76f |
|
BLAKE2b-256 | d19f67cabd3fc0e62ba4442faba498ccd16c2f6be3cf37495fb830a49a61752b |