In order to comprehend generative algorithms, it can be helpful to contrast them with discriminative algorithms. When input data is fed into a discriminative algorithm, it aims to predict the label to which the data belongs. As such, the algorithm aims to map features to labels. Generative algorithms, on the other hand, do the opposite; they aim to predict features given a certain label.
Let's compare these two types of models in the context of whether an email is spam. We can consider x to be the model feature; for example, all of the words in the email. We can also consider the target variable, y, to state whether the email is actually spam. In such a scenario, the discriminative and generative models will aim to answer the following questions:
- Discriminative model p(y|x): Given the input features, x, what is the probability...