Let’s look at a scenario to understand both of
Imagine you are a superhero, but instead of saving humans, you are supposed to save all the apples in
Now, imagine that there are just two fruits on earth, apples and bananas, but you do not want to save the bananas because they are your enemy. There is one problem, you have never seen an apple or a banana in real-life. However, since your childhood, your father has shown you pictures of apples and bananas, which have has given you two superpowers:
From all the pictures that you have seen since childhood, you could draw an image of an apple yourself. Then, you could compare your drawn image with reality to determine whether or not the fruit is an apple. This “superpower” is known as the generative model.
Based on the physical differences that you can recognize (i.e., color, shape, etc.), you can determine if something is a banana or an apple. This “superpower” is known as the discriminative model.
A Discriminative Model uses a decision boundary between classes (as shown above).
Discriminative models learn the conditional probability distribution p(y|x).
Discriminative models are used in supervised learning algorithms.
These models directly use training data to predict parameters of p(y|x).
Examples include Logistic regression, Scalar Vector Machine, Traditional neural networks, Nearest neighbor, and Conditional Random Fields (CRF)s.
A Generative Model uses an actual distribution to model each class.
Generative models learn the joint probability distribution p(x,y). They use Bayes theorem to predict the conditional probability.
Generative models are used in supervised learning algorithms.
These models directly use the training data to predict parameters of p(y|x).
Examples include Naive Bayes, Bayesian networks, Markov random fields, and Hidden Markov Models (HMM).