Generative vs Discriminative

Inference, estimation, and decision-making from data

There are two fundamentally different ways to build a classifier, and the split runs through all of machine learning. A discriminative model learns the boundary between classes directly. A generative model learns how each class generates its data, and derives the boundary as a by-product.

Formally: a discriminative model estimates the conditional p(y|x) directly, answering "given these features, which label?" A generative model estimates the joint p(x, y) (often via p(x|y) and p(y)), then uses Bayes' rule to get p(y|x).

Think of two art students. One learns to paint a cat from scratch, mastering how fur, whiskers, and ears come together: that's a generative model, learning how each class produces its data. The other never paints anything but becomes brilliant at spotting a cat versus a dog in any photo: that's a discriminative model, learning only the boundary between classes. The painter can create new cats; the spotter just draws the line, and is often sharper at it.

Where this lives in MLThis dichotomy organizes huge swaths of ML. A classifier (logistic regression, most neural nets) is discriminative: p(y|x) and nothing more. A VAE or diffusion model is generative: it learns p(x) well enough to synthesize new images, which a discriminator can't do. Naive Bayes vs logistic regression is the classic textbook pair; VAE vs classifier is its modern deep-learning echo.
▶ Generative vs Discriminative
← Statistical Testing for MLExpectation-Maximization (EM) →