Supervised, Unsupervised and Reinforcement Learning for Curious Readers
How the three main styles of machine learning differ, what each is good for and how modern chatbots combine several of them.
Key takeaways
- Supervised learning learns to predict known answers from labeled examples.
- Unsupervised learning finds groups, patterns or oddities in data that nobody has labeled.
- Reinforcement learning improves behavior through trial, error and a reward signal, often over a sequence of decisions.
- Many modern systems mix these styles, along with self-supervised learning, which makes its own answers from raw data.
The three names describe what kind of guidance a system gets while it learns. In supervised learning, it studies examples that come with the right answers. In unsupervised learning, it gets examples with no answers and looks for structure. In reinforcement learning, it tries actions and receives rewards or penalties that tell it how well things went.
You do not need any math to tell them apart. Ask one question: where does the feedback come from?
Supervised learning: examples with answers
Suppose you want software to tell ripe tomatoes from unripe ones. You collect many photos and have someone mark each as "ripe" or "unripe". The system makes guesses, compares them with those marks and adjusts itself to be wrong less often. Later it judges photos nobody has marked.
The marks are called labels. When the answer is a category, such as ripe or unripe, the task is called classification. When the answer is a number, such as tomorrow's electricity demand, it is called regression.
Supervised learning is common in practice: filtering junk mail, reading handwritten digits, estimating delivery times, flagging suspicious card payments.
Its strength is a clear target that can be measured. Its cost is the labels. Someone has to produce them, and their mistakes and disagreements pass into the system. If the people labeling tomatoes disagree about the orange ones, no amount of training will make the boundary sharper than their judgment.
Unsupervised learning: structure without answers
Now suppose you have records of what thousands of shoppers bought and no categories at all. An unsupervised method might discover that some baskets look alike: one cluster heavy in baby supplies, another in camping goods. Nobody told it those groups existed.
Typical jobs include:
- Clustering: gathering similar items into groups.
- Anomaly detection: noticing items unlike the rest, such as a strange reading from a machine.
- Simplifying: summarizing many measurements with a few that keep most of the variation.
The catch is that the method does not know what its groups mean, or whether they are useful. A program might sort customer records by something trivial, like how dates were formatted. A person has to inspect the result, name the groups and decide whether they reflect anything real. Different settings can also produce different groupings from the same data.
Self-supervised learning: answers hidden in the data
A fourth term sits between the first two and powers much of recent AI. In self-supervised learning, the data supplies its own labels. Take a sentence, hide the next word and ask the model to predict it. The correct answer is simply the word that was there.
Because ordinary text, images and audio exist in huge quantities, this avoids hiring people to label every example. A model trained to predict missing or upcoming pieces absorbs a lot about grammar, style and common facts along the way. How a language model builds a sentence shows what that prediction looks like in use.
Some writers file this under unsupervised learning, since no person added labels. Others stress that the training works like supervised learning, since every guess has a right answer. Both descriptions point at the same procedure.
Reinforcement learning: learning from consequences
Think about learning to balance a broom upright on your palm. No one gives you the correct hand position for every instant. You move, see the broom steady or topple and gradually do better.
In reinforcement learning, a learner called the agent acts in a setting called the environment. After actions it receives a reward, a number saying how good the outcome was. Over many attempts it develops a policy, meaning a way of choosing what to do in each situation.
Two difficulties make this style distinctive. First, rewards may arrive late: a move early in a board game might decide the result many turns afterward, so credit has to be spread back over earlier choices. Second, the agent must balance exploration, trying something new, against exploitation, repeating what has worked. Too little exploring and it never finds better strategies.
Reinforcement learning has produced strong game-playing programs and is studied for robot control and for managing systems such as cooling. It often needs many trials, which is why practice in simulation is popular.
The three side by side
| Question | Supervised | Unsupervised | Reinforcement |
|---|---|---|---|
| What does it need? | Labeled examples | Unlabeled examples | A setting to act in and a reward |
| How do you judge it? | Compare with known answers | Ask whether the structure is useful | Measure the reward and watch behavior |
| Main risk | Wrong or biased labels | Meaningless patterns | A reward that can be gamed |
What can go wrong with a reward
A reward is only a stand-in for what you want. Say a hypothetical tutoring program is rewarded whenever a student answers correctly. It might discover that asking very easy questions earns plenty of reward while teaching almost nothing.
This behavior is called reward hacking: finding a way to score well that misses the point. It is not mischief in a human sense. The system is doing what the signal favors. Memorable patterns of reward hacking collects the typical shapes it takes.
Supervised and unsupervised systems have their own versions of the trap. A photo classifier may rely on background scenery that happened to match the labels. Careful testing on varied cases is the remedy in every style.
How a chatbot uses several of them
A modern chat assistant is usually not the product of one style. A common recipe, simplified, looks like this.
- Self-supervised training on a very large body of text teaches general language ability.
- Supervised fine-tuning on example conversations shows the form a helpful reply should take.
- Training with reinforcement, using human ratings or other scoring, nudges replies toward those judged better.
Developers vary the order, add steps and keep many details private. The broad point holds: the styles are tools that can be combined. The article on human feedback explains the third step, and training without the math covers the underlying loop.
Note one more point. Chatting with a finished assistant is not, by itself, reinforcement learning happening live. Whether conversations are later used for training depends on the provider's policies and your settings.
How each kind is checked
Because the feedback differs, so does the way you find out whether learning worked.
For a supervised system, you keep some labeled examples hidden during training and compare the predictions with their labels afterward. A single accuracy figure can mislead. If only 1 payment in 1,000 is fraudulent, a program that calls everything honest is right 99.9 percent of the time and catches nothing. People therefore look separately at how many real cases were caught and how many alarms were false.
For an unsupervised result, there is no answer key. You might check whether the groups stay similar when the method is run again on a different sample, whether a knowledgeable person can describe each one and whether acting on them helps. A grouping that nobody can explain or use is of little value, however neat it looks on a chart.
For reinforcement learning, you watch the reward over many fresh attempts, including conditions that did not appear in training. It also pays to watch the behavior itself, since a high score can hide a strange method. Where mistakes could damage equipment or hurt someone, learned policies are normally tested in simulation first and run with fixed safety limits that learning cannot override.
Choosing the right label for a problem
Try sorting these hypothetical tasks.
- A clinic has past appointment records marked "attended" or "missed" and wants to predict no-shows. This is supervised.
- A museum has thousands of visitor comments and wants to see which themes come up. This is mainly unsupervised.
- A warehouse wants a simulated cart to learn efficient routes by trying them. This fits reinforcement learning.
Real projects often do not need machine learning at all. If a simple rule solves the problem, such as sending a reminder to everyone the day before, it will be cheaper and easier to explain. When predictions affect people, ask what the labels or rewards actually measure and who could be disadvantaged by errors.
Common questions
Is deep learning a fourth type?
No. Deep learning refers to using neural networks with many layers. It can be supervised, unsupervised, self-supervised or reinforcement based.
Does unsupervised mean no humans are involved?
People still choose the data, the method and the settings, and they interpret the results. Only the per-example answers are missing.
Which style is closest to how people learn?
People seem to learn in all of these ways and others, including instruction and imitation. The comparisons are helpful for intuition but should not be taken as a description of the brain.