Repository navigation
The first tagged release. Every notebook was re-run from the top after a round of bug fixes, so each output, plot and analysis now comes from the code next to it. Several of the bugs changed what a notebook teaches, and two (HAC and the A3C gradients) meant the algorithm was not really learning.
Highlights
- Q-learning no longer bootstraps from terminal states, and Cliff Walking has its textbook rules. Q-learning now learns the 13-move path along the cliff edge, and SARSA the 15-move path one row up, the classic contrast.
- PPO, A2C and TRPO bootstrap and compute GAE correctly at episode boundaries. PPO's critic now learns real returns: its value loss falls to 0.01, where it used to sit at 1.0. TRPO's line search accepts all 150 updates inside its trust region; before, a shape bug made it reject most of them.
- A3C zeroes its local gradients. Every update used to carry the sum of all earlier ones. With correct gradients it needs 20-step returns to reach a goal 18 moves away, and it now learns the shortest path.
- HAC actually trains its low level, with hindsight goals and hindsight actions. Every test episode used to time out; now every one reaches the goal by the shortest path.
- MCTS backs up the rewards of the moves inside the tree. Episodes take 13 to 16 moves instead of 26 to 59.
- DDPG and SAC no longer treat Pendulum's time limit as a terminal state, and MADDPG and QMIX finish exploring before training ends and pass greedy tests with the optimal 4-move joint path.
- New notebook 19: multi-armed bandits for dynamic pricing, answering #1. ε-greedy, UCB1 and Thompson Sampling choose prices for a simulated shop; Thompson Sampling gives up the least revenue. Thanks @MR-HOLO for the question and @MenokoOG for suggesting Thompson Sampling.
Also in this release
- Tests:
tests/test_notebooks.pychecks that every notebook ran in order with no errors and intact math, andtests/test_algorithms.pyruns the notebooks' own functions on small cases worked out by hand (every test fails on the old code). CI runs both on Python 3.10, 3.12 and 3.13. - Python 3.10 and newer (it required 3.13),
uv syncor pip setup, and a regenerateduv.lock. - 97 broken LaTeX expressions repaired, a crash on current Matplotlib fixed, and the cheat sheet's notebook links (all broken) and outdated snippets fixed.
The full list is in CHANGELOG.md.