Sektion 1. Kapitel 3
single
Challenge: Q-table Update with Q-learning
Stryg for at vise menuen
Opgave
Swipe to start coding
Challenge: Given a Q-table and a sequence of actions, update the Q-values using the Q-learning rule.
- For each transition in
transitions, update the Q-value inq_tablefor the givenstateandactionusing the Q-learning update formula. - Each transition is a tuple: (
state,action,reward,next_state). - Use the learning rate
alphaand discount factorgammafor the update. - The Q-learning update formula is:
Q[state, action] = Q[state, action] + alpha * (reward + gamma * max(Q[next_state]) - Q[state, action]).
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 3
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat