Stop 01 · Machine Learning FoundationsTopics · 3/10

Types of Machine Learning: Supervised, Unsupervised and Reinforcement Learning

Part of the Machine Learning Roadmap

In short

Every machine learning problem starts with one question: what kind of learning is this? The answer decides which algorithms, data and metrics you'll use.

Supervised learning trains on labelled examples to predict a known target, unsupervised learning finds structure in unlabelled data, and reinforcement learning trains an agent through rewards from trial and error. Most industry ML work is supervised.

The mascot holds a picture flashcard of a mango next to a real mango, with a small bicycle leaning nearby.

Think of it like this

Three ways a child learns

A parent shows flashcards: 'this is a mango'. That's supervised, learning from labelled answers. The child sorts a box of buttons into piles by colour with no names given: unsupervised. Learning to ride a cycle by wobbling, falling and trying again: reinforcement.

Watch it happen

The three families

Machine learning
Supervised
Unsupervised
Reinforcement
Classification
Regression
Clustering
Dim. reduction
Game agents

1/4Three families, split by what feedback the model gets while learning.

The big ideas

What you need to know

Labels make it supervised

If your data has a target column you want to predict, it's supervised learning.

No labels, find structure

Unsupervised methods group or compress data. A human still decides what the groups mean.

Rewards drive RL

Reinforcement learning learns from trial and error. Common in games and robotics, rarer in everyday business work.

Most jobs are supervised

Churn, fraud, demand and pricing models are mostly supervised. Start your practice there.

See it in code

Walk through the code

python
1from sklearn.datasets import load_iris2from sklearn.linear_model import LogisticRegression3from sklearn.cluster import KMeans4 5X, y = load_iris(return_X_y=True)6 7clf = LogisticRegression(max_iter=1000).fit(X, y)   # supervised: uses labels y8print(clf.predict(X[:3]))9 10km = KMeans(n_clusters=3, n_init=10, random_state=0).fit(X)   # unsupervised: no y11print(km.labels_[:3])

1/3X holds flower measurements, y holds the species labels.

Same flower measurements, two kinds of learning. One learns from the species labels, the other finds groups on its own.

Save yourself the pain

Common mistakes

Oops

Thinking clustering will tell you which customers will churn.

Do this instead

Churn is a labelled outcome, so it's a supervised problem. Clustering only groups similar customers.

Oops

Reaching for reinforcement learning for a normal prediction task.

Do this instead

If you have historical examples with answers, supervised learning is simpler and usually better.

Your mission

Classify ten problems

~15 min

Quick check

You have past loan applications marked 'repaid' or 'defaulted'. Which type of learning fits?

Go deeper

  1. 1Label ten real ML use cases (loan approval, customer segments, game bots) as supervised, unsupervised or RL.
  2. 2Open a Kaggle dataset and say which column would be the label for a supervised task.
  3. 3Read the scikit-learn user guide index and notice how it is split into supervised and unsupervised sections.

What are the types of machine learning?

Machine learning is a way of building programs that learn patterns from data instead of following rules a person typed in. The main types of machine learning are sorted by one simple question: what kind of feedback does the algorithm get while it learns?

If every training example comes with the correct answer, it is supervised learning. If there are no answers at all and the algorithm has to find structure by itself, it is unsupervised learning. If an agent learns by trying actions and receiving rewards or penalties, it is reinforcement learning. Two newer types sit between these: semi-supervised learning, which mixes a few labels with lots of unlabelled data, and self-supervised learning, which creates its own labels from the raw data.

These categories are also what people mean when they search for the types of learning in AI, the forms of learning in artificial intelligence, or the main machine learning techniques. Many AI textbooks, including Russell and Norvig's Artificial Intelligence: A Modern Approach, describe the forms of learning by exactly this idea of feedback.

Types of machine learning at a glance

TypeWhat the data looks likeWhat it learnsCommon algorithmsReal examples
Supervised learningInputs with a known correct answer (label)A mapping from inputs to the labelLinear and logistic regression, decision trees, random forest, XGBoost, SVMSpam filters, loan default prediction, house prices, delivery time estimates
Unsupervised learningInputs only, no labelsGroups, patterns or a simpler view of the dataK-means, DBSCAN, hierarchical clustering, PCA, Isolation ForestCustomer segments, anomaly detection, topic grouping, data compression
Reinforcement learningAn environment, actions and rewardsA policy: which action to take in each situationQ-learning, Deep Q-Networks, policy gradient methods, PPOGame-playing agents, robot control, some ad bidding and recommendation systems
Semi-supervised learningA small labelled set plus a large unlabelled setThe same as supervised, using unlabelled data to helpSelf-training, label propagation, label spreadingClassifying medical scans or documents when expert labels are costly
Self-supervised learningRaw data where part of it is hidden and used as the targetGeneral-purpose representations of text, images or audioMasked language modelling, next-token prediction, contrastive learningPretraining large language models like GPT and BERT, image encoders

Supervised learning: learning from labelled examples

In supervised learning you give the algorithm a table of past examples. Each row has features (the inputs, often called X) and a label (the answer, often called y). The algorithm adjusts itself until its predictions on those rows are as close as possible to the real labels, then you use it on new rows where the label is unknown.

