Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation

Monte Carlo Learning

Estimates values by averaging the total reward of complete episodes.

The idea

Play an episode to the end, compute the return G (discounted reward) that followed each visited state, and average these returns. It needs no model and does not bootstrap, so it is unbiased, but it can only learn when an episode finishes and its estimates are noisy.

V(s) ← V(s) + α (G − V(s))

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

Monte Carlo: play the whole episode first. Nothing is learned until it ends.

episode:
1
1/89

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

Step by step

  1. 1Run a full episode with the current policy.
  2. 2Compute the return Gₜ for each step working backwards from the end.
  3. 3Update each visited state's value toward its return (or keep the average).
  4. 4Repeat over many episodes.

Where it is used

Episodic tasks such as games, with a known end.

Watch out for

High variance and no learning from incomplete episodes.

Related