Awesome
Course in Deep Reinforcement Learning
Explore the combination of neural network and reinforcement learning. Algorithms and examples in Python & PyTorch
Have you heard about the amazing results achieved by Deepmind with AlphaGo Zero and by OpenAI in Dota 2? It's all about deep neural networks and reinforcement learning. Do you want to know more about it?
This is the right opportunity for you to finally learn Deep RL and use it on new and exciting projects and applications.
Here you'll find an in depth introduction to these algorithms. Among which you'll learn q learning, deep q learning, PPO, actor critic, and implement them using Python and PyTorch.
The ultimate aim is to use these general-purpose technologies and apply them to all sorts of important real world problems. Demis Hassabis
This repository contains:
<br><img align="left" src="images/youtube_social_icon_dark.png" alt="drawing" width="64"/> Lectures (& other content) primarily from DeepMind and Berkley Youtube's Channel.
<br><img align="left" src="images/GitHub-Mark-64px.png" alt="drawing" width="64"/> Algorithms (like DQN, A2C, and PPO) implemented in PyTorch and tested on OpenAI Gym: RoboSchool & Atari.
<br> <br>Stay tuned and follow me on and #60DaysRLChallenge
Now we have also a Slack channel. To get an invitation, email me at andrea.lonza@gmail.com. Also, email me if you have any idea, suggestion or improvement.
To learn Deep Learning, Computer Vision or Natural Language Processing check my 1-Year-ML-Journey
Before starting.. Prerequisites
- Basic level of Python and PyTorch
- Machine Learning
- Basic knowledge in Deep Learning (MLP, CNN and RNN)
Quick Note: my NEW BOOK is out!
To learn Reinforcement Learning and Deep RL more in depth, check out my book Reinforcement Learning Algorithms with Python!!
<a href="https://www.amazon.com/Reinforcement-Learning-Algorithms-Python-understand/dp/1789131111"> <img src="images/frontcover2.jpg" alt="drawing" width="350" align="right"/> </a>Table of Contents
- The Landscape of Reinforcement Learning
- Implementing RL Cycle and OpenAI Gym
- Solving Problems with Dynamic Programming
- Q learning and SARSA Applications
- Deep Q-Network
- Learning Stochastic and DDPG optimization
- TRPO and PPO implementation
- DDPG and TD3 Applications
- Model-Based RL
- Imitation Learning with the DAgger Algorithm
- Understanding Black-Box Optimization Algorithms
- Developing the ESBAS Algorithm
- Practical Implementation for Resolving RL Challenges
Index - Reinforcement Learning
- Week 1 - Introduction
- Week 2 - RL Basics
- Week 3 - Value based algorithms - DQN
- Week 4 - Policy gradient algorithms - REINFORCE & A2C
- Week 5 - Advanced Policy Gradients - PPO
- Week 6 - Evolution Strategies and Genetic Algorithms - ES
- Week 7 - Model-Based reinforcement learning - MB-MF
- Week 8 - Advanced Concepts and Project Of Your Choice
- Last 4 days - Review + Sharing
- Best resources
- Additional resources <br>
Week 1 - Introduction
- Why is Reinforcement Learning such an important learning method - A simple explanation
- Introduction and course overview - CS294 by Levine, Berkley
- Deep Reinforcement Learning: Pong from Pixels by Karpathy
Other Resources
- :books: The "Bible" of Reinforcement Learning: Chapter 1 - Sutton & Barto
- Great introductory paper: Deep Reinforcement Learning: An Overview
- Start coding: From Scratch: AI Balancing Act in 50 Lines of Python
Week 2 - RL Basics: MDP, Dynamic Programming and Model-Free Control
Those who cannot remember the past are condemned to repeat it - George Santayana
This week, we will learn about the basic blocks of reinforcement learning, starting from the definition of the problem all the way through the estimation and optimization of the functions that are used to express the quality of a policy or state.
Lectures - Theory <img align="right" src="images/youtube_social_icon_dark.png" alt="drawing" width="48"/>
- Markov Decision Process - David Silver (DeepMind)
- Markov Processes
- Markov Decision Processes
- Planning by Dynamic Programming - David Silver (DeepMind)
- Policy iteration
- Value iteration
- Model-Free Prediction - David Silver (DeepMind)
- Monte Carlo Learning
- Temporal Difference Learning
- TD(λ)
- Model-Free Control - David Silver (DeepMind)
- Ɛ-greedy policy iteration
- GLIE Monte Carlo Search
- SARSA
- Importance Sampling
Project of the Week - Q-learning <img align="right" src="images/GitHub-Mark-64px.png" alt="drawing" width="48"/>
Q-learning applied to FrozenLake - For exercise, you can solve the game using SARSA or implement Q-learning by yourself. In the former case, only few changes are needed.
Other Resources
- :books: The "Bible" of Reinforcement Learning: Chapters 3 and 4 - Sutton & Barto
- :tv: Value functions introduction - DRL UC Berkley by Sergey Levine
Week 3 - Value based algorithms - DQN
This week we'll learn more advanced concepts and apply deep neural network to Q-learning algorithms.
Lectures - Theory <img align="right" src="images/youtube_social_icon_dark.png" alt="drawing" width="48"/>
- Value functions approximation - David Silver (DeepMind)
- Differentiable function approximators
- Incremental methods
- Batch methods (DQN)
- Advanced Q-learning algorithms - Sergey Levine (UC Berkley)
- Replay Buffer
- Double Q-learning
- Continous actions (NAF,DDPG)
- Pratical tips
Project of the Week - DQN and variants <img align="right" src="images/GitHub-Mark-64px.png" alt="drawing" width="48"/>
<img align="left" src="Week3/imgs/pong_gif.gif" alt="drawing" width="200"/>DQN and some variants applied to Pong - This week the goal is to develop a DQN algorithm to play an Atari game. To make it more interesting I developed three extensions of DQN: Double Q-learning, Multi-step learning, Dueling networks and Noisy Nets. Play with them, and if you feel confident, you can implement Prioritized replay, Dueling networks or Distributional RL. To know more about these improvements read the papers!
<br clear="left"/>Papers
Must Read
- Playing Atari with Deep Reinforcement Learning - 2013
- Human-level control through deep reinforcement learning - 2015
- Rainbow: Combining Improvements in Deep Reinforcement Learning - 2017
Extensions of DQN
- Deep Reinforcement Learning with Double Q-learning - 2015
- Prioritized Experience Replay - 2015
- Dueling Network Architectures for Deep Reinforcement Learning - 2016
- Noisy networks for exploration - 2017
- Distributional Reinforcement Learning with Quantile Regression - 2017
Other Resources
- :books: The "Bible" of Reinforcement Learning: Chapters 5 and 6 - Sutton & Barto
- :tv: Deep Reinforcement Learning in the Enterprise: Bridging the Gap from Games to Industry
Week 4 - Policy gradient algorithms - REINFORCE & A2C
Week 4 introduce Policy Gradient methods, a class of algorithms that optimize directly the policy. Also, you'll learn about Actor-Critic algorithms. These algorithms combine both policy gradient (the actor) and value function (the critic).
Lectures - Theory <img align="right" src="images/youtube_social_icon_dark.png" alt="drawing" width="48"/>
- Policy gradient Methods - David Silver (DeepMind)
- Finite Difference Policy Gradient
- Monte-Carlo Policy Gradient
- Actor-Critic Policy Gradient
- Policy gradient intro - Sergey Levine (RECAP, optional)
- Policy Gradient (REINFORCE and Vanilla PG)
- Variance reduction
- Actor-Critic - Sergey Levine (More in depth)
- Actor-Critic
- Discout factor
- Actor-Critic algorithm design (batch mode or online)
- state-dependent baseline
Project of the Week - Vanilla PG and A2C <img align="right" src="images/GitHub-Mark-64px.png" alt="drawing" width="48"/>
Vanilla PG and A2C applied to CartPole - The exercise of this week is to implement a policy gradient method or a more sophisticated actor-critic. In the repository you can find an implemented version of PG and A2C. Bug Alert! Pay attention that A2C give me strange result. If you find the implementation of PG and A2C easy, you can try with the asynchronous version of A2C (A3C).
Papers
- Policy Gradient methods for reinforcement learning with function approximation
- Asynchronous Methods for Deep Reinforcement Learning
Other Resources
- :books: The "Bible" of Reinforcement Learning: Chapters 9 and 10 - Sutton & Barto
- :books: Intuitive RL: Intro to Advantage-Actor-Critic (A2C)
- :books: Asynchronous Actor-Critic Agents (A3C)
Week 5 - Advanced Policy Gradients - PPO
This week is about advanced policy gradient methods that improve the stability and the convergence of the "Vanilla" policy gradient methods. You'll learn and implement PPO, a RL algorithm developed by OpenAI and adopted in OpenAI Five.
Lectures - Theory <img align="right" src="images/youtube_social_icon_dark.png" alt="drawing" width="48"/>
- Advanced policy gradients - Sergey Levine (UC Berkley)
- Problems with "Vanilla" Policy Gradient Methods
- Policy Performance Bounds
- Monotonic Improvement Theory
- Algorithms: NPO, TRPO, PPO
- Natural Policy Gradients, TRPO, PPO - John Schulman (Berkey DRL Bootcamp) - (RECAP, optional)
- Limitations of "Vanilla" Policy Gradient Methods
- Natural Policy Gradient
- Trust Region Policy Optimization, TRPO
- Proximal Policy Optimization, PPO
Project of the Week - PPO <img align="right" src="images/GitHub-Mark-64px.png" alt="drawing" width="48"/>
<img align="left" src="Week5/imgs/walker_gif.gif" alt="drawing" width="300"/>PPO applied to BipedalWalker - This week, you have to implement PPO or TRPO. I suggest PPO given its simplicity (compared to TRPO). In the project folder Week5 you find an implementation of PPO that learn to play BipedalWalker. Furthermore, in the folder you can find other resources that will help you in the development of the project. Have fun!
<br clear="left"/>To learn more about PPO read the paper and take a look at the Arxiv Insights's video
Papers
Other Resources
- :books: To better understand PPO and TRPO: The Pursuit of (Robotic) Happiness
- :tv: Nuts and Bolts of Deep RL
- :books: PPO best practice: Training with Proximal Policy Optimization
- :tv: Explanation of the PPO algorithm by Arxiv Insights
Week 6 - Evolution Strategies and Genetic Algorithms - ES
In the last year, Evolution strategies (ES) and Genetic Algorithms (GA) has been shown to achieve comparable results to RL methods. They are derivate-free black-box algorithms that require more data than RL to learn but are able to scale up across thousands of CPUs. This week we'll look at this black-box algorithms.
Lectures & Articles - Theory <img align="right" src="images/youtube_social_icon_dark.png" alt="drawing" width="48"/>
- Evolution Strategies
- Genetic Algorithms
Project of the Week - ES <img align="right" src="images/GitHub-Mark-64px.png" alt="drawing" width="48"/>
<img align="left" src="Week6/imgs/LunarLanderContinuous.gif" alt="drawing" width="300"/>Evolution Strategies applied to LunarLander - This week the project is to implement a ES or GA. In the Week6 folder you can find a basic implementation of the paper Evolution Strategies as a Scalable Alternative to Reinforcement Learning to solve LunarLanderContinuous. You can modify it to play more difficult environments or add your ideas.
<br clear="left"/>Papers
- Deep Neuroevolution: Genetic Algorithms are a Competitive Alternative for Training Deep Neural Networks for Reinforcement Learning
- Evolution Strategies as a Scalable Alternative to Reinforcement Learning
Other Resources
- :books: Evolutionary Optimization Algorithms - Dan Simon
Week 7 - Model-Based reinforcement learning - MB-MF
The algorithms studied up to now are model-free, meaning that they only choose the better action given a state. These algorithms achieve very good performance but require a lot of training data. Instead, model-based algorithms, learn the environment and plan the next actions accordingly to the model learned. These methods are more sample efficient than model-free but overall achieve worst performance. In this week you'll learn the theory behind these methods and implement one of the last algorithms.
Lectures - Theory <img align="right" src="images/youtube_social_icon_dark.png" alt="drawing" width="48"/>
- Model-Based RL, David Silver (DeepMind) (concise version)
- Integrating Learning and Planning
- Model-Based RL Overview
- Integrated architectures
- Simulation-Based search
- Integrating Learning and Planning
- Model-Based RL, Sergey Levine (UC Berkley) (in depth version)
- Learning dynamical systems from data
- Overview of model-based RL
- Global and local models
- Learning with local models and trust regions
- Learning policies by imitating optimal controllers
- Backpropagation into a policy with learned models
- Guided policy search algorithm
- Imitating optimal control with DAgger
- Advanced model learning and images
- Models in latent space
- Models directly in image space
- Inverse models
- Learning dynamical systems from data
Project of the Week - MB-MF <img align="right" src="images/GitHub-Mark-64px.png" alt="drawing" width="48"/>
<img align="left" src="Week7/imgs/animation.gif" alt="drawing" width="300"/>MB-MF applied to RoboschoolAnt - This week I chose to implement the model-based algorithm described in this paper. You can find my implementation here. NB: Instead of implementing it on Mujoco as in the paper, I used RoboSchool, an open-source simulator for robot, integrated with OpenAI Gym.
<br clear="left"/>Papers
- Imagination-Augmented Agents for Deep Reinforcement Learning - 2017
- Reinforcement learning with unsupervised auxiliary tasks - 2016
- Neural Network Dynamics for Model-Based Deep Reinforcement Learning with Model-Free Fine-Tuning - 2018
Other Resources
- :books: The "Bible" of Reinforcement Learning: Chapter 8 - Sutton & Barto
- :books: World Models - Can agents learn inside of their own dreams?
Week 8 - Advanced Concepts and Project Of Your Choice
This last week is about advanced RL concepts and a project of your choice.
Lectures - Theory <img align="right" src="images/youtube_social_icon_dark.png" alt="drawing" width="48"/>
- Sergey Levine (Berkley)
- David Silver (DeepMind)
The final project
Here you can find some project ideas.
- Pommerman (Multiplayer)
- AI for Prosthetics Challenge (Challenge)
- Word Models (Paper implementation)
- Request for research OpenAI (Research)
- Retro Contest (Transfer learning)
Other Resources
- AlphaGo Zero
- Paper
- DeepMind blog post: AlphaGo Zero: Learning from scratch
- Arxiv Insights video: How AlphaGo Zero works - Google DeepMind
- OpenAI Five
- OpenAI blog post: OpenAI Five
- Arxiv Insights video: OpenAI Five: Facing Human Pro's in Dota II
Last 4 days - Review + Sharing
Congratulation for completing the 60 Days RL Challenge!! Let me know if you enjoyed it and share it!
See you!
Best resources
:books: Reinforcement Learning: An Introduction - by Sutton & Barto. The "Bible" of reinforcement learning. Here you can find the PDF draft of the second version.
:books: Deep Reinforcement Learning Hands-On - by Maxim Lapan
:books: Deep Learning - Ian Goodfellow
:tv: Deep Reinforcement Learning - UC Berkeley class by Levine, check here their site.
:tv: Reinforcement Learning course - by David Silver, DeepMind. Great introductory lectures by Silver, a lead researcher on AlphaGo. They follow the book Reinforcement Learning by Sutton & Barto.
Additional resources
:books: Awesome Reinforcement Learning. A curated list of resources dedicated to reinforcement learning
:books: GroundAI on RL. Papers on reinforcement learning
A cup of Coffe :coffee:
Any contribution is higly appreciated! Cheers!