Skip to main content
MahiDev — Learn. Build. Become AI-ready.

Lesson 60

Double DQN

Choose the next action with the online network and score it with the target network, so the max does not inflate Q. One example is on this page.

Intermediate12 min
Double DQN MahiDev

What You Will Learn

  • Idea
  • Example
  • When to use it

Idea

DQN both picks and scores the next action with the same values, so a lucky high number gets selected. Double DQN splits the jobs. The online network picks the action. The target network reports that action's value. A noisy high score is less likely to be both chosen and trusted.

Example

python
online = [1.0, 2.0]
target_net = [1.5, 0.4]
action = online.index(max(online))
reward, gamma = 0.0, 0.9
target = reward + gamma * target_net[action]
print(f"action: {action}")
print(f"ddqn target: {target:.2f}")

Output:

text
action: 1
ddqn target: 0.36

When to use it

  • Use it as the default fix when a DQN's Q values grow without the returns growing.
  • On these numbers the online net prefers action 1, and the target net says that action is only 0.4.
  • The rest of the DQN training loop stays the same.

Loading playground…