Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a generative and a discriminative algorithm? [closed]

What is the difference between a generative and a discriminative algorithm?

like image 496
unj2 Avatar asked May 18 '09 19:05

unj2


People also ask

What is the difference between a generative and discriminative algorithm stack overflow?

A generative algorithm model will learn completely from the training data and will predict the response. A discriminative algorithm job is just to classify or differentiate between the 2 outcomes.

What is discriminative algorithm?

Discriminative algorithms focus on modeling a direct solution. For example, the logistic regression algorithm models a decision boundary. Then it decides on the outcome of an observation based on where it stands relative to the decision boundary.

What is a generative algorithm?

A generative algorithm models how the data was generated in order to categorize a signal. It asks the question: based on my generation assumptions, which category is most likely to generate this signal? A discriminative algorithm does not care about how the data was generated, it simply categorizes a given signal.

Is decision tree generative or discriminative?

Logistic regression, SVM, and tree based classifiers (e.g. decision tree) are examples of discriminative classifiers. A discriminative model directly learns the conditional probability distribution P(y|x).


2 Answers

Let's say you have input data x and you want to classify the data into labels y. A generative model learns the joint probability distribution p(x,y) and a discriminative model learns the conditional probability distribution p(y|x) - which you should read as "the probability of y given x".

Here's a really simple example. Suppose you have the following data in the form (x,y):

(1,0), (1,0), (2,0), (2, 1)

p(x,y) is

      y=0   y=1      ----------- x=1 | 1/2   0 x=2 | 1/4   1/4 

p(y|x) is

      y=0   y=1      ----------- x=1 | 1     0 x=2 | 1/2   1/2 

If you take a few minutes to stare at those two matrices, you will understand the difference between the two probability distributions.

The distribution p(y|x) is the natural distribution for classifying a given example x into a class y, which is why algorithms that model this directly are called discriminative algorithms. Generative algorithms model p(x,y), which can be transformed into p(y|x) by applying Bayes rule and then used for classification. However, the distribution p(x,y) can also be used for other purposes. For example, you could use p(x,y) to generate likely (x,y) pairs.

From the description above, you might be thinking that generative models are more generally useful and therefore better, but it's not as simple as that. This paper is a very popular reference on the subject of discriminative vs. generative classifiers, but it's pretty heavy going. The overall gist is that discriminative models generally outperform generative models in classification tasks.

like image 154
Stompchicken Avatar answered Oct 05 '22 12:10

Stompchicken


A generative algorithm models how the data was generated in order to categorize a signal. It asks the question: based on my generation assumptions, which category is most likely to generate this signal?

A discriminative algorithm does not care about how the data was generated, it simply categorizes a given signal.

like image 30
Carlos Rendon Avatar answered Oct 05 '22 13:10

Carlos Rendon