◆ AI All-in-One

Level 1 Use AI · Getting Started

Supervised, Unsupervised and Reinforcement Learning

The main ways a machine can learn — from labelled examples, from raw unlabelled data, from trial and error with rewards, and from puzzles it makes out of the data itself — and how to tell which one a problem needs.

Level
●●●●● Beginner
Reading
10 min
To learn it well
40 minutes to read
↗ Plan a path here

Read first

How Machines Learn

This leads to

Supervised LearningUnsupervised LearningReinforcement Learning: The Basics
The full path from zero — 2 concepts before this one
  1. What Is AI?
  2. How Machines Learn
  3. Supervised, Unsupervised and Reinforcement Learning

Read them roughly in this order. See it on the concept map →

Why it matters

How Machines Learn described one loop: make predictions, measure the error, nudge the knobs. But it quietly assumed something: that for every example we already know the right answer so we can measure the error. Often we don't. Nobody has labelled every photo on the internet, every shopper's "type", or the best move in every chess position.

So machine learning has grown several styles, depending on what kind of feedback is available. Knowing them is the single most useful way to make sense of AI news. When you read that "a model learned to play Go by playing against itself", or "a language model was pretrained on the internet and then fine-tuned with human feedback", you are reading about these styles. They also decide, in practice, what a project will cost. Labelled data is expensive. Raw data is cheap.

The intuition

Think of four ways a person learns.

  • A student works through a textbook where every exercise has the answer in the back. They check each attempt and correct themselves. That is supervised learning.
  • A visitor wanders a foreign market with no guide and notices, unprompted, that the stalls fall into groups: spices here, fabrics there, phone repairs at the end. That is unsupervised learning.
  • A child learns to ride a bike. Nobody can describe the right muscle movements. The child tries, wobbles, falls (bad), stays up a bit longer (good), and gradually improves. That is reinforcement learning.
  • A reader covers the next word of a novel with a finger, guesses it, then checks. Every page provides thousands of free exercises with built-in answers. That is self-supervised learning, and it is how today's large language models learn most of what they know.
Supervised every example comes with its answer Unsupervised only data: find the structure Reinforcement act, then get a reward now and then Self-supervised hide part of the data, predict it email 1email 2email 3 spamnot spamspam labels groups found, no names given Agent Environment action new situation + reward (sometimes) e.g. a game, a robot, a chess board Thecatsaton ??? answer: "the" taken from the text itself no human labels needed: every sentence is a free exercise
Fig. 1 The four main styles of machine learning. Supervised learning gets an answer for every example. Unsupervised learning gets only the data and looks for structure. Reinforcement learning acts, and gets a reward signal now and then. Self-supervised learning hides part of each example and learns to fill it in.

Key idea The styles differ in what feedback the learner gets: the right answer for each example (supervised), nothing but the data (unsupervised), a score after acting (reinforcement), or answers manufactured from the data itself (self-supervised).

How it works

Supervised learning: learning from answered examples

In supervised learning, every training example comes with the correct answer, called a label. Data with these answers attached is called labelled data. The model learns to map inputs to labels, and the error is simply "how far was your answer from the label?"

Two flavours cover most uses:

  • Classification: the answer is a category. Is this email spam or not? Which of 1,000 object types is in this photo? Is this tumour benign or malignant?
  • Regression: the answer is a number. What rent will this flat fetch? How many kilowatt-hours will the city use tomorrow at 6 pm?

Supervised learning is the workhorse of practical machine learning: fraud detection, credit scoring, medical image screening, demand forecasting, speech-to-text. Its weakness is the labels. Someone has to provide them. The ImageNet dataset, which kick-started the deep learning boom, needed about 14 million images labelled by tens of thousands of crowd workers. A medical dataset might need hours of a specialist's time per scan. Supervised Learning goes deeper.

Unsupervised learning: finding structure on your own

In unsupervised learning there are no labels at all, just a pile of data. The goal is to find structure in it.

  • Clustering groups similar items together. A shop might cluster its customers by what they buy and discover "weekend bulk-buyers", "late-night snackers" and "once-a-year gift shoppers", groups nobody defined in advance. See k-Means Clustering.
  • Anomaly detection learns what "normal" looks like and flags what doesn't fit: an unusual card transaction, a vibration pattern that means a machine is about to fail. See Anomaly Detection.
  • Dimensionality reduction squeezes data with many measurements down to a few, keeping what matters, often to draw a map of it. See PCA and Dimensionality Reduction.

