Python exercise · about 5 minutes · free
DQN Targets: Bootstrapping With a Frozen Network
A neural network chasing a target that it also produces is unstable. Compute the target with a slowly updated copy.
A deep Q-network (DQN) replaces the Q-table with a neural network. Training regresses Q(s, a) onto the target r + gamma x max Q_target(s', a') x (1 - done). Two stabilisers: a target network (a periodically copied frozen version of the Q-network) and a replay buffer. Double DQN reduces the overestimation caused by the max: the online network chooses the next action and the target network evaluates it.
Prices, versions and service names last checked 2026-11-19. They change, so confirm on the official pages before you rely on them.
Your quest: Write
dqn_target(r, next_q, gamma, done) (next_q is the target network's list of Q values for the next state) and double_dqn_target(r, online_next_q, target_next_q, gamma, done). A finished episode (done true) has no future value.Starter code
def dqn_target(r, next_q, gamma, done):
pass
def double_dqn_target(r, online_next_q, target_next_q, gamma, done):
pass