Deep Q-Network combines Q-learning with neural networks to scale to high-dimensional state spaces (images, etc). Use target network and replay buffer for stability.
The problem, from first principles
Large state spaces (images: 84x84x3 = ~21k features) can't use tabular methods. Neural networks can approximate Q: Q(s,a) ≈ NN_w(s,a). But directly training on RL data is unstable. Two fixes: target network and experience replay.
Takes actions, rewards, next-state target Q from target network
Computes Huber loss (smooth L1)
Returns scalar loss
Constraints
Huber loss instead of MSE (more stable)
Handle terminal states (done flag)
Target = reward if done, else reward + gamma*max_Q'
Use gradient clipping friendly loss
Hints
Hint 1: Compute target
target = r + gamma * max Q'(s') * (1 - done)
Hint 2: Huber loss
Smooth L1: smooth at zero, linear in tails
Hint 3: Gather selected actions
Use actions to index into Q predictions
Keywords
rldeep-learningq-learningneural-networks
Python
Run your code to see results
No results yet
Run your code to check it against the examples, or submit to run every test.