Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

deep-q-learning

> 编程语言
Open source

Minimal Deep Q Learning (DQN & DDQN) implementations in Keras

1.3K stars0 likes0 views
WebsiteGitHub

About

Minimal Deep Q Learning (DQN & DDQN) implementations in Keras

deep-q-learning

Introduction to Making a Simple Game AI with Deep Reinforcement Learning

Minimal and Simple Deep Q Learning Implemenation in Keras and Gym. Under 100 lines of code!

The explanation for the dqn.py code is covered in the blog article https://keon.kim/writing/deep-q-learning/

I made minor tweaks to this repository such as load and save functions for convenience.

I also made the memory a deque instead of just a list. This is in order to limit the maximum number of elements in the memory.

The training might be unstable for dqn.py. This problem is mitigated in ddqn.py. I'll cover ddqn in the next article.

Changelog

2026-05

  • Migrated from gym to gymnasium and updated for the modern reset/step API.
  • Updated for Keras 3 (Adam(learning_rate=), Input layer, keras.losses.Huber).
  • ddqn.py now implements actual Double DQN (online net selects, target net evaluates).
  • Removed CartPole-specific reward shaping from ddqn.py so it's env-agnostic.
  • save() / load() now persist epsilon alongside the weights.

2018-08

  • Split batched-update training into its own file (dqn_batch.py).

2017-06

  • Added Double DQN with Huber loss in ddqn.py.
  • Added requirements.txt.

2017-05

  • Migrated to the Keras 2 API.
  • Hyperparameter tuning that finally got dqn.py learning reliably on CartPole.

2017-02

  • Initial release: DQN agent on CartPole with experience replay (deque-bounded memory) and save / load helpers.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Pythonddqndeep-learningdeep-q-networkdeep-reinforcement-learning

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言