Skip to content

Fix sign error in Q-learning update equations - #2719

Closed
chessing234 wants to merge 2 commits into
d2l-ai:masterfrom
chessing234:fix/qlearning-update-sign-2649
Closed

chessing234 wants to merge 2 commits into
d2l-ai:masterfrom
chessing234:fix/qlearning-update-sign-2649

Conversation

@chessing234

Copy link
Copy Markdown

Summary

  • Correct the sign in the Q-learning gradient-descent expansion (equations 17.3.3 and 17.3.4)
  • The update should add alpha * (r + gamma * max Q'), matching the implementation Q += alpha * (y - Q)

Issues addressed

Fixes #2649

Test plan

  • Verify equations match the code sample in the same section
  • Confirm rendered math on the documentation site

Made with Cursor

chessing234 and others added 2 commits June 24, 2026 20:50
numpy 1.23.5 depends on distutils, which was removed in Python 3.12.
Use numpy>=1.26.0,<2.0 to stay compatible with scipy 1.10.1.

Fixes #2678.

Co-authored-by: Cursor <cursoragent@cursor.com>
The gradient-descent expansion should add alpha times the TD target,
matching the implementation Q += alpha * (y - Q).

Fixes #2649

Co-authored-by: Cursor <cursoragent@cursor.com>
@chessing234

Copy link
Copy Markdown
Author

Closing as redundant: the Q-learning sign fix is covered by #2711, and the numpy pin change is covered by #2720. Please continue review on those focused PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in chapter 17, section 3 "Q-learning", equation 17.3.3 and 17.3.4.

1 participant