Because there is no right answer to compare against, unsupervised results need human judgement. The algorithm will always find some groups. Whether they mean anything is up to you. Unsupervised Learning covers the methods.

Reinforcement learning: learning by trial, error and reward

In reinforcement learning (RL), the learner is an agent that takes actions in an environment: a game, a simulated robot, a stock market, a conversation. After acting it sometimes receives a reward, a number saying how well things went. No one tells it the right action. It must discover which actions lead to high reward over time, often when the reward arrives long after the decisive move. A chess game is won or lost only at the end, so which of the 40 moves deserves the credit?

This is the hardest style, but also the one that can surpass human teachers, because the agent can discover strategies nobody showed it. DeepMind's AlphaGo learned first from human games (supervised) and then improved by playing millions of games against itself (reinforcement). In 2016 it beat Lee Sedol, one of the world's best players, 4 games to 1. Its successor AlphaGo Zero (2017) skipped the human games entirely and became stronger still. RL also trains robots in simulation, controls cooling in data centres and — importantly for chatbots — is used to polish language models with human feedback (RLHF and Preference Optimization). The Reinforcement Learning: The Basics chapter starts the full story.

Self-supervised learning: making your own exercises

Self-supervised learning is a clever way of getting supervised-style training without paying anyone for labels. You take raw data and hide part of it, and the hidden part becomes the label.

  • Take a sentence, hide the next word, and ask the model to predict it. The text itself supplies the answer. This is exactly how GPT-style language models are trained: on trillions of words, each one a free exercise. See Language Modeling and Next-Token Prediction.
  • Hide a random word in the middle of a sentence and predict it. That is how BERT was trained (BERT and Encoder Models).
  • Cover patches of a photo and predict what was there, or show two crops of the same photo and learn that they match.

Because the internet supplies effectively unlimited raw text and images, self-supervision is what made today's enormous models possible. Some people count it as a kind of unsupervised learning (no human labels), others as supervised (there is an answer to check). The mechanism is supervised; the data is unlabelled. See Self-Supervised Learning.

Mixing the styles

Real systems usually combine styles. A modern chatbot is built in three stages: self-supervised pretraining on internet text, supervised fine-tuning on example conversations written by people, and reinforcement learning from human or automated feedback. Large Language Models, Explained Simply tells that story.

There is also semi-supervised learning: a small set of labelled examples plus a large set of unlabelled ones, with the model using the unlabelled data to learn general structure. If you have 500 labelled X-rays and 50,000 unlabelled ones, this is the situation you are in.

Which one does my problem need?

Ask what feedback you have, or can cheaply get.

Do you have the right answer for many past examples? Must the system take actions and can you score the outcome? Do you want a general model from huge amounts of raw data? yes yes yes no no no Supervised learning spam filters, price prediction, diagnosis Reinforcement learning games, robots, tuning chatbots Self-supervised pretraining language models, image encoders Unsupervised learning find groups, oddities, a map of the data
Fig. 2 A decision guide. If you have the right answer for many past examples, use supervised learning. If the system must take a sequence of actions and you can score the outcome, use reinforcement learning. If you only have raw data and want to discover groups or oddities, use unsupervised learning. If you have huge amounts of raw data and want a general-purpose model, use self-supervised pretraining.

A few worked scenarios:

Problem What you have Style
Flag fraudulent card payments Past payments, some confirmed as fraud Supervised (classification), often plus anomaly detection for new fraud types
Group 2 million customers for marketing Purchase histories, no categories Unsupervised (clustering)
Teach a robot arm to stack blocks A simulator and a way to score "stacked" Reinforcement
Forecast next week's sales Years of past sales figures Supervised (regression on time series)
Build a model that can summarise any text Billions of web pages Self-supervised pretraining, then fine-tuning
Spot defective parts on a production line Thousands of photos of good parts, only a dozen of bad ones Anomaly detection (learn "normal"), or supervised with Data Augmentation

Tip In practice, the first question to ask is not "which algorithm?" but "where will the labels come from?" If you can get good labels cheaply, supervised learning is usually the simplest and most reliable route. Today you can often avoid training anything at all: a pretrained model plus a well-written prompt handles many classification tasks. See Prompt Engineering.

In code (optional)

The same flower measurements, learned two ways with scikit-learn. With labels we can ask "which species is this?". Without labels we can only ask "what groups are there?"

from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
from sklearn.cluster import KMeans

X, y = load_iris(return_X_y=True)   # 150 flowers, 4 measurements each, 3 species

# Supervised: we give the species labels, then ask about a new flower
clf = DecisionTreeClassifier(random_state=0).fit(X, y)
new_flower = [[5.0, 3.4, 1.5, 0.2]]
print("supervised guess:", load_iris().target_names[clf.predict(new_flower)[0]])

# Unsupervised: no labels at all, just "find 3 natural groups"
km = KMeans(n_clusters=3, n_init=10, random_state=0).fit(X)
print("group sizes found:", sorted(int((km.labels_ == k).sum()) for k in range(3)))
print("true species sizes:", [50, 50, 50])

# supervised guess: setosa
# group sizes found: [38, 50, 62]
# true species sizes: [50, 50, 50]

The clustering finds one species perfectly (the 50) but blurs the other two, which really do overlap in their measurements. Without labels, it has no way to know where the botanists draw the line.

Common pitfalls

  • Assuming clusters are real categories. Clustering always returns groups, even on random noise. Check that they are stable and that they mean something to a domain expert.
  • Bad labels. Supervised models learn the labels you give them, mistakes and biases included. If radiologists disagree on 10% of scans, the model can't be more consistent than the labels allow.
  • Reward hacking. RL agents optimise exactly the reward you wrote, not the one you meant. A famous OpenAI demo showed a boat-racing agent that circled forever, hitting the same bonus targets, instead of finishing the race. Designing rewards is hard. See AI Alignment.
  • Treating self-supervised models as fact databases. A model trained to predict plausible next words learns what text usually says, which is not always what is true. See Hallucinations.

Watch out Whatever the style, the model learns from the feedback you give it, not your intentions. Wrong labels, a lazy reward or a skewed dataset all produce a model that is very good at the wrong thing.

Where it leads

A bit of history

Supervised learning is the oldest: Rosenblatt's The Perceptron (1958) learned from labelled examples. Clustering methods such as k-means date from the 1950s and 1960s. Reinforcement learning grew out of psychology's studies of reward and from control engineering. Richard Sutton and Andrew Barto turned it into a field in the 1980s, and won the 2024 Turing Award for it. Self-supervision is old as an idea (word embeddings like word2vec in 2013 used it), but it became the main event after 2018, when BERT and GPT showed that predicting hidden words on huge text collections produced models that could be adapted to almost any language task.

Try it

  1. For each, name the style: (a) a music app grouping songs into "moods" nobody defined; (b) a thermostat learning to save energy by trying settings and seeing your bill; (c) a phone keyboard suggesting your next word; (d) a bank predicting loan defaults from 10 years of loan records.
  2. Pick a problem from your own life or job. What feedback could you realistically collect? Which style does that point to?

Answers to 1: (a) unsupervised; (b) reinforcement; (c) self-supervised; (d) supervised.

Check your understanding

4 quick questions. Pick an answer to see whether you were right and why. Your best score is saved on this device.

  1. Your company wants to group 2 million customers by purchase history. Nobody has defined any customer types in advance. Which style of learning fits?

  2. Why could GPT-style models be trained on trillions of words without paying anyone to label them?

  3. You have 500 X-rays labelled by radiologists and 50,000 unlabelled ones. Which description fits your situation?

  4. A boat-racing agent learns to circle forever hitting bonus targets instead of finishing the race. What went wrong?

Finished this chapter?

Learn more

Hand-picked courses, books, videos and tutorials for going deeper. See all resources →

Course

Machine Learning Crash Course

Google · Beginner · Free

Short, practical lessons with interactive visualisations covering regression, classification, embeddings and neural nets.

Course

Machine Learning Specialization

Andrew Ng (DeepLearning.AI & Stanford) · Beginner · free to audit

The best-known first course in ML. Covers regression, classification, neural nets, trees, clustering, recommenders and RL with Python labs.

Video

StatQuest

Josh Starmer · Beginner · Free

Short, cheerful, very clear videos on statistics and nearly every ML algorithm.

Course

Hugging Face Deep RL Course

Hugging Face · Intermediate · Free

A hands-on deep reinforcement learning course from Q-learning to PPO. You train agents in games.

Course

Elements of AI

University of Helsinki & MinnaLearn · Beginner · Free

A gentle, maths-free online course on what AI is and how it works. Over a million people have taken it.

Facts checked as of 30 November 2026. Fast-moving details (products, prices, laws) change often. · Source: content/entries/start/types-of-learning.md