Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation

Expected SARSA

SARSA that uses the average over next actions instead of one sampled action.

The idea

Instead of the single sampled a′, the target uses the expectation of Q(s′, ·) under the policy. That removes the randomness from choosing a′, lowering variance, and it can be on- or off-policy. With a greedy target policy it is exactly Q-learning.

target = r + γ Σₐ′ π(a′|s′) Q(s′,a′)

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

GOAL +1PIT −1start000000000000000000
  • positive value
  • negative value
  • best action
  • agent

Expected SARSA: update toward reward + γ·(the average Q over next actions, weighted by how likely each is).

episode:
1
1/92

The agent explores with some randomness while learning which action is best in each cell.

Step by step

  1. 1Take an action and observe r and s′.
  2. 2Compute Σ π(a′|s′)·Q(s′, a′).
  3. 3Update Q(s, a) toward r + γ times that expectation.
  4. 4Repeat.

Where it is used

Often more stable than SARSA at the same cost.

Watch out for

Slightly more computation per update.

Related