Skip to content
ZhiqingXiaoPublic

About

Source codes for the book "Reinforcement Learning: Theory and Python Implementation"

Topics

Resources

Stars

1.0k stars

Watchers

24 watching

Forks

Latest commit

 

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reinforcement Learning: Theory and Python Implementation

The First Reinforcement Learning Tutorial Book with one-on-one mapping TensorFlow 2 and PyTorch 1&2 Implementation

English Edition 中文版 中文2019版
Book Book Book

Please email me if you are interested in publishing this book in other languages.

Features

This is a tutorial book on reinforcement learning, with explanation of theory and Python implementation.

  • Theory: Starting from a uniform mathematical framework, this book derives the theory and algorithms of reinforcement learning, including the algorithms in large model era such as PPO, RLHF, IRL, and PbRL.
  • Practice: Every chapter is accompanied by high quality implementation based on Python 3, Gym 0.26, and TensorFlow 2 / PyTorch 1&2. All codes are compatible with Windows, Linux, and macOS, can be run in a laptop.

Supporting contents for English version

Check here for codes, exercise answers, errata, etc.

Check SpringerLink Amazon for book contents.

Table of Codes

All codes have been saved as a .ipynb file and a .html file in the same directory.

Chapter Environment & Closed-Form Policy Agent
2 CliffWalking-v0 Bellman
3 FrozenLake-v1 DP
4 Blackjack-v1 MC
5 Taxi-v3 SARSA, ExpectedSARSA, QL, DoubleQL, SARSA(λ)
6 MountainCar-v0 SARSA, SARSA(λ), DQN tf torch, DoubleDQN tf torch, DuelDQN tf torch
7 CartPole-0 VPG tf torch, VPGwBaseline tf torch, OffPolicyVPG tf torch, OffPolicyVPGwBaseline tf torch
8 Acrobot-v1 QAC tf torch, AdvantageAC tf torch, EligibilityTraceAC tf torch, PPO tf torch, NPG tf torch, TRPO tf torch, OffPAC tf torch
9 Pendulum-v1 DDPG tf torch, TD3 tf torch
10 LunarLander-v2 SQL tf torch, SAC tf torch, SACwA tf torch
10 LunarLanderContinuous-v2 SACwA tf torch
11 BipedalWalker-v3 ES, ARS
12 PongNoFrameskip-v4 CategoricalDQN tf torch, QR-DQN tf torch, IQN tf torch
13 BernoulliMAB-v0 UCB
13 GaussianMAB-v0 UCB
14 TicTacToe-v0 AlphaZero tf torch
15 Tiger-v0 VI
16 HumanoidBulletEnv-v0 BehaviorClone tf torch, GAIL tf torch

强化学习:原理与Python实战 (2023 中文版)

全球第一本配套 TensorFlow 2 和 PyTorch 1/2 对照代码的强化学习教程书

中文版书籍支持内容

  • 代码、习题答案、勘误更新等配套资源见这里。

本书内容

  • 第一部分(第 1 章):从零开始介绍强化学习的背景知识,介绍环境库 Gym 的使用。
  • 第二部分(第 2~15 章):基于折扣奖励离散时间 Markov 决策过程模型,介绍强化学习的主干理论和常见算法。采用数学语言推导强化学习的基础理论,进而在理论的基础上讲解算法,并为算法提供配套代码实现。基础理论的讲解突出主干部分,算法讲解全面覆盖主流的强化学习算法,包括经典的非深度强化学习算法和近年流行的强化学习算法。 Python 实现和算法讲解一一对应,还给出了深度强化学习算法的 TensorFlow 和 PyTorch 对照实现。
  • 第三部分(第 16 章):介绍其他强化学习模型,包括平均奖励模型、连续时间模型、非齐次模型、半 Markov 模型、部分可观测模型等,以便更好了解强化学习研究的全貌。

本书特色

本书完整地介绍了主流强化学习理论。

  • 选用现代强化学习理论体系,突出主干,主要定理均给出证明过程。基于理论讲解强化学习算法,全面覆盖主流强化学习算法,包括了资格迹等经典算法和 MuZero 等深度强化学习算法。
  • 全书采用完整的数学体系,各章内容循序渐进。全书采用一致的数学符号,并兼容主流强化学习教程。
  • 每章都配有知识点总结,并搭配习题。

本书各章均提供Python代码,实战性强。

  • 简洁易懂:全书代码统一规范、简约完备,与算法讲解直接对应。
  • 查阅方便:所有代码及运行结果均在 GitHub 上展示,既可以在浏览器上查阅,也可以下载到本地运行。各算法实现放在单独的文件里,可单独查阅和运行。
  • 环境全面:既有 Gym 的内置环境,也有在 Gym 基础上进一步扩展的第三方环境,还带领读者一起实现自定义的环境。
  • 兼容性好:所有代码在三大操作系统(Windows、macOS、Linux)上均可运行,书中给出了环境的安装和配置方法。深度强化学习代码还提供了 TensorFlow 和 PyTorch 对照代码。读者可任选其一。
  • 硬件要求低:所有代码均可在没有 GPU 的个人计算机上运行。

强化学习:原理与Python实现 (2019)

全球第一本配套 TensorFlow 2 代码的强化学习教程书

中国第一本配套 TensorFlow 2 代码的纸质算法书

中文版书籍支持内容

  • 代码、勘误更新等见这里。

本书特色

本书介绍强化学习理论及其 Python 实现。

  • 理论完备:全书用一套完整的数学体系,严谨地讲授强化学习的理论基础,主要定理均给出证明过程。各章内容循序渐进,覆盖了所有主流强化学习算法,包括资格迹等非深度强化学习算法和柔性执行者/评论者等深度强化学习算法。
  • 案例丰富:在您最爱的操作系统(包括 Windows、macOS、Linux)上,基于 Python 3、Gym 0.26 和 TensorFlow 2,实现强化学习算法。全书实现统一规范,体积小、重量轻。第 1~9 章给出了算法的配套实现,环境部分只依赖于 Gym 的最小安装,在没有 GPU 的计算机上也可运行;第 10~12 章介绍了多个热门综合案例,涵盖 Gym 的完整安装和自定义扩展,在有普通 GPU 的计算机上即可运行。

QQ群

  • QQ群:948110103(勘误报错可发此群。其他问题提问前请先问过AI和Google,群主和管理员不提供免费咨询服务)
  • 多任务群:696984257(非小白群,多任务强化学习+强化元学习+终身强化学习+迁移强化学习,勘误报错勿发此群,提问前请先问过AI和Google)
  • 关于入群验证问题:由于QQ的bug,即使正确输入答案,也可能会验证失败。这时更换设备重试、更换输入法重试、改日重试均可能解决问题。如果答案中有英文字母,清注意大小写。
  • 中文版书前言中给出的QQ群(935702193、243613392和722846914)已满,不再新增群成员,谢谢理解。

About

Source codes for the book "Reinforcement Learning: Theory and Python Implementation"

Topics

Resources

Stars

1.0k stars

Watchers

24 watching

Forks

Used by

Contributors

Languages