4.5.1 · D1Generative Models

Foundations — Generative vs discriminative models

2,022 words9 min readBack to topic

Before you can read a single equation on the parent note, you need to own every symbol in it. This page introduces them one at a time, from absolute zero, each anchored to a picture. Nothing here assumes you have seen probability notation before.


1. Features and labels: and

The picture. Think of one row of a spreadsheet. The many columns on the left are (the clues). The single column on the right is (the truth).

Figure — Generative vs discriminative models

Why the topic needs it. The whole debate — generative vs discriminative — is about which direction of the arrow between and you choose to learn. So we must name both ends of that arrow first.


2. What "probability" actually means

The picture. Picture a bar that can only be filled between empty and full. is a bar filled 95% of the way up.


3. Conditional probability: the vertical bar

This is the single most important notation on the parent page, so we build it slowly.

The picture. Imagine a big rectangle = all emails. Shade the region "spam" and the region "contains the word lottery". ignores the whole rectangle and looks only inside the lottery region, then asks: what fraction of that slice is spam?

Figure — Generative vs discriminative models

Why the topic needs it. The parent note's entire distinction is written with this bar:

  • Discriminative learns — "given the clues, which answer?"
  • Generative learns — "given the answer, which clues would we see?"

These are the two directions of the same bar.


4. The four named quantities in Bayes' theorem

The parent note names , , , and . Here is each, from zero.

The picture. Three levers feed one dial. The prior and the likelihood are levers you learn from data; the evidence is a normaliser; the posterior is the dial they move.


5. Summation and marginalising

The parent note writes the evidence as . Two new symbols: and .

The picture. If there are only two classes, spam and not-spam, then Two terms, added. That's all did here.

Figure — Generative vs discriminative models

6. Product and the independence assumption

Naive Bayes on the parent page uses .


7. The exponential , , softmax, and the Gaussian

These appear inside the parent's examples. You only need to recognise their shape.

Figure — Generative vs discriminative models

8. Argmax and : picking the winner

The parent note says "pick the class with highest ."


How these foundations feed the topic

Features X and label y

Conditional probability with the bar

Probability P between 0 and 1

Bayes theorem four players

Summation marginalising

Generative learns P of X given y

Discriminative learns P of y given X

Product and independence

Exponential sigmoid softmax

Gaussian bell curve

Argmax and proportional


Equipment checklist

Test yourself — cover the right side and answer out loud.

What does stand for and what does stand for?
= the measured features (clues); = the label (the answer we want).
What does the bar in mean?
"Probability of given that is already known to be true."
Is equal to ?
No — conditional probability is not symmetric; the direction matters.
Name the four Bayes quantities and which is the answer we want.
Prior , likelihood , evidence , posterior — the posterior is the goal.
What does do and why is it in the evidence?
It adds a term for every possible class ("marginalising"), because the data could come from any class.
What does mean, and what assumption lets Naive Bayes use it?
Multiply over all features; it needs features to be independent given the class.
Why use to build probabilities?
Because is always positive, so ratios of exponentials stay in the valid range.
What does do to a score?
Squashes any real score into a probability between and along an S-curve.
In , what are and ?
= centre of the bell; = its spread/width.
Why can classification ignore ?
It is the same for every class, so it never changes which class wins ().

Connections