In standard Q-learning, the same Q-table is used to both select and evaluate actions, which can lead to overestimation of action values (maximization bias). Double Q-learning addresses this by maintaining two separate Q-value tables.
Implement the double_q_learning function that processes a sequence of experience tuples and updates two Q-tables.
Your function should:
Q1 and Q2 as zero matrices of shape (num_states, num_actions)(state, action, reward, next_state, done) along with its corresponding coin flip:
0, update Q1 using Q2 for evaluation1, update Q2 using Q1 for evaluationdone=True), the target should only be the immediate reward(Q1, Q2) as a tuple of numpy arraysParameters:
num_states: Number of states in the environmentnum_actions: Number of possible actionsexperiences: List of tuples (state, action, reward, next_state, done)alpha: Learning rategamma: Discount factorcoin_flips: List of 0s and 1s (same length as experiences) determining which table to updateHint: The key insight is the decoupling of action selection from action evaluation to reduce overestimation bias.