TwiddleLab / Artificial Intelligence / Learning by Reward
Agent, World, Reward
What you will learn
- An agent acts in an environment. Where things stand is the state; what it can do is an action.
- After every action the agent gets a reward: a number, good or bad.
- What matters is the total reward of the whole trip, not one move.
How the lesson goes
A robot dog has to learn to walk. Nobody can write down how.
So it gets points instead. Try it on a tiny world: food is +10, thorns are -10, every other move is -1.
Drive the critter to the food.
Watch the total. Can you finish with the best total possible?
Where can the critter go in one move?
Tap every square it can land on.
A move can go up, right, down or left. The rock on the left blocks one of them. The thorns are a legal move with a bad reward. So three squares.
What you just played has names.
Learning from rewards like this is called reinforcement learning.
A robot vacuum learns to clean. Label its parts.
It gets +1 for every bit of dust it picks up.
The robot decides, so it is the agent. The room with its furniture and dust is the environment. Moving forward is an action, and +1 for dust is the reward.
Which route ends with the best total?
Tap each route to see its rewards. Then pick one and press Check.
Route A: -1 six times and +10 at the end, total 4. Route B is shortest but ends in thorns: -4 - 10 = -14. Route C reaches the food the long way: -10 + 10 = 0.
Your route against a critter that moves at random.
Press Go.
Next lesson: Trial and Error · Part of the course: Learning by Reward
Lessons are interactive and need JavaScript. Turn it on to play them.