Level 2 · Module 9 · 10 minutes
Learning by trying: agents, actions and consequences
- Describe the loop of situation, action, reward and new situation.
- Explain in plain words what the policy and the score table of Q-learning represent.
- Distinguish reinforcement learning from supervised learning and from written rules.
Reinforcement learning is a way of learning by trying things and living with the results. A learning system, called an agent, acts in a world, sees what happens, and receives a reward or a penalty. Over many attempts it finds actions that bring better results. Nothing tells it the right answer in advance; it only experiences consequences.
The parts of the loop
Picture a delivery motorcycle rider learning a route. At any moment the rider is in a situation: a position, a time of day, traffic ahead. The rider can take one of several actions: turn left, take the main road, wait. The world responds with a new situation and a reward, such as a delivery completed on time. The agent repeats this loop, again and again, and slowly gets better at choosing.
In plain words, the loop has a situation, an action, a result and a reward. The agent's policy is its habit: which action it chooses in each situation. Training changes the policy so that the habit improves. A policy can be written down as a simple table, a set of if-then habits, or the learned numbers of a model.
How the learning looks
A simple method called Q-learning keeps a table of scores. Each row is a situation and each column is an action, so each cell holds an estimate of how good that action is in that situation. After each attempt the agent revises the number it used. The revision combines the reward it just received with an estimate of the best score available in the next situation, and future scores count for a little less than immediate ones. Cells that lead to good results drift upward. With enough attempts the agent can read the table and choose well.
That is the whole idea at beginner level: keep a memory of how good each choice has been, then revise it as experience arrives. No one writes the final table by hand, and no label tells the agent what to do.
What it is not
It is not the same as supervised learning, where every example arrives with the correct answer attached. Here the feedback is a reward, often late and often incomplete, and the agent must work out which earlier actions earned it. It is also not the same as a rules engine, which follows decisions a person wrote down in advance.
A teaching picture, not a real trainer
The motorcycle example is a simplified teaching picture. A real commercial system that uses reinforcement learning runs very many practice attempts inside a simulation, with people guarding against unsafe behaviour. In this lesson you reason on paper; no model is trained and no agent acts anywhere real.
Common misconception
Reinforcement learning means the system is told the right answer after each attempt, so it simply copies the answer. The system is never given the correct action. It receives a reward that may arrive late and may not name which action caused it. Learning means revising estimates of how good each action is, which is why many attempts, some mistakes and a way to explore are all required.
Guided practice
On paper, describe a small learning agent for a garden watering system. List three situations it could notice, three actions it could take, and the reward you would give. Then draw a table with situations as rows and actions as columns, and mark one cell you would revise after a successful watering. Explain why this table is a score memory rather than a written set of rules. This is a paper exercise; no model is trained.
Knowledge check
Independent practice
Write a short example from your own work or daily life and decide whether it is AI, ordinary software or a mixture. Then explain why. Save it in your notes; no account is required.
Last reviewed: · Report a problem