Definition
How do you teach a dog a new trick without explaining it in words?
Reinforcement learning is machine learning by trial and error. An agent takes actions in an environment and receives rewards for good outcomes and penalties for bad ones. Over many tries it learns which actions lead to the most reward.
In simple words
Give a dog a treat when it sits, and nothing when it doesn't. Soon it sits on command. Nobody showed it the right answer; it found out from rewards. In the maze activity, the robot gets points for reaching the trophy and loses points for traps and wasted steps. After enough practice, it finds the best route.
Why it matters
Reinforcement learning taught computers to play games such as Go and chess better than any person, and helps robots learn to walk and grab objects. It is also part of how chatbots are trained to give more helpful answers.
How it works
| Part | In the maze |
|---|---|
| Agent | The robot |
| Environment | The grid of squares |
| Actions | Move up, down, left or right |
| Reward | +10 for the trophy |
| Penalty | −10 for a trap, −1 for each step |
Try it yourself
Guide a robot through a maze with rewards
Watch the robot wander randomly first. Then let it practise and see its route and score improve.
Common mistakes
- Thinking the robot is told the route. It learns only from rewards and penalties.
- Mixing it up with supervised learning. There are no labelled answers, only rewards.
- Thinking a few tries are enough. It usually needs a great deal of practice.
Check yourself
Summary
- Reinforcement learning is learning by trial and error with rewards.
- An agent acts, gets rewards or penalties, and improves.
- It powers game-playing AI and robots that learn to move.
Finished reading?
Sources: AI4K12: Five Big Ideas in AI