Chapter 2 · Machine learning basics
Reinforcement learning
An agent learns by trial and error, collecting rewards for good actions.
Chapter 2 · Machine learning basics
An agent learns by trial and error, collecting rewards for good actions.
After 0 tries
Early on the arrows are guesses. Every try updates the score of the move just made, until the arrows point along a safe path to the cheese.
The agent (the mouse) is in a state, a square of the grid. It picks an action, a move. The world replies with a reward: +10 for cheese, −10 for a trap, −1 for every ordinary step so wandering costs.
Run some tries and watch the arrows form. Then pick a brush, tap squares to move the cheese, traps and walls, and train again. The mouse starts top-left.
Press “Run 1 try” or “Run 50 tries”.
A teaching version: a table of scores on a tiny grid, using the real Q-learning update. Green squares are good to be in, coral squares are bad. After you move a trap, old habits fade only as new tries overwrite them.
What does the agent learn from?
Why does the mouse sometimes move randomly?
What do the arrows in each square show?