What is the difference between a generative and a discriminative classifier? What is one example of each, and when would you prefer each?

Supervised learning, Generative and discriminative models
Level L1 Beginner. Length Short. Nature Th Theoretical.

What's being asked

Whether you know what is being modelled: p(x,y) or only p(y∣x).

Key idea

Generative models learn p(x∣y)P(y) and get P(y∣x) through Bayes' rule; discriminative models learn P(y∣x) (or the boundary) directly.

Steps

  1. Generative: model how the data of each class is produced, p(x∣y), and the prior P(y). Then use Bayes' rule P(y∣x)∝p(x∣y)P(y). Examples: naive Bayes, LDA, QDA.
  2. Discriminative: model P(y∣x) directly, or just the decision boundary. We never describe x itself. Examples: logistic regression, SVM, neural networks.
  3. A generative model can sample new x, handle missing features (by summing them out), and use unlabelled data. If its assumptions hold it can also work well with very little data: Ng and Jordan showed naive Bayes approaches its asymptotic error with far fewer examples than logistic regression, though to a higher final error.
  4. A discriminative model spends all its capacity on the boundary, so with plenty of data and a wrong generative assumption it usually has lower error.
  5. Rule of thumb: small data with a sensible model, or a need for sampling, suggests generative; large data and only prediction needed suggests discriminative.

Common mistakes

How long your answer should be

5–6 sentences.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: What is the Bayes classifier for minimum error rate, and why does picking the most probable class minimise your chance of being wrong?
Next in Supervised learning: In k-nearest neighbours classification, what happens to the decision boundary when k=1 and when k=n (the training set size)? How does this show the bias–variance trade-off, and how would you choose k?