Q-Learning
Learns the value of each action in each state, and acts greedily on it.
The idea
Q(s, a) estimates the total future reward of taking action a in state s and then acting well. After each step the agent moves Q(s, a) toward the reward plus the best Q value of the next state. Because it bootstraps from the best next action rather than the one actually taken, it learns the optimal policy while behaving in an exploratory way (off-policy).
Q(s,a) ← Q(s,a) + α [r + γ·maxₐ′ Q(s′,a′) − Q(s,a)]
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- positive value
- negative value
- best action
- agent
Q-learning: update Q(s,a) toward reward + γ·(the best Q in the next state), whatever we do next.
- episode:
- 1
The agent explores with some randomness while learning which action is best in each cell.
Step by step
- 1Initialise Q(s, a) to zero.
- 2Choose an action (mostly the best, sometimes random).
- 3Observe the reward r and next state s′.
- 4Update Q(s, a) toward r + γ·max Q(s′, ·).
- 5Repeat over many episodes.
Where it is used
Small discrete problems, games, and the idea behind DQN.
Watch out for
A table is impossible for huge state spaces; overestimates values because of the max.