Unit content
Generative and discriminative classification
Probabilistic classifiers can model different parts of the prediction problem.
A generative classifier models how the inputs arise within each class, for example
$$P(x\mid y)P(y),$$
and then uses Bayes' theorem to obtain $P(y\mid x)$. Naive Bayes is a generative classifier.
A discriminative classifier models the class boundary or conditional distribution $P(y\mid x)$ directly. Logistic regression is a discriminative model.
The distinction changes what can be done with the fitted model. A generative model can in principle generate or score inputs conditioned on a class because it models $P(x\mid y)$. A discriminative model spends its modeling capacity directly on prediction and need not explain how inputs themselves are distributed.
Neither family is universally better. Strong generative assumptions can help with limited data when they are approximately correct, while a discriminative model may avoid having to model irrelevant details of $P(x)$.
Comparing Naive Bayes with logistic regression on the same classification task makes the contrast concrete: both can output class probabilities, but they arrive there by modeling different probability structures.