Seksjon 1. Kapittel 3
single
Challenge: Q-table Update with Q-learning
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
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
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 3
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår