discriminative model 和 generative model是机器学习算法中两种概率模型,用来实现对训练样本的概率分布进行建模,在实践中由于经常混淆,现在通过查阅资料,将两者的分别总结于此。
不妨用stackoverflow上的一段描述来开启这个话题:
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 distributionp(y|x) - which you should read as “the probability ofy givenx ”. 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)
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 modelp(x,y) , which can be tranformed intop(y|x) by applying Bayes rule and then used for classification. However, the distributionp(x,y) can also be used for other purposes. For example you could usep(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. The overall gist is that discriminative models generally outperform generative models in classification tasks.
Generative models are used in machine learning for either modeling data directly (i.e., modeling observations drawn from a probability density function), or as an intermediate step to forming a conditional probability density function. A conditional distribution can be formed from a generative model through Bayes’ rule.
生成模型是对样本数据的联合概率
Although this topic is quite old, I think it’s worth to add this important distinction. In practice the models are used as follows.
In discriminative models to predict the label y from the training example x, you must evaluate:
Now using Bayes’ rule, let’s replace the
With the joint probability distribution function, given an y, you can calculate (“generate”) its respective x. For this reason they are called generative models.
Imagine your task is to classify a speech to a language:
you can do it either by:
1) Learning each language and then classifying it using the knowledge you just gained
OR
2) Determining the difference in the linguistic models without learning the languages and then classifying the speech.
the first one is the Generative Approach and the second one is the Discriminative approach.
Examples of discriminative models used in machine learning include:
Examples of generative models include:
2015-8-31 艺少
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/lg1259156776/article/details/48139381