Supervised vs Unsupervised vs Reinforcement Learning: What Actually Separates Them
The textbook answer is “labels, no labels, rewards”. It is true, and it doesn’t help much when you are looking at a real problem. The difference that matters is what the learner is told after it guesses, and who chooses the data.
Every introduction to machine learning opens with the same three boxes. Supervised learning has labeled data. Unsupervised learning has unlabeled data. Reinforcement learning has rewards. You can pass a quiz with that and still have no idea which box a real problem belongs in, or why a language model seems to sit in all three at once.
A more useful way to split them is to ask what the learner is told after it makes a guess. In supervised learning it is told the right answer. In unsupervised learning it is told nothing. In reinforcement learning it is told how well it did, which is not the same as being told what it should have done. The rest of this article is that one idea, worked through.
The comparison at a glance
| What it learns from | What it learns | |
|---|---|---|
| Supervised | Examples paired with correct answers. After each guess it is told the right one. | A function from input to output |
| Unsupervised | Examples only. Nobody supplies right answers. | Structure in the data: groups, directions, what is typical |
| Reinforcement | Its own actions in an environment. It gets a reward that says how good the outcome was, often much later. | A policy: what to do in each situation |
| Typical methods | Typical uses | |
|---|---|---|
| Supervised | Linear and logistic regression, decision trees, gradient boosting, neural networks | Spam filtering, price prediction, reading medical images |
| Unsupervised | k-means, PCA, Gaussian mixtures, autoencoders | Customer segments, anomaly detection, compressing and visualizing data |
| Reinforcement | Q-learning, policy gradients, PPO | Game playing, robot control, choosing what to recommend next |
Supervised learning: learning from an answer key
Supervised learning is the one to understand first, because it is the workhorse of the field and the easiest to get right. You have inputs and, for each one, the output you wish a program would produce: emails marked spam or not, houses with their sale prices, scans with a radiologist’s diagnosis. The algorithm’s job is to find a function that maps one to the other and keeps working on inputs it has never seen.
If the output is a number, the task is called regression. If it is a category, it is classification. The same few ideas run through both: choose a family of functions, measure how wrong a candidate is with a loss, and adjust the candidate to shrink the loss. A linear regression and a neural network with a billion parameters differ in the family, not in the recipe.
The phrase “never seen” is where the difficulty lives. A model can score perfectly on its training examples by memorizing them and still be useless on new ones. Much of the craft of machine learning is holding data back to check for this, and managing the trade-off between fitting too little and fitting too much. (One standard tool for it gets its own article: L1 vs L2 regularization.)
The catch is the labels. Somebody has to produce the answer key, and for a set of medical scans that somebody is a specialist, one image at a time.
Unsupervised learning: no answer key at all
Take away the labels and you can still ask what the data looks like. That is unsupervised learning, and it comes in three main flavors.
- Clustering groups similar examples: customers with similar habits, documents on similar topics.
- Dimensionality reduction finds a few combined measurements that carry most of the information in hundreds of raw ones, so the data can be compressed or drawn on a screen.
- Density estimation learns what typical data looks like, which is what you need in order to flag the transaction that isn’t typical.
The data is cheap, since nobody has to label it. The price is paid at the other end: with no right answers there is no error rate. If k-means hands you five customer segments, nothing in the algorithm can tell you whether five was the right number or whether the segments mean anything. There are rules of thumb, but in the end a person has to judge, usually by asking whether the result is useful for something.
Reinforcement learning: learning from a score
Reinforcement learning (RL) is about decisions that follow one another. An agent looks at its situation and takes an action, and the world answers with a new situation and sometimes a reward. The goal is to collect as much reward as possible over time. A program learning chess by playing it, a controller learning to keep a robot upright, and a system deciding which article to show you next all fit the description.
Three things make this harder than supervised learning, and they are worth keeping apart.
The feedback evaluates; it does not instruct. A supervised learner that answers “cat” is told “no, dog”. An RL agent that makes a move is told, at best, “that was worth 3 points”. Was there a move worth 10? Nobody says. It has to try other moves to find out. Sutton and Barto’s standard textbook treats this as the feature that most sets reinforcement learning apart from other kinds of learning, and it is the root of the explore-or-exploit dilemma: every action is either the best one you know or an experiment, and it can’t be both.
Rewards arrive late. A chess game is won or lost after dozens of moves. Which of them deserves the credit? This is called the credit assignment problem, and most of the classic algorithms, from temporal-difference learning onward, are answers to it.
The learner chooses its own data. A supervised dataset sits still. An RL agent sees only the consequences of what it decided to do, so a bad early habit can keep it away from the very situations that would have taught it better.
Our reinforcement learning course starts from this loop of acting and being scored and builds everything else on it.
One goal, three kinds of information
The three types are less three kinds of problem than three kinds of information you might have. Take a single goal, a program that plays Go well, and look at what each kind of information buys you.
With records of expert games you can do supervised learning: show a network a board position and train it to predict the move the human played. (Copying an expert this way has its own name, imitation learning.) With no labels at all you could run unsupervised learning on a pile of positions and discover, say, families of similar openings, which is interesting and doesn’t win games. With nothing but the rules and the ability to play, you can do reinforcement learning: play, see who won, and shift toward the moves that led to wins.
This is not a thought experiment. The first version of AlphaGo, published in 2016, began with supervised learning on about thirty million positions from human games and then improved by reinforcement learning, playing against itself. Its successor AlphaGo Zero, in 2017, dropped the human games, learned from self-play alone, and beat the version that had defeated the champion Lee Sedol by 100 games to 0.
Where self-supervised learning and language models fit
The three boxes were drawn decades ago, and the technique behind today’s language models sits awkwardly across two of them.
Self-supervised learning takes unlabeled data and manufactures labels from it. Hide the next word of a sentence and ask the model to predict it. Mask a patch of an image and ask the model to fill it in. Nobody labeled anything, so by the usual definition this is unsupervised. But the training itself, predict a target and be corrected with the right answer, is supervised learning in every mechanical detail. It is how language models are pretrained, and it works because text is its own answer key, in practically unlimited supply.
A modern chat assistant then draws on the other boxes too. After pretraining, a model is typically fine-tuned on examples of good responses written or chosen by people, which is ordinary supervised learning. Many are then tuned further with reinforcement learning from human feedback, in which people compare pairs of answers and the model is rewarded for producing the kind they prefer. One system, all three kinds of signal.
There is also semi-supervised learning, which is what it sounds like: a few labeled examples and many unlabeled ones, used together.
Is deep learning a fourth type?
No, though the two are often confused. The three types describe the feedback a model learns from. Deep learning describes the model: a neural network with many layers. The two choices are independent. A deep network can be trained on labeled images (supervised), on raw text with words hidden (self-supervised), or on the outcomes of games (reinforcement, where it goes by the name deep RL). So can a much simpler model.
Deep learning is one way of filling in the box marked “function”. The type of learning decides how that function gets corrected. If you want the main kinds of network set side by side, see CNN vs RNN vs Transformer.
How to tell which one you need
Ask these questions in order.
- Do you have examples of the output you want, or can you get them? Then it is supervised learning, and you should be glad. It is the most predictable of the three, and if a few thousand labels can be bought, buying them is usually cheaper than any alternative.
- Are there no right answers, and you want to understand or summarize the data? Unsupervised learning. Decide in advance how you will judge whether the result is useful.
- Is it a sequence of decisions, where each one changes what happens next and you can only score the outcome? Reinforcement learning. Check first whether you can try things safely and cheaply, in a simulator or on logged data, because RL learns by making mistakes and it makes a great many of them.
If the honest answer to the third question is “I just need to pick the best of a few options, over and over”, you have the simplest RL problem there is, a bandit, and it is far easier to get working than the full version.
Common questions
What are the three types of machine learning?
Supervised learning, which learns from examples that come with correct answers. Unsupervised learning, which finds structure in examples that come without them. Reinforcement learning, which learns to make decisions from rewards. Self-supervised and semi-supervised learning are common hybrids of the first two.
What is the difference between classification and clustering?
Both put things into groups. In classification the groups are fixed in advance and you have labeled examples of each, so it is supervised. In clustering the algorithm invents the groups from the data, so it is unsupervised, and the groups come without names.
Is reinforcement learning supervised or unsupervised?
Neither. It has no answer key, which rules out supervised. It does have a feedback signal, the reward, which rules out unsupervised. It gets its own category because the feedback is a score for what was done, not a correction.
Which type should I learn first?
Supervised learning. Loss functions, gradient descent, overfitting and validation all appear there in their simplest form, and the other two types reuse them. Our machine learning course follows that order, and one lesson, Supervised, Unsupervised & Beyond, maps the whole territory, with simulations for a classifier, k-means clustering and a bandit.
Which type is used most in practice?
Supervised learning still accounts for a large share of the machine learning in everyday use, and self-supervised pretraining is the foundation of today’s large language and vision models. Reinforcement learning is behind some of the most striking results in games and robotics, but it is harder to apply, and it earns its place where a problem really is a sequence of decisions.