判别式模型与生成式模型

来源:互联网 发布:java多线程wait 编辑:程序博客网 时间:2024/05/02 01:18

   监督学习的任务是针对已知的数据训练集学习出一个模型(分类器),然后运用这个模型,可以对任意的输入数据预测出分类结果。这个模型一般称作决策函数Y=f(X)或者条件概率分布P(Y|X).监督学习方法分为两类:判别式方法,生成式方法;所对应的模型又叫判别式模型(Discrimitive Model,生成式模型(Generative Model)。

 

  判别式模型:由数据直接学习预测函数Y=f(X)或条件概率分布P(Y|X)作为预测模型,不考虑数据的分布,主要寻找异类间的差异或分类面,直面预测,可以将数据进行抽象及特征表示,可以简化学习任务,提高学习效率及准确率。典型的判别模型有最近邻,支持向量机,逻辑回归,线性回归等。

  生成式模型:由数据学习联合概率分布P(X,Y),然后利用贝叶斯公式求出条件概率分布作为预测模型,即P(Y|X)=P(X,Y)/P(X).它从统计的角度数据的分布特点,能够反映同类数据的相似性,不关心异类的分界面在哪里。典型的生成模型有朴素贝叶斯,隐马尔科夫链等。

 

       Let's say you have input data x and you want toclassify the data into labels y. A generative model learns the jointprobability distribution p(x,y) and a discriminative model learns theconditional probability distribution p(y|x) – which you should read as 'theprobability of y given x'.Here's a really simple example. Suppose you have thefollowing 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 twomatrices, you will understand the difference between the two probabilitydistributions.

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

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

 

    再假如你的任务是识别一个语音属于哪种语言。例如对面一个人走过来,和你说了一句话,你需要识别出她说的到底是汉语、英语还是法语等。那么你可以有两种方法达到这个目的:

1、学习每一种语言,你花了大量精力把汉语、英语和法语等都学会了,我指的学会是你知道什么样的语音对应什么样的语言。然后再有人过来对你哄,你就可以知道他说的是什么语音,你就可以骂他是米国人还是小日本了

2、不去学习每一种语言,你只学习这些语言模型之间的差别,然后再分类。意思是指我学会了汉语和英语等语言的发音是有差别的,我学会这种差别就好了。

    那么第一种方法就是生成方法,第二种方法是判别方法。

 

参考:

http://blog.csdn.net/zouxy09/article/details/8195017

http://blog.csdn.net/chlele0105/article/details/38906587

 


0 0
原创粉丝点击