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 hashes)
Built Distribution
Close
Hashes for pytorch_rllib-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8116b4dffb44e80d49e4a49b4e27c83bfeaf30faf5876fd336bae4027e4671d |
|
MD5 | 660ff46acdfcb85b156b8c40d880b76f |
|
BLAKE2b-256 | d19f67cabd3fc0e62ba4442faba498ccd16c2f6be3cf37495fb830a49a61752b |