AILearn AI
LearnGlossarySources
ID/EN
Learn AI — open material for learning AIEvery lesson cites its original sources.
◎AI Foundations
  1. What is AI?
  2. Types of learning
  3. Math essentials for ML
  4. Data and features
Modules
  1. ◎ AI Foundations
  2. ∿ Classical Machine Learning
  3. ⌬ Neural Networks
  4. ↘ Training Results & Evaluation
  5. ▦ Deep Learning Architectures
  6. ✎ Large Language Models
  7. ◐ Image Generation
  8. ♪ Audio & Speech AI
  9. ◈ Multimodal, Video & 3D
  10. ↻ Reinforcement Learning
  11. ⚙ ML Development & MLOps
  12. ★ Advanced & Frontier Topics
Learn/AI Foundations

Types of learning

Supervised, unsupervised, semi-supervised, self-supervised and reinforcement learning — what data and feedback each needs, which problems each solves, and how modern LLMs combine them.

Beginner~15 min·5 references
Key terms
Supervised learningUnsupervised learningSemi-supervised learningSelf-supervised learningReinforcement learning (RL)RegressionClassificationClusteringLabel (target)

Machine learning problems are grouped by what feedback the learner receives. Do you have the right answer for every example? For a few? For none? Or only a score after a whole sequence of actions? The answer decides which family of methods you can use, how much labelling effort you need, and how you will measure success[1].

≈
Five ways to learn to cook
Supervised: a teacher shows you each dish *and* its name/recipe. Unsupervised: you get a pantry full of unlabelled ingredients and group them by smell and texture yourself. Semi-supervised: a few jars are labelled, most are not — you use the labelled ones to guess the rest. Self-supervised: you cover half a recipe and practise predicting the hidden half — the recipe itself is the answer key. Reinforcement: nobody tells you the recipe; you cook, a diner rates the meal, and you adjust over many attempts.

Supervised learning

In [[supervised-learning|supervised learning]] every training example is a pair (x, y): an input x and its correct output y, called the [[label]] (or target). The model learns a function f with f(x) ≈ y, then predicts y for new x. It comes in two main flavours: [[regression]], where y is a number (a price, a temperature), and [[classification]], where y is a category (spam/not spam, which digit, which disease).

Given (x₁, y₁), (x₂, y₂), …, (xₙ, yₙ) → learn f such that f(x) ≈ y for new x
In words: “given n example pairs of input and correct answer, find a function f whose output is close to the right answer — not just on these examples, but on inputs it has never seen”. The last words, “for new x”, are the whole point: memorising the training pairs is easy, generalising is the goal.
Symbols(hover a symbol in the formula)
(x₁, y₁)
the first training example: an input x₁ and its correct output y₁ (the Label (target))
…
“and so on”: all the examples in between
(xₙ, yₙ)
the last example; n is the number of examples in the Training set (hundreds to billions)
→
“from this, the algorithm will…”
f
the function to learn — the Model
f(x)
the model's output for input x, i.e. the prediction ŷ
≈
“approximately equal”: close enough, measured by a Loss function. Exact equality is rarely possible with noisy data
x
an input (a Feature vector)
y
the correct output: a number (Regression) or a category (Classification)
▸Worked example
House area (m²) → price (million Rp), n = 3: (50, 500), (100, 900), (150, 1300) A learned rule that fits all three: f(x) = 8·x + 100 check: 8·50 + 100 = 500 ✓ 8·100 + 100 = 900 ✓ 8·150 + 100 = 1300 ✓ New house, x = 120: f(120) = 8·120 + 100 = 1060 → about Rp 1.06 billion If it really sells for 1050, then f(x) ≈ y holds: off by only 10 (≈1%).
TaskInput xLabel yType
House pricingarea, rooms, locationprice (Rp)Regression
Spam filteremail textspam / not spamBinary classification
Digit recognition28×28 pixel image0, 1, …, 9Multi-class classification
Demand forecastpast sales, date, promounits sold tomorrowRegression
Photo taggingimageset of tags {beach, dog, sunset}Multi-label classification

The catch: labels are expensive. Someone must mark thousands of emails, outline tumours on scans, or record sale prices. The quality of the labels caps the quality of the model.

Unsupervised learning

In [[unsupervised-learning|unsupervised learning]] you only have inputs x — no labels. The goal is to discover structure: [[clustering]] (group similar customers), dimensionality reduction (compress 100 features into 2 for a plot, e.g. PCA), anomaly detection (flag unusual transactions), and density estimation (model how the data is distributed). Because there is no answer key, evaluating unsupervised results usually requires domain judgement[1].

Semi-supervised learning

[[semi-supervised-learning|Semi-supervised learning]] sits between the two: a small labelled set plus a large unlabelled set. Typical techniques are self-training / pseudo-labelling (train on the labelled data, label the unlabelled examples the model is most confident about, retrain) and label propagation (spread labels to nearby points in a similarity graph). scikit-learn ships SelfTrainingClassifier and LabelPropagation for exactly this[2]. It pays off when labelling is costly — e.g. 500 labelled medical images and 50,000 unlabelled ones.

