ML Fundamentals
Types of Machine Learning: Supervised, Unsupervised and Reinforcement
Machine learning splits into three families by what the learner is told: the answer every time, nothing at all, or a score after acting. Supervised, unsupervised and reinforcement, mapped.
beginner · 11 min read
Lesson content
Machine learning is not one technique. It is a few distinct families, and the thing that separates them is easier than the names suggest.
Ask one question: what does the data tell the learner? Does every example arrive with the correct answer attached, does it arrive with no answer at all, or does the answer only show up as a score after the learner has already acted?
Those three situations are supervised, unsupervised and reinforcement learning. Almost every method you will meet on this site sits in one of them.
Definition
The three families
Supervised learning learns from examples with correct answers attached. Unsupervised learning finds structure in data with no answers. Reinforcement learning learns by taking actions and receiving rewards.
Formal definition
Supervised learning maps inputs to known target outputs. Unsupervised learning models the structure of unlabeled inputs. Reinforcement learning learns a policy by interacting with an environment so as to maximize cumulative reward.
- Supervised learning
Every example comes with the right answer, either a category or a number, and the model learns to reproduce it.
This is the biggest family by far. Spam filters, price prediction, credit scoring and medical triage all live here.
- Unsupervised learning
The data has no answers. The model looks for structure on its own: natural groupings, or a simpler summary of many columns.
It is how you explore data nobody has labeled yet, which is most data that exists.
- Reinforcement learning
An agent takes actions in an environment and learns from the reward or penalty each action eventually brings.
It fits sequential decisions where there is no answer key: game playing, robot control, resource scheduling.
The gap between the first two is about your data. The gap between those two and the third is about time.
A supervised or unsupervised model is handed a fixed table and works on it. A reinforcement learner has no table. It produces its own experience by acting, and the consequences of an early action may not show up for hundreds of steps.
That single difference is why reinforcement learning needs a whole path of its own on this site.
| What the data gives | Goal | Worked example | |
|---|---|---|---|
| Supervised | Inputs and correct answers | Predict the answer for new inputs | Predict a house price from its size and age |
| Unsupervised | Inputs only, no answers | Find hidden structure | Group 50,000 customers into segments nobody defined |
| Reinforcement | A reward after each action | Learn a strategy that pays off over time | Teach a robot to walk without falling |
Supervised
- What the data gives
- Inputs and correct answers
- Goal
- Predict the answer for new inputs
- Worked example
- Predict a house price from its size and age
Unsupervised
- What the data gives
- Inputs only, no answers
- Goal
- Find hidden structure
- Worked example
- Group 50,000 customers into segments nobody defined
Reinforcement
- What the data gives
- A reward after each action
- Goal
- Learn a strategy that pays off over time
- Worked example
- Teach a robot to walk without falling
How do I tell which family a new problem belongs to?
Look at what you already have, not at what you want.
If every example in your data comes with the answer you want to predict, it is supervised. If you have plenty of data but no answers, and the job is to discover structure that is already there, it is unsupervised. If there is no dataset of answers at all, only an environment that scores your decisions as you go, it is reinforcement.
The data decides the family. The algorithm is a choice you make afterwards, inside whichever family you landed in.
| Problem | What you have | Family |
|---|---|---|
| Flag fraudulent transactions | Past transactions, each marked fraud or not | Supervised |
| Find topics in 100,000 support tickets | The tickets, unlabeled | Unsupervised |
| Play chess better than a person | A board, legal moves, win or lose at the end | Reinforcement |
| Predict tomorrow's electricity demand | Years of hourly demand records | Supervised |
| Spot unusual server behavior | Server metrics, nobody labeled the outages | Unsupervised |
| Route delivery vans through a city | A simulator that scores each completed route | Reinforcement |
Notice that two of these problems sound similar and land in different families. Fraud detection has labels because somebody eventually reported the fraud. Server anomalies often do not, which is exactly why they are harder.
Example
One dataset, three different questions
Take a year of supermarket receipts.
Ask "will this customer churn next month?" and you need churn labels from last year. That is supervised.
Ask "what kinds of shopper are in here?" and there is nothing to label, because nobody has decided what the kinds are. That is unsupervised.
Ask "which discount should I offer each shopper this week to maximize profit over the next year?" and no fixed answer exists at all. You only find out by offering something and watching what happens. That is reinforcement.
Same data, three families, decided entirely by the question and what evidence you can get for it.
Three ways to learn a city
Supervised learning is being driven around by someone who names every street as you pass it. You get the answer for each example, so you learn the map quickly.
Unsupervised learning is being dropped in with no guide. Nobody tells you any names, but after a few days you notice this part is all restaurants and that part is all offices. You found the structure without ever being told it.
Reinforcement learning is being told only "you are late" or "you are early" when you arrive. No street names, no map. Just a score, after the fact, for a whole sequence of turns.
Reinforcement learning is not simply the advanced option
Reinforcement learning gets the headlines, so it is tempting to reach for it. Resist that unless your problem genuinely has the shape.
It needs an environment you can interact with cheaply, thousands or millions of times. If every trial costs a real delivery, a real patient or a real customer, you cannot afford the experience it requires.
When you already have labeled examples of good decisions, supervised learning is simpler, faster and far more data-efficient. Use it.
One more term you will meet: semi-supervised learning. It sits between the first two, using a small pile of labeled data alongside a much larger pile of unlabeled data.
It exists because labels are expensive. A radiologist can mark a thousand scans, not a million, but the million unlabeled scans still carry information about what scans look like in general.
It is a practical blend rather than a fourth idea, which is why it makes more sense once the three families are clear.
Choosing the family from the algorithm you want to use.
The data chooses the family. Wanting to use a neural network tells you nothing, because there are neural networks in all three.
Assuming unlabeled data means unsupervised learning.
Often it means you have a labeling job ahead of you. If the answers could be collected, collecting them usually beats working around their absence.
Calling clustering a kind of classification.
Classification puts examples into categories somebody defined. Clustering invents the categories. Two clusterings of the same data can both be right.
Expecting a reinforcement learner to work from a static dataset.
It learns from consequences, so it needs to act and see what happens. Learning a policy from logs alone is a harder, separate problem called offline RL.
Key takeaway
- The three families are supervised, unsupervised and reinforcement learning.
- What separates them is what the learner is told: the answer every time, nothing, or a score after acting.
- Supervised learning reproduces known answers, unsupervised finds structure, reinforcement learns a strategy.
- Your data decides the family. The algorithm is a later choice made inside it.
- Reinforcement learning needs a cheap environment to experiment in, which most business problems do not have.
- Semi-supervised learning blends the first two, because labels cost money and unlabeled data does not.
Finished this lesson?
Guest progress is saved on this device.