# keon/deep-q-learning

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

Repository: https://github.com/keon/deep-q-learning
Canonical: https://ross.abutalabs.com/products/deep-q-learning
Homepage: https://keon.kim/writing/deep-q-learning/
Language: Python
License: MIT
License Family: permissive
Topics: deep-reinforcement-learning, deep-q-network, dqn, reinforcement-learning, deep-learning, ddqn
Last push: 2026-05-18T07:10:19+00:00

## Health v2 (maintenance only)
Score: 70/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 83, release rhythm 35, longevity 100
- inputs: {"age_days": 3495, "days_push": 107, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1328, forks 454 (observed 2026-08-28T04:04:23.641683+00:00)

## What it is
A minimal, under-100-lines implementation of Deep Q-Learning (DQN and Double DQN) in Python using Keras and Gymnasium, built as a companion to a tutorial blog post. It trains a game-playing AI agent on CartPole with experience replay and save/load helpers.

## Use cases
- learn deep q-learning from a small readable codebase
- implement a DQN agent in Keras
- train an AI to play CartPole with reinforcement learning
- understand the difference between DQN and Double DQN
- see how experience replay works in practice
- find a minimal starting point for deep RL experiments

## When to choose
- you want a tiny, educational DQN/DDQN reference implementation
- you are learning deep reinforcement learning and prefer minimal code over frameworks
- you need a Keras-based Q-learning example updated for modern Keras 3 and Gymnasium

## When to avoid
- you need a production-grade or feature-rich RL library with many algorithms
- you require GPU-optimized, scalable, or distributed RL training
- you need support for complex environments beyond simple Gymnasium tasks

## Facets
- artifact type: learning-resource
- maturity: active
- function: reinforcement-learning, deep-learning, machine-learning
- domain: reinforcement-learning, deep-learning, machine-learning, tutorials, education
- platform: python
- tags: dqn, ddqn, keras, gymnasium, cartpole, experience-replay, q-learning, educational-code

## Member repositories
- keon/deep-q-learning (main) score 70

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:23.641683+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:45:58.195766+00:00, confidence not recorded.
  - readme: https://github.com/keon/deep-q-learning (fetched 2026-08-28T04:04:23.641683+00:00, sha 24799e59d788)
  - homepage: https://keon.kim/writing/deep-q-learning/ (fetched 2026-08-29T12:04:55.383737+00:00, sha 1a3e61c991a2)
- Data as of 2026-08-30T08:39:29.467469+00:00.
