Implementation of all RL algorithms in a simpler way
Jupyter Notebook
1,973
43 commits
updated Aug 29, 2025
This repository is a collection of Python implementations of various Reinforcement Learning (RL) algorithms. The primary goal is educational: to get a deep and intuitive understanding of how these algorithms work under the hood. π§ Due to the recent explosion in the AI domain especially Large Language Models, and many more applications it is important to understand core reinforcement learning algorithms.
This repository also includes a comprehensive cheat sheet summarizing key concepts and algorithms for quick reference.
This is not a performance-optimized library! I prioritize readability and clarity over speed and advanced features. Think of it as your interactive textbook for RL.
| Date | Update |
|---|---|
| 2 April 2025 | Added a comprehensive RL Cheat Sheet summarizing all implemented algorithms and core concepts. Repository now includes 18 algorithm notebooks. |
| 30 March 2025 | Added 18 new algorithms. |
The repository currently includes implementations of the following RL algorithms, with more planned:
Algorithm Quick Reference
Each algorithm has its own Jupyter Notebook (.ipynb) file with a detailed explanation and implementation.
Complementing the detailed notebooks, a comprehensive RL Cheat Sheet is included in this repository. It serves as a quick reference guide covering:
β‘οΈ View the RL Cheat Sheet here
Follow these steps to get started:
Clone the repository:
git clone https://github.com/fareedkhan-dev/all-rl-algorithms.git
cd all-rl-algorithms
Create a virtual environment (using uv): (β‘ faster alternative to python -m venv)
# Initialize a new project (β only if starting fresh, not when cloning)
uv init
# Create a virtual environment
uv venv
Activate the virtual environment:
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
Install dependencies:
uv add -r requirements.txt
Multiprocessing in A3C: Please run a3c_training.py in the terminal instead of the jupyter notebook to avoid any complication from multiprocessing.
π‘ Note: If you donβt have uv installed yet, you can install it via:
pip install uv
01_simple_rl.ipynb): This notebook introduces fundamental RL concepts like states, actions, rewards, and policies.02_q_learning.ipynb), SARSA (03_sarsa.ipynb), and REINFORCE (06_reinforce.ipynb). Understand their update rules, strengths, and limitations.13_dqn.ipynb), Actor-Critic (08_a2c.ipynb), PPO (07_ppo.ipynb), Model-Based RL with PlaNet (18_planet.ipynb), and multi-agent learning with MADDPG (14_maddpg.ipynb) and QMIX (15_qmix.ipynb).a3c_training.py. Run it from the command line: python a3c_training.pyEach notebook includes visualizations to help you understand the agent's behavior:
This repository is primarily for learning! While effort has been taken, some notebooks (especially the more complex ones like HAC) may contain bugs, incomplete implementations, or simplifications for clarity. If you find any issues, feel free to create a pull request.
Contributions are welcome! Here's how you can help:
16 followers Β· starred Jun 2026
38 followers Β· starred Apr 2025
28 followers Β· starred Mar 2025
10 followers Β· starred Apr 2025
Implementation of all RL algorithms in a simpler way
Jupyter Notebook
1,973
43 commits
updated Aug 29, 2025
This repository is a collection of Python implementations of various Reinforcement Learning (RL) algorithms. The primary goal is educational: to get a deep and intuitive understanding of how these algorithms work under the hood. π§ Due to the recent explosion in the AI domain especially Large Language Models, and many more applications it is important to understand core reinforcement learning algorithms.
This repository also includes a comprehensive cheat sheet summarizing key concepts and algorithms for quick reference.
This is not a performance-optimized library! I prioritize readability and clarity over speed and advanced features. Think of it as your interactive textbook for RL.
| Date | Update |
|---|---|
| 2 April 2025 | Added a comprehensive RL Cheat Sheet summarizing all implemented algorithms and core concepts. Repository now includes 18 algorithm notebooks. |
| 30 March 2025 | Added 18 new algorithms. |
The repository currently includes implementations of the following RL algorithms, with more planned:
Algorithm Quick Reference
Each algorithm has its own Jupyter Notebook (.ipynb) file with a detailed explanation and implementation.
Complementing the detailed notebooks, a comprehensive RL Cheat Sheet is included in this repository. It serves as a quick reference guide covering:
β‘οΈ View the RL Cheat Sheet here
Follow these steps to get started:
Clone the repository:
git clone https://github.com/fareedkhan-dev/all-rl-algorithms.git
cd all-rl-algorithms
Create a virtual environment (using uv): (β‘ faster alternative to python -m venv)
# Initialize a new project (β only if starting fresh, not when cloning)
uv init
# Create a virtual environment
uv venv
Activate the virtual environment:
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
Install dependencies:
uv add -r requirements.txt
Multiprocessing in A3C: Please run a3c_training.py in the terminal instead of the jupyter notebook to avoid any complication from multiprocessing.
π‘ Note: If you donβt have uv installed yet, you can install it via:
pip install uv
01_simple_rl.ipynb): This notebook introduces fundamental RL concepts like states, actions, rewards, and policies.02_q_learning.ipynb), SARSA (03_sarsa.ipynb), and REINFORCE (06_reinforce.ipynb). Understand their update rules, strengths, and limitations.13_dqn.ipynb), Actor-Critic (08_a2c.ipynb), PPO (07_ppo.ipynb), Model-Based RL with PlaNet (18_planet.ipynb), and multi-agent learning with MADDPG (14_maddpg.ipynb) and QMIX (15_qmix.ipynb).a3c_training.py. Run it from the command line: python a3c_training.pyEach notebook includes visualizations to help you understand the agent's behavior:
This repository is primarily for learning! While effort has been taken, some notebooks (especially the more complex ones like HAC) may contain bugs, incomplete implementations, or simplifications for clarity. If you find any issues, feel free to create a pull request.
Contributions are welcome! Here's how you can help:
16 followers Β· starred Jun 2026
38 followers Β· starred Apr 2025
28 followers Β· starred Mar 2025
10 followers Β· starred Apr 2025