All Modules

Reinforcement Learning

No teacher gives the right answers. An agent acts, the world responds, and a single number — the reward — says how well it did. Reinforcement learning is the mathematics of turning that number into behaviour. In this module’s 27 interactive demonstrations, the agents learn live in your browser. Play slot machines against Thompson sampling. Raise a landscape of values out of a gridworld. Watch Q-learning and SARSA take different routes past a cliff. See a car learn to climb a mountain and a network learn to balance a pole. Then watch a DQN learn a game from pixels, play Connect Four against tree search, and teach a reward model your own preferences.

See also: Machine Learning for gradient descent and backpropagation, Probability for Markov chains and expectations, and Game Theory for minimax and equilibria.

  1. 01

    Explore or Exploit

    A row of slot machines with unknown payouts. Play them yourself, then race ε-greedy, UCB and Thompson sampling and watch regret grow like log t.

    3 demos
  2. 02

    Markov Decision Processes

    States, actions, slippery transitions and rewards. Build a world, turn the discount factor and watch the best route change, and see a value as the average of a thousand futures.

    3 demos
  3. 03

    The Bellman Equations

    Value iteration raises a landscape of values out of the goal. Policy iteration flips arrows until none change, and the Bellman operator squeezes every guess toward one fixed point.

    3 demos
  4. 04

    Learning from Experience

    No model, only experience. Monte Carlo against temporal-difference learning, Q-learning against SARSA on the cliff, and eligibility traces that pass credit down a trail.

    3 demos
  5. 05

    Function Approximation

    Too many states for a table. Tile coding generalises between nearby states, a car learns to climb a mountain, and Baird’s counterexample shows learning blow up.

    3 demos
  6. 06

    Policy Gradients

    Adjust the policy itself, uphill in expected reward. Noisy REINFORCE estimates and the baseline that tames them, a pole balanced by a network trained in your browser, and trust regions.

    3 demos
  7. 07

    Deep Q-Learning

    A neural network learns a game from pixels while you watch. Experience replay and target networks keep it stable, and Double Q-learning stops it overrating itself.

    3 demos
  8. 08

    Planning and Search

    Learn a model, then plan with it. Dyna-Q finds a shortcut, Monte Carlo tree search plays Connect Four against you, and self-play teaches noughts and crosses from nothing.

    3 demos
  9. 09

    Rewards and Preferences

    Agents optimise exactly what you reward. Watch one exploit a loophole, teach a reward model from your own preferences, and see how a KL leash limits over-optimisation.

    3 demos

Search