Machine Learning ML-00.02
Types of learning
Tell supervised, unsupervised, self-supervised, semi-supervised and reinforcement learning apart from a one-line problem statement.
The big idea
All machine learning learns from data, but the data comes in very different shapes. Sometimes every example arrives with the right answer attached. Sometimes there are no answers at all, only a heap of raw examples. Sometimes the only feedback is a score that arrives long after you acted. Each situation needs a different kind of learning, and naming it correctly is the first decision in any ML project.
A good way to remember the families: think about how a person learns to cook. With a teacher who tastes every dish and says "too salty" or "perfect", that is supervised learning. Sorting a cupboard of unlabeled spices into groups by smell, with nobody telling you the names, is unsupervised learning. Covering half a recipe and guessing the missing step from the rest is self-supervised learning. And learning to run a busy restaurant, where the only feedback is whether customers come back next month, is reinforcement learning.
How it works
Supervised learning: every example has an answer
In supervised learningLearning from examples that each come with the correct answer, so the model learns to map inputs to that answer., each training example has a label, and the model learns to predict it. It comes in two flavours, decided by what the label looks like:
- RegressionSupervised learning where the label is a number, such as a price, a temperature or a delivery time.: the label is a number. House price, tomorrow's temperature, minutes until your food arrives.
- ClassificationSupervised learning where the label is a category, such as spam or not spam, or which digit an image shows.: the label is a category. Spam or not spam, which of ten digits, which of 1,000 dog breeds.
Most ML in industry is supervised, because businesses often have historical outcomes: which loans defaulted, which customers cancelled, which transactions were fraud.
Unsupervised learning: find structure without answers
In unsupervised learningLearning from data with no labels, to discover structure such as groups, patterns or a simpler representation. there are no labels. The goal is to discover structure the data already has:
- Clustering groups similar examples: customer segments, similar news stories, families of malware.
- Dimensionality reduction squeezes many features into a few while keeping most of the information, for plotting or to speed up other models.
- Anomaly detection flags examples that do not look like the rest, such as a server suddenly behaving oddly.
There is no right answer to check against, so judging the result needs care. You will learn the methods in k-means clustering .
Self-supervised learning: the data labels itself
Labels are expensive, but raw data is plentiful. Self-supervised learningLearning where the labels are created automatically from the data itself, for example by hiding part of an input and predicting it. manufactures labels from the data itself. Hide the next word of a sentence and predict it; hide a patch of a photo and reconstruct it. Every sentence on the internet becomes a free training example. This is how large language models are pretrained, before any human-written answers are involved.
Semi-supervised learning: a few labels, lots of data
Sometimes you have a small labeled set and a huge unlabeled one: 200 medical scans with a diagnosis and 50,000 without. Semi-supervised learningLearning from a small labeled set plus a large unlabeled set, using the unlabeled data to improve what the labels alone teach. uses the unlabeled pile to learn what normal data looks like, which makes the few labels go much further.
Reinforcement learning: learn from rewards
In reinforcement learningLearning by trial and error: an agent takes actions in an environment and learns which actions lead to the most reward over time. (RL), an agent acts in an environment and gets a reward signal, often delayed. Nobody says which move was right; the agent discovers it by trying. Game-playing agents, robot control and some recommendation systems work this way, and a form of RL is used to fine-tune chat models on human preferences. The full story is in RL fundamentals and MDPs .
Recognising the type from a problem statement
Ask three questions, in order:
- Is there a correct answer for each example? If yes, it is supervised (number: regression, category: classification).
- If not, can you create the answer automatically from the data itself? Then it is self-supervised.
- Is the feedback a reward for actions taken over time? Then it is reinforcement learning. Otherwise, you are looking for structure: unsupervised.
A small labeled set next to a large unlabeled one is the semi-supervised case.
Try it
Try this:
- Sort all ten, press Check, and read the hint for any you missed.
- For the fraud problem, imagine investigators had labeled only 1 percent of transactions. Which bucket would it move to?
- Look at the two self-supervised items and say out loud where their labels come from.
Trade-offs
| Option | Wins when | Loses when |
|---|---|---|
| Supervised | You have reliable labels for the outcome you care about | Labels are expensive, slow or inconsistent to collect |
| Unsupervised | You want to explore data or find groups and outliers without labels | You need a specific prediction; results are hard to evaluate objectively |
| Self-supervised | You have huge amounts of raw text, images or audio and want general-purpose representations | Compute budget is small; you still usually need a supervised step for a specific task |
| Reinforcement | Decisions happen in sequence and the outcome is a measurable reward | Trial and error is unsafe or costly in the real world, and you cannot simulate it |
Common mistakes
- Calling every problem with numbers "regression". The question is whether the label is a number, not whether the features are.
- Choosing unsupervised learning because labeling looks like work, when the business needs a specific prediction. Spend on labels instead.
- Thinking self-supervised means "no human effort". Someone still chooses the pretext task, the data and the follow-up fine-tuning.
- Reaching for reinforcement learning when there is a fixed dataset of past outcomes. That is usually supervised learning in disguise.
In the wild
You can spot all five families in products you use. Email spam filters and loan decisions are supervised classification, and delivery time estimates are supervised regression. Customer segmentation and "similar items" features often start with clustering. Large language models are pretrained with self-supervised next-word prediction, and chat assistants are then tuned with human feedback using a form of reinforcement learning. Game-playing systems such as chess and Go engines that learned from self-play are reinforcement learning.
Check yourself
-
A model predicts how many minutes a food delivery will take, trained on past deliveries with their real durations. Which kind of learning?
Show answer
B. Regression Each past delivery has its real duration, a number. Supervised learning with a numeric label is regression.
-
Where do the labels come from when a language model learns to predict the next word?
Show answer
B. From the text itself: the next word is the label Self-supervised learning hides part of the data and uses it as the target, so every sentence supplies free labels.
-
You have 10 million product photos and 3,000 of them tagged with a category. What is the natural fit?
Show answer
B. Semi-supervised learning A small labeled set plus a large unlabeled set is exactly the semi-supervised setting.
-
Which problem is the best fit for reinforcement learning?
Show answer
C. Control a warehouse robot that is scored on deliveries completed per hour The robot takes actions in sequence and is judged by a reward, which is the reinforcement learning setup.
Recap
- Supervised learning learns from labeled examples: regression for numbers, classification for categories.
- Unsupervised learning finds structure without labels: clusters, compressed features, anomalies.
- Self-supervised learning makes labels from the data itself and powers large language model pretraining.
- Semi-supervised learning stretches a few labels with lots of unlabeled data; reinforcement learning learns from rewards.
- Pick the family by asking what feedback the data comes with.
Next up
- I know nothing yet learning path
- From notebook to production learning path