Skip to main content

Reinforcement Learning Library.

Project description

tests linter codecov

python 3.7 release (latest by date) license

pre-commit code style: black

pypi version pypi downloads

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


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)

Uploaded Source

Built Distribution

pytorch_rllib-0.1.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page