All Projects → AI4Finance-LLC → Elegantrl

AI4Finance-LLC / Elegantrl

Licence: other
Lightweight, efficient and stable implementations of deep reinforcement learning algorithms using PyTorch.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Elegantrl

ElegantRL
Scalable and Elastic Deep Reinforcement Learning Using PyTorch. Please star. 🔥
Stars: ✭ 2,074 (+260.7%)
Mutual labels:  lightweight, efficient, stable, dqn, ddpg, ppo
Minimalrl
Implementations of basic RL algorithms with minimal lines of codes! (pytorch based)
Stars: ✭ 2,051 (+256.7%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo, ddpg
Deep Reinforcement Learning
Repo for the Deep Reinforcement Learning Nanodegree program
Stars: ✭ 4,012 (+597.74%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo, ddpg
Pytorch Drl
PyTorch implementations of various Deep Reinforcement Learning (DRL) algorithms for both single agent and multi-agent.
Stars: ✭ 233 (-59.48%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo, ddpg
Easy Rl
强化学习中文教程,在线阅读地址:https://datawhalechina.github.io/easy-rl/
Stars: ✭ 3,004 (+422.43%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo, ddpg
Deeprl Tensorflow2
🐋 Simple implementations of various popular Deep Reinforcement Learning algorithms using TensorFlow2
Stars: ✭ 319 (-44.52%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo, ddpg
Autonomous Learning Library
A PyTorch library for building deep reinforcement learning agents.
Stars: ✭ 425 (-26.09%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo, ddpg
Reinforcement Learning
🤖 Implements of Reinforcement Learning algorithms.
Stars: ✭ 104 (-81.91%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ddpg
Machin
Reinforcement learning library(framework) designed for PyTorch, implements DQN, DDPG, A2C, PPO, SAC, MADDPG, A3C, APEX, IMPALA ...
Stars: ✭ 145 (-74.78%)
Mutual labels:  reinforcement-learning, dqn, ppo, ddpg
Pytorch Rl
This repository contains model-free deep reinforcement learning algorithms implemented in Pytorch
Stars: ✭ 394 (-31.48%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ddpg
Slm Lab
Modular Deep Reinforcement Learning framework in PyTorch. Companion library of the book "Foundations of Deep Reinforcement Learning".
Stars: ✭ 904 (+57.22%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo
Deep-Reinforcement-Learning-With-Python
Master classic RL, deep RL, distributional RL, inverse RL, and more using OpenAI Gym and TensorFlow with extensive Math
Stars: ✭ 222 (-61.39%)
Mutual labels:  deep-reinforcement-learning, dqn, ddpg, ppo
Reinforcement Learning Algorithms
This repository contains most of pytorch implementation based classic deep reinforcement learning algorithms, including - DQN, DDQN, Dueling Network, DDPG, SAC, A2C, PPO, TRPO. (More algorithms are still in progress)
Stars: ✭ 426 (-25.91%)
Mutual labels:  deep-reinforcement-learning, dqn, ppo, ddpg
Rlgraph
RLgraph: Modular computation graphs for deep reinforcement learning
Stars: ✭ 272 (-52.7%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo
Mushroom Rl
Python library for Reinforcement Learning.
Stars: ✭ 442 (-23.13%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ddpg
Torchrl
Pytorch Implementation of Reinforcement Learning Algorithms ( Soft Actor Critic(SAC)/ DDPG / TD3 /DQN / A2C/ PPO / TRPO)
Stars: ✭ 90 (-84.35%)
Mutual labels:  reinforcement-learning, dqn, ppo, ddpg
Deeprl
Modularized Implementation of Deep RL Algorithms in PyTorch
Stars: ✭ 2,640 (+359.13%)
Mutual labels:  deep-reinforcement-learning, dqn, ppo, ddpg
Reinforcement Learning With Tensorflow
Simple Reinforcement learning tutorials, 莫烦Python 中文AI教学
Stars: ✭ 6,948 (+1108.35%)
Mutual labels:  reinforcement-learning, dqn, ppo, ddpg
Rainy
☔ Deep RL agents with PyTorch☔
Stars: ✭ 39 (-93.22%)
Mutual labels:  deep-reinforcement-learning, dqn, ddpg, ppo
Reinforcement Learning
Learn Deep Reinforcement Learning in 60 days! Lectures & Code in Python. Reinforcement Learning + Deep Learning
Stars: ✭ 3,329 (+478.96%)
Mutual labels:  reinforcement-learning, deep-reinforcement-learning, dqn, ppo

Lightweight, Efficient and Stable DRL Implementation Using PyTorch

Downloads Downloads Python 3.6 PyPI



ElegantRL is featured with lightweight, efficient and stable, for researchers and practitioners.

  • Lightweight: The core codes <1,000 lines (check elegantrl/tutorial), using PyTorch (train), OpenAI Gym (env), NumPy, Matplotlib (plot).

  • Efficient: performance is comparable with Ray RLlib.

  • Stable: as stable as Stable Baseline 3.

Model-free deep reinforcement learning (DRL) algorithms:

  • DDPG, TD3, SAC, A2C, PPO, PPO(GAE) for continuous actions
  • DQN, DoubleDQN, D3QN for discrete actions

For algorithm details, please check out OpenAI Spinning Up.

Table of Contents

News

File Structure

File_structure

-----kernel file----

  • elegantrl/net.py # Neural networks.
    • Q-Net,
    • Actor Network,
    • Critic Network,
  • elegantrl/agent.py # RL algorithms.
    • AgentBase
  • elegantrl/run.py # run DEMO 1 ~ 4
    • Parameter initialization,
    • Training loop,
    • Evaluator.

-----utils file----

  • elegantrl/env.py # gym env or custom env, including FinanceStockEnv.
    • A PreprocessEnv class for gym-environment modification.
    • A self-created stock trading environment as an example for user customization.
  • Example_BipedalWalker.ipynb # BipedalWalker-v2 in jupyter notebooks
  • ElegantRL_Demo.ipynb # Demo 1~ 4 in jupyter notebooks. Tell you how to use tutorial version and advanced version.
  • ElegantRL_SingleFilePPO.py # Use single file to train PPO, more simple than tutorial version

As a high-level overview, the relations among the files are as follows. Initialize an environment in Env.py and an agent in Agent.py. The agent is constructed with Actor and Critic networks in Net.py. In each training step in Run.py, the agent interacts with the environment, generating transitions that are stored into a Replay Buffer. Then, the agent fetches transitions from the Replay Buffer to train its networks. After each update, an evaluator evaluates the agent's performance and saves the agent if the performance is good.

Training Pipeline

Initialization:

  • hyper-parameters args.
  • env = PreprocessEnv() : creates an environment (in the OpenAI gym format).
  • agent = agent.XXX() : creates an agent for a DRL algorithm.
  • evaluator = Evaluator() : evaluates and stores the trained model.
  • buffer = ReplayBuffer() : stores the transitions.

Then, the training process is controlled by a while-loop:

  • agent.explore_env(…): the agent explores the environment within target steps, generates transitions, and stores them into the ReplayBuffer.
  • agent.update_net(…): the agent uses a batch from the ReplayBuffer to update the network parameters.
  • evaluator.evaluate_save(…): evaluates the agent's performance and keeps the trained model with the highest score.

The while-loop will terminate when the conditions are met, e.g., achieving a target score, maximum steps, or manually breaks.

Experimental Results

Results using ElegantRL

LunarLanderContinuous-v2

LunarLanderTwinDelay3

BipedalWalkerHardcore-v2

BipedalWalkerHardcore is a difficult task in continuous action space. There are only a few RL implementations can reach the target reward.

Check out a video on bilibili: Crack the BipedalWalkerHardcore-v2 with total reward 310 using IntelAC.

Requirements

Necessary:
| Python 3.6+     | For multiprocessing Python build-in library.          
| PyTorch 1.6+    | pip3 install torch   

Not necessary:
| Numpy 1.18+     | For ReplayBuffer. Numpy will be installed along with PyTorch.
| gym 0.17.0      | For RL training env. Gym provides tutorial env for DRL training. (env.render() bug in gym==1.18 pyglet==1.6. Change to gym==1.17.0, pyglet==1.5)
| pybullet 2.7+   | For RL training env. We use PyBullet (free) as an alternative of MuJoCo (not free).
| box2d-py 2.3.8  | For gym. Use pip install Box2D (instead of box2d-py)
| matplotlib 3.2  | For plots. Evaluate the agent performance.

pip3 install gym==1.17.0 pybullet Box2D matplotlib
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].