Skip to main content

Reinforcement Learning Library.

Project description

rllib

Reinforcement Learning Library.

Installation

pip install pytorch-rllib

Usage

Implemented agents:

  • CrossEntropy
  • Value / Policy Iteration
  • Q-Learning
  • 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.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

pytorch_rllib-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pytorch-rllib-0.1.0.tar.gz.

File metadata

  • Download URL: pytorch-rllib-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.5

File hashes

Hashes for pytorch-rllib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5aeedd84cba5e5001808d5b233b35cd2c736121eab5d89800b5ec4fbc124ea20
MD5 edbf11e7f94c57749f0d6d1d8f0210fc
BLAKE2b-256 a1f609c34becb462fbdf5edbaa82c4069e9c10f3a16707416a960205cee9eae7

See more details on using hashes here.

File details

Details for the file pytorch_rllib-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytorch_rllib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df230928a0c404c65960e6090b849688eb4f6e12e1501d6dd3affb78b5dbe32c
MD5 0bf17365dbcd45e6c036653b97f0a4b9
BLAKE2b-256 5853d0a0395c12283c0eb85d13141b705e03af17744021b9e50adb5f2632946e

See more details on using hashes here.

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