Supervised learning splits into two tasks. Regression predicts a number, such as a flat's rent or tomorrow's demand for a product. Classification predicts a category, such as fraud or not fraud, or which of ten digits a handwritten image shows. Most machine learning work in companies is supervised, because businesses usually have historical records with known outcomes: which customers left, which loans defaulted, which orders arrived late.

The catch is that labels cost time and money. Someone has to mark emails as spam, tag images or wait months to see whether a loan was repaid. The quality of those labels sets an upper limit on how good the model can get. Phases 7 and 8 of this roadmap cover supervised regression and classification in depth.

Unsupervised learning: finding structure without labels

Unsupervised learning works with data that has no answer column. Instead of predicting a known target, the algorithm looks for structure: rows that are similar to each other, directions in which the data varies most, or points that do not fit the usual pattern.

  • Clustering groups similar rows. K-means might split shoppers into budget buyers, festive-season buyers and frequent premium buyers, which a marketing team can then name and target.
  • Dimensionality reduction squeezes many columns into a few while keeping most of the information. PCA is the classic method, and t-SNE and UMAP are popular for drawing high-dimensional data in 2D.
  • Anomaly detection flags rare, unusual rows, such as a card payment that looks nothing like a customer's normal spending.
  • Association rules find items that often appear together, like the 'frequently bought together' suggestions on shopping sites.

Reinforcement learning: learning from rewards

Reinforcement learning (RL) is different from both. There is no fixed dataset at the start. An agent acts inside an environment, sees the result, and gets a reward signal that says how good that outcome was. Over many attempts it learns a policy, which is a strategy for choosing actions that collect the most reward over time.

A simple way to picture it is teaching a dog a trick: you do not show it a labelled dataset, you give a treat when it does the right thing. RL is behind famous game-playing systems such as DeepMind's AlphaGo, and it is used in robotics and some control problems. A form of it, reinforcement learning from human feedback (RLHF), is also used to fine-tune chat models so their answers match what people prefer.

RL is powerful but harder to apply than supervised learning. It needs a safe environment or simulator to practise in, rewards that are carefully designed, and often a very large number of trials. That is why most beginners, and most industry teams, start with supervised learning.

Semi-supervised and self-supervised learning

Semi-supervised learning is useful when labelling is expensive but raw data is cheap. Imagine you have a million product reviews but only two thousand are tagged as positive or negative. A semi-supervised method trains on the labelled reviews, uses the model to guess labels for confident unlabelled ones, and retrains. scikit-learn includes SelfTrainingClassifier, LabelPropagation and LabelSpreading for this.

Self-supervised learning removes the need for human labels during pretraining. The model is given raw data with part of it hidden and is asked to fill in the gap. BERT learns by predicting masked words in a sentence, and GPT-style models learn by predicting the next token. Image models can learn by matching two altered views of the same photo. The labels come from the data itself, which is why these models can learn from huge collections of text and images. The pretrained model is then fine-tuned on a smaller labelled dataset, which is a supervised step.

Supervised vs unsupervised learning in scikit-learn

The clearest way to see the difference is in code. Both models below use the same iris flower measurements. The classifier is given the species labels, while k-means only sees the measurements and has to discover groups on its own.

from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.cluster import KMeans

X, y = load_iris(return_X_y=True)

# Supervised: learn from features AND labels
clf = LogisticRegression(max_iter=1000).fit(X, y)
print(clf.predict(X[:3]))      # predicted species for 3 flowers

# Unsupervised: features only, no labels
km = KMeans(n_clusters=3, n_init=10, random_state=0).fit(X)
print(km.labels_[:3])          # cluster number for the same flowers

How to tell which type of machine learning you need

Other machine learning techniques you will hear about describe how a model is trained rather than what feedback it gets. Batch learning trains on the full dataset at once, while online learning updates the model as new data streams in. Transfer learning reuses a model trained on one task as the starting point for another. Active learning picks the most useful unlabelled examples for a human to label next. These ideas combine with the five types above rather than replace them.

If your situation is...Use
You have past examples with the correct answer and want to predict it for new casesSupervised learning (regression for numbers, classification for categories)
You have data but no answer column and want to discover groups or odditiesUnsupervised learning
An agent must make a sequence of decisions and you can score the outcomesReinforcement learning
Labels exist for only a small part of a large datasetSemi-supervised learning
You want a general model of text, images or audio before solving a specific taskSelf-supervised pretraining, then supervised fine-tuning

Frequently asked questions

Supervised learning, which learns from labelled examples; unsupervised learning, which finds patterns in unlabelled data; and reinforcement learning, which learns by trial and error from rewards. Semi-supervised and self-supervised learning are often added as a fourth and fifth type.

Supervised learning. Most business problems, such as predicting churn, fraud, prices or demand, have historical records with known outcomes, which is exactly what supervised algorithms need.

Its base model is trained with self-supervised learning by predicting the next token in large amounts of text. It is then fine-tuned with supervised examples and with reinforcement learning from human feedback, so it uses several types together.

Supervised learning has a label column and learns to predict it. Unsupervised learning has no label and instead looks for structure, such as clusters of similar rows or a simpler representation of the data.

AI textbooks usually group them by feedback: supervised learning with correct answers, unsupervised learning with no answers, and reinforcement learning with rewards. Semi-supervised learning sits between supervised and unsupervised.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge