Skip to content

reinforcement-learning

Code, exercises and solutions for learning reinforcement learning alongside Sutton's book and David Silver's c

Stars
22.2k
Forks
6.1k
Licence
MIT
Language
Jupyter Notebook
Last update
3.3 years ago
Type
Learning resource

No commits in over a year — check for forks or alternatives before adopting.

What it is

This repository is a set of study materials for reinforcement learning, a branch of machine learning where a program learns by trial and error to make good decisions. It pairs Jupyter notebooks containing exercises and worked solutions with the textbook by Sutton and Barto and David Silver's lecture course. The code is written in Python 3 and uses OpenAI Gym environments, with some advanced parts using TensorFlow.

  • Work through the Dynamic Programming notebooks on policy evaluation, policy iteration and value iteration
  • Run the Monte Carlo and TD notebooks to compare prediction and control methods
  • Experiment with the Deep Q-Learning notebook for Atari games
  • Read the concept summaries and learning goals in each folder alongside the textbook chapter

Great for

  • Students working through Sutton and Barto's reinforcement learning textbook
  • Self-learners who want runnable examples of classic RL algorithms
  • Developers who want to see tabular methods like Q-learning and SARSA implemented
  • People following David Silver's RL course who want matching exercises

Not ideal for

  • Readers wanting production-ready RL libraries, since this is a learning aid and the README frames it that way
  • People needing the latest deep RL methods, because several entries are marked WIP in the README
  • Anyone who cannot read Python or work in Jupyter notebooks
Step-by-step guide: how to use reinforcement-learningInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Python 3 · Jupyter Notebook

    Clone the repository

    git clone https://github.com/dennybritz/reinforcement-learning
  2. 2

    Run it

    • Clone the repository and open it in a terminal or editor
    • Start with the Introduction folder to learn the OpenAI Gym setup
    • Move to the MDP and DP folders for the first algorithms
    • Open a solution notebook and run its cells in Jupyter
  3. 3

    Get the most out of it

    • Read the textbook or lecture chapter that matches each folder before opening its notebook
    • Try the exercises yourself before reading the solution notebooks
    • Use the linked resources list for extra lectures and papers on deep RL topics
    • Compare the tabular methods with the DQN and policy gradient notebooks to see how function approximation changes things

Downloads

Strengths

  • Maps folders directly to chapters of the Sutton and Barto book and to Silver's course
  • Includes exercises with solutions, not just finished code
  • Uses standard RL environments from OpenAI Gym so results are easy to reproduce

Trade-offs

  • Several algorithms are listed as work in progress, so coverage is incomplete
  • The README does not give version pins or detailed setup steps, so environment setup may take effort
  • The README links to older course materials and a Gym website, which may be out of date

How it compares

ProjectStarsTypeLevelUpdatedBest for
reinforcement-learning (this)22.2kLearning resourceintermediate3.3 years agoStudents working through Sutton and Barto's reinforcement learning textbook
spinningup12kLearning resourceintermediate2.3 years agoStudents who want a structured entry point into deep RL

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.