Self-supervised learning — the engine of modern AI

[[self-supervised-learning|Self-supervised learning]] creates labels *from the data itself* by hiding part of an input and asking the model to predict it. Technically it is supervised training, but no human labels are needed, so it scales to the whole internet. Examples: [[next-token-prediction|next-token prediction]] (GPT-style LLMs predict the next word of web text), masked language modelling (BERT hides 15% of tokens and predicts them[3]), and contrastive learning (SimCLR learns that two random crops of the same photo should have similar representations[4]). The model learns general-purpose knowledge during this Pretraining, which is then adapted with a little labelled data.

Reinforcement learning

In [[reinforcement-learning|reinforcement learning (RL)]] an Agent (LLM agent) interacts with an environment: it observes a state, takes an action, and receives a Reward. There are no correct answers per step — only rewards, often delayed (you learn whether a chess move was good only when the game ends). The agent learns a Policy that maximises total reward through trial and error[5]. RL powers game-playing agents (AlphaGo), robotics, and the final alignment stage of chat models (RLHF). It gets its own module later.

ParadigmDataFeedback signalTypical methods
Supervised(x, y) pairscorrect answer for every examplelinear/logistic regression, trees, neural nets
Unsupervisedx onlynone — structure in the datak-means, DBSCAN, PCA, autoencoders
Semi-supervisedfew (x, y), many xpartial labelsself-training, label propagation
Self-supervisedraw x (text, images, audio)labels derived from x itselfnext-token prediction, masking, contrastive
Reinforcementinteraction with an environmentreward, often delayedQ-learning, policy gradients, PPO
  1. Do you have the correct answer for (almost) every example? → supervised. Is the answer a number → regression; a category → classification.
  2. Only a small fraction labelled, lots of raw data? → semi-supervised, or self-supervised pretraining + fine-tuning.
  3. No labels, you want to explore or compress? → unsupervised.
  4. The system takes a sequence of actions and you can only score outcomes? → reinforcement learning.
python
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)   # 150 flowers, 4 measurements, 3 species

# Supervised: uses the labels y
clf = LogisticRegression(max_iter=1000).fit(X, y)
print(clf.predict(X[:5]))            # predicted species ids

# Unsupervised: ignores y, just finds 3 groups
km = KMeans(n_clusters=3, n_init=10, random_state=0).fit(X)
print(km.labels_[:5])                # cluster ids (arbitrary numbering!)
Same data, two paradigms. Note cluster ids are arbitrary — cluster 0 need not be species 0.
!
Pitfalls
Clustering ≠ classification: clusters are groups the algorithm found, not the categories you care about; they may not match. Noisy labels silently cap supervised accuracy — audit a sample by hand. Ordinal targets (ratings 1–5) can be treated as regression or classification; choose deliberately. Unsupervised always ‘finds something’, even in pure noise — validate that the structure is real.
▸Go deeper: how an LLM uses three paradigms
  1. Self-supervised pretraining on trillions of tokens of text: predict the next token.
  2. Supervised fine-tuning on curated (prompt, ideal answer) pairs written by people.
  3. Reinforcement learning from human feedback (or similar): a reward model scores answers and the LLM is optimised to get higher scores.

So the categories are tools, not tribes: real systems chain them. Another useful distinction you will meet is discriminative models (learn p(y | x), i.e. boundaries between classes) vs generative models (learn p(x) or p(x, y), so they can create new data — the basis of image and text generators).

Quiz

1.
You predict tomorrow's electricity usage (in kWh) from historical data with known usage. This is…
2.
GPT-style models are pretrained by predicting the next token of web text. Why is this called self-supervised?
3.
An e-commerce team wants to discover customer segments with no predefined groups. Best fit?
4.
What makes reinforcement learning different from supervised learning?
5.
You have 1,000 labelled X-rays and 100,000 unlabelled ones. Which approach exploits both?
Score: 0/5

References

  1. [1]
    An Introduction to Statistical Learning (2nd ed.)
    BookJames, Witten, Hastie & Tibshirani2021statlearning.com
    Ch. 2: supervised vs unsupervised, regression vs classification.
  2. [2]
    scikit-learn User Guide — Semi-supervised learning
    Docsscikit-learn developersscikit-learn.org
  3. [3]
    BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
    PaperDevlin et al.2018arxiv.org
  4. [4]
    A Simple Framework for Contrastive Learning of Visual Representations (SimCLR)
    PaperChen et al.2020arxiv.org
  5. [5]
    Reinforcement Learning: An Introduction (2nd ed.)
    BookSutton & Barto2018incompleteideas.net
← Previous
What is AI?
Next →
Math essentials for ML