esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

Machine Learning Foundations / Core / 02.06

Types of machine learning

Five types of machine learning, side by side: what each one needs, what it does, and how to pick the right one for your problem.

13 min readFree

Why we sort machine learning into types

Imagine a big city with five kinds of teacher. One hands you a worked answer sheet. One hands you a pile of mess and says, 'find the order in it'. One hands you a few solved problems and a large pile of unsolved ones. One makes the exercises up from your own notes. One just lets you try things and tells you how you did. All five teach you something. What changes is the help you get, and so the kind of problem each one suits.

Machine learning has the same five teachers. The last lesson showed the idea of learning from data. This lesson is a map. We lay the five types side by side, so that when you meet a real problem you can say which one it calls for. Each type then gets a full lesson of its own after this one.

What separates the types is the signal the computer learns from. Wikipedia puts it this way: machine learning approaches are 'traditionally divided into three broad categories, which correspond to learning paradigms, depending on the nature of the "signal" or "feedback" available to the learning system'. IBM and Wikipedia also cover two more, semi-supervised and self-supervised learning. We will look at all five.

Key words

Label
The correct answer attached to an example, such as the name of the fruit in a photo.
Labeled data
Examples that come with their answers. Someone, or something, had to write those answers down.
Unlabeled data
Examples with no answers attached: just the raw photos, numbers or text.
Reward
A score that tells a program how well it just did. Higher is better.
Agent
The program that makes choices and learns from the rewards it gets.
Environment
Everything the agent acts in and gets feedback from, such as a game or a road.

Tip

When you read about any machine learning method, ask one question first: what does it learn from? Labels, no labels, a mix, labels it makes itself, or rewards. That one answer places it on this map.

The five types, one by one

Each type below has four short parts: what data it needs, a typical task, a daily-life example, and a 'like...' picture to remember it by. The examples are ours, chosen to be new to you. Where a fact comes from a source, we say so.

Supervised learning

Data it needs: labeled data. IBM says: 'Supervised learning is a machine learning technique that uses labeled data sets to train artificial intelligence (AI) models to identify the underlying patterns and relationships.' Every example comes with the right answer, and the model learns to give that answer for new examples.

Typical task: IBM says supervised tasks 'can be broadly divided into classification and regression problems'. Classification 'uses an algorithm to sort data into categories'. In regression 'the output is a continuous value', and IBM lists 'projections for sales revenue' among its tasks. A continuous value is a number that can land anywhere on a scale, such as a price or a temperature.

Daily example: a photo app that has seen thousands of pictures each marked 'beach', 'forest' or 'city', and now sorts your new holiday photos into those folders. Or a model that guesses a flat's monthly rent from its size and its street, after learning from rents that were already known.

Like: studying for an exam with an answer key at the back of the book. The next lesson goes deep on this one.

Unsupervised learning

Data it needs: unlabeled data, and nothing else. IBM says unsupervised learning 'uses machine learning (ML) algorithms to analyze and cluster unlabeled data sets. These algorithms discover hidden patterns or data groupings without the need for human intervention.' Wikipedia describes the same idea: 'No labels are given to the learning algorithm, leaving it on its own to find structure in its input.'

Typical task: IBM says unsupervised models are used for 'three main tasks—clustering, association, and dimensionality reduction'. Clustering 'groups unlabeled data based on their similarities or differences'. Association finds links between things that go together. Dimensionality reduction cuts the number of features to a manageable size while keeping what matters. IBM calls unsupervised learning a good fit for 'exploratory data analysis, cross-selling strategies, customer segmentation and image recognition'.

Daily example: IBM points to Spotify's 'Discover Weekly' playlist as an example of association: finding what listeners who like one thing also like. A shop that wants to split its customers into groups, without deciding the groups first, is another case.

Like: tipping a bag of mixed buttons onto a table and sorting them into piles, with nobody telling you what the piles should be called. A later lesson goes deep on it.

Semi-supervised learning

Data it needs: a mix. IBM says it 'uses both labeled and unlabeled data to train artificial intelligence (AI) models for classification and regression tasks'. Wikipedia places it 'between unsupervised learning (without any labelled training data) and supervised learning (with completely labelled training data)'.

Why it exists: labels cost effort. IBM says it is 'especially relevant in situations where obtaining a sufficient amount of labeled data is prohibitively difficult or expensive, but large amounts of unlabeled data are relatively easy to acquire.' IBM's examples of costly labeling are drug discovery, genetic sequencing and protein classification, where labeling 'requires very specific domain expertise'.

Typical task: the same ones as supervised learning, which are classification and regression, just with fewer labels to go on. Daily example: a library with a million scanned photos where staff have only had time to name a few thousand. The named ones guide the model, and the unnamed ones still help it learn.

Like: a teacher who marks a handful of your homework pages and leaves the rest of the pile for you to study alongside. A later lesson goes deep on it.

Self-supervised learning

Data it needs: unlabeled data, but the program makes its own labels from it. IBM says: 'Rather than relying on labeled datasets for supervisory signals, self-supervised models generate implicit labels from unstructured data.' IBM calls the invented practice tasks 'pretext tasks' and says they yield 'pseudo-labels' from unlabeled data.

Typical task: learn useful representations of raw data, then reuse them. IBM says these learned representations 'can be subsequently used as input to a downstream task, like a supervised learning task or reinforcement learning task.' Its own example: 'randomly hiding (or "masking") parts of a sentence and tasking a self-supervised model with predicting the hidden words, using the original (unlabeled) sentence as ground truth.'

Daily example: take any sentence, cover one word, and guess it. The covered word is the answer, and it came free from the sentence itself. IBM says self-supervised learning is used to train large language models such as BERT and GPT.

Like: making your own flash cards from a textbook by covering a word on each line. No one wrote the answers, because the book already holds them.

Reinforcement learning

Data it needs: neither a table of answers nor a pile of raw data, but a world to act in and a reward score. IBM says reinforcement learning is 'a type of machine learning process in which autonomous agents learn to make decisions by interacting with their environment'. It learns 'by trial and error in the absence of any guidance from a human user', and 'does not use labeled examples of correct or incorrect behavior'.

How it feels different: IBM says that 'reinforcement learning learns to act'. The program takes an action, the environment answers with a reward or none, and the agent's 'only objective is to maximize its cumulative rewards'. Wikipedia words it as how agents 'ought to take actions in an environment to maximise some notion of cumulative reward'.

Typical task: choosing a series of actions, one after another. IBM says it has been 'a core area of interest in robotics', including attempts to 'automate driving'. Daily example: a program that learns a puzzle game by playing it again and again, scoring points for good moves.

Like: learning to ride a bike. No one gives you a table of right answers. You wobble, you fall, you stay up a little longer next time. A later lesson goes deep on this one.

Labels and no labels, in code

A small experiment makes the first difference concrete. Below is the same tiny set of fruit weights twice: once with names, once without. With names, the code learns a cutoff weight between the two named groups. Without names, it can only look for the biggest gap and split there. It finds two groups, but it cannot tell you what to call them.

  1. 1

    1. Write the labeled data

    Each example is a weight in grams and the fruit's name, which is the label.

  2. 2

    2. Keep only the weights

    Dropping the names gives us the unlabeled version of the same data.

  3. 3

    3. Learn with labels

    Find the lightest apple and the heaviest lemon, and put the cutoff halfway between them. Then guess a new fruit.

  4. 4

    4. Learn without labels

    Sort the weights and split at the biggest jump. The two groups appear, with no names.

fruit.py
labelled = [(120, "apple"), (130, "apple"), (60, "lemon"), (55, "lemon")]
unlabelled = [weight for weight, name in labelled]

print("labelled:", labelled)
print("unlabelled:", unlabelled)

# With labels: learn a cutoff between the two named groups.
apples = [w for w, name in labelled if name == "apple"]
lemons = [w for w, name in labelled if name == "lemon"]
cutoff = (min(apples) + max(lemons)) / 2
print("cutoff learned from labels:", cutoff)
print("118 g fruit is predicted to be:", "apple" if 118 > cutoff else "lemon")

# Without labels: split at the biggest gap between sorted weights.
ordered = sorted(unlabelled)
gaps = [(ordered[i + 1] - ordered[i], i) for i in range(len(ordered) - 1)]
biggest, i = max(gaps)
print("groups found without labels:", ordered[: i + 1], ordered[i + 1 :])

Output

labelled: [(120, 'apple'), (130, 'apple'), (60, 'lemon'), (55, 'lemon')]
unlabelled: [120, 130, 60, 55]
cutoff learned from labels: 90.0
118 g fruit is predicted to be: apple
groups found without labels: [55, 60] [120, 130]

The labeled version answers a question we asked: is this new fruit an apple or a lemon? The unlabeled version answers a question we did not ask: are there groups here? That is the whole gap between supervised and unsupervised learning, in about ten lines. Real methods are far smarter, but they begin from the same split.

Another way to sort: when the learning happens

The five types are about what a program learns from. You can also ask when it learns. Wikipedia describes two styles. In batch learning, the program learns 'on the entire training data set at once'. In online machine learning, 'data becomes available in a sequential order and is used to update the best predictor for future data at each step'.

Think of a student. A batch student reads the whole textbook before the exam. An online student learns a little from each new page as it arrives, and keeps adjusting.

Why choose online? Wikipedia says it is common 'where it is computationally infeasible to train over the entire dataset', and 'in situations where it is necessary for the algorithm to dynamically adapt to new patterns in the data'. Its example is when the data 'is generated as a function of time', such as predicting prices in financial markets.

Tip

Batch versus online is a separate question from the five types. Think of two labels on the same box: what it learns from, and when it learns.

Quick check

A program updates its guess a little each time a new reading arrives, and never waits for the full dataset. Which style is it?

Side by side

Here are all five on one page. Read each card as: what it needs, then what it is for, then what to remember.

  1. 1

    Supervised

    Needs: labeled data. For: classification and regression. Picture: an answer key.

  2. 2

    Unsupervised

    Needs: unlabeled data. For: clustering, association, dimensionality reduction. Picture: sorting buttons into piles.

  3. 3

    Semi-supervised

    Needs: a little labeled data and a lot of unlabeled data. For: classification and regression when labels are costly. Picture: a few marked pages in a big pile.

  4. 4

    Self-supervised

    Needs: unlabeled data, from which it makes its own labels. For: learning representations, like guessing hidden words. Picture: homemade flash cards.

  5. 5

    Reinforcement

    Needs: an environment and a reward. For: choosing actions one after another. Picture: learning to ride a bike.

Notice the pattern in the 'needs' lines. Supervised and semi-supervised need people to have written answers. Unsupervised and self-supervised need only raw data. Reinforcement needs something different: a place to act, and a score.

Which type fits my problem?

Work through three questions, in this order. Start with the data you have today, not the method you would like to use.

  • 1. Do you have answers?

    If every example has a label, and you want to predict that label for new examples, use supervised learning. Ask whether the answer is a category (classification) or a number (regression).

  • 2. Do you have only a few answers, or none?

    A few labels and many unlabeled examples points to semi-supervised learning. No labels, and you want to find groups or links, points to unsupervised learning. No labels, but lots of raw text or images you want a model to understand, points to self-supervised learning.

  • 3. Does it act, and get a score?

    If a program must pick actions in a changing situation and learns from a reward, that is reinforcement learning. IBM describes its data as an ordered sequence organized as state, action and reward.

Here is a worked case. A small shop has 20,000 customer records and no labels, and the owner asks, 'what kinds of customers do I have?' Question one: no answers. Question two: no labels, and the goal is to find groups. That is unsupervised learning, and the task is clustering, which IBM lists with 'customer segmentation'.

A second case: a team wants to guess house prices and has 500 past sales with prices. Every example has an answer, and the answer is a number. That is supervised learning, and the task is regression.

Quick check

A hospital has a million scans but experts have only labeled 2,000 of them, and labeling more is slow and costly. Which type fits best?

Tip

The types are not walls. IBM says the results of self-supervised pretext tasks can feed a supervised or reinforcement task later, so real projects often mix them.

What to remember

Five types, five kinds of signal: answers, no answers, a few answers, answers made from the data itself, and rewards. Pick by what you have, not by what sounds clever. Then keep batch versus online in mind as a second question about timing.

Next: supervised learning.

Sources

How is this lesson?

Last updated on 16 November 2026

Learn with me

Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.