ML0005 Discriminative and Generative

What are the differences between discriminative and generative models?

Answer

Discriminative models learn to draw a boundary between classes: they model the conditional probability P(y \mid x) directly, mapping features x to labels y without modeling how the data was generated. Examples include logistic regression, support vector machines, and neural network classifiers. Generative models instead estimate the joint probability P(x, y) (via P(x \mid y) and P(y)), capturing how the data itself is generated, and then use Bayes’ theorem to derive P(y \mid x) for classification. Examples include Naive Bayes, hidden Markov models, VAEs, and GANs. Because generative models learn the data distribution, they can also sample new data; discriminative models can only separate existing classes.

(1) Modeling Target: Discriminative models learn P(y \mid x) directly; generative models learn P(x, y) or P(x \mid y) P(y).
(2) Decision Mechanism: Discriminative models find a decision boundary; generative models compare class-conditional densities through Bayes’ rule.
(3) Capabilities: Discriminative models only classify; generative models can also generate samples, handle missing features, and score outliers.

Discriminative model separates classes with a boundary; generative model fits a distribution per class

Figure 1: Left: a discriminative model cares only about the boundary between classes. Right: a generative model fits a distribution to each class, capturing how the data itself looks.

Mathematical Formulation:
\text{discriminative:} \quad \hat{y} = \arg\max_y \, P(y \mid x)
\text{generative:} \quad P(y \mid x) = \frac{P(x \mid y)\, P(y)}{P(x)}

Where:

  • \hat{y} is the predicted label and y ranges over the class set for input x.
  • P(y \mid x) is the posterior, the quantity a discriminative model learns directly.
  • P(x \mid y) is the class-conditional likelihood (how data of class y looks) and P(y) the class prior; together they define the joint P(x, y) a generative model learns.
  • P(x) is the evidence normalizer, computable as \sum_y P(x \mid y) P(y) over all classes.

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *