Generative Learning algorithms
"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?discriminative algorithm does not care about how the data was generated, it simply categorizes a given signal."
discriminative:
试图找到class之间的差异,进而找到decision boundary,最大可能性地区分数据。他是通过直接学习到$p(y|x)$(例如Logistic regress)或者$X \rightarrow Y\in (0,1,...,k)$(例如perceptron algrithm)
generative:
采取另外一种方式,首先由先验知识prori-knowledge得到 $p(x|y),p(y)$ 然后,通过Bayes rule:$p(y|x) = \frac{p(x|y)p(y)}{p(x)} $来求得$p(y|x)$,其中$p(x)=p(x|y=1)p(y=1)+p(x|y=0)p(y=0)$。这个过程可以看做由先验分布去derive后验分布。当然,在只需要判断出可能性大小的情况下,分母无需考虑,即:$$\arg\max_yp(y|x) = \arg \max_y\frac{p(x|y)p(y)}{p(x)}\\=\arg\max_yp(x|y)p(y)$$
先验知识获取$p(x|y)和p(y)$的方式,是通过现有训练数据样本获得参数的过程。
1. 首先假设一个模型,即样本分布的模型(是伯努利还是高斯分布)
2. 然后通过似然估计likelihood function估计出参数
3. 最后通过贝叶斯公式导出$p(y|x)$
example
数据集:$X=(x_1,x_2)$,$Y\in{0,1}$
- 首先我们假设数据的条件分布$p(x|y)$服从多元高斯正态分布(multivariate normal distribution),则model形式如下:$$y\sim \textrm{Bernoulli}(\phi) \\ x|y=0 \sim \mathcal{N}(\mu_0,\Sigma) \\ x|y = 1\sim \mathcal{N}(\mu_1,\Sigma )$$
接着通过最大似然估计(max likelihood estimate)估计参数。首先写出log似然函数:$$\ell(\phi,\mu_0,\mu_1,\Sigma) = log\prod_{i=1}^{m}p(x^{(i)},y^{(i)},\mu_0,\mu_1,\Sigma) \\ =log\prod_{i=1}^mp(x^{(i)}|y^{(i)};\mu_0,\mu_1,\Sigma)p(y^{(i)};\phi).$$
然后似然函数$\ell$最大化,即求解似然函数对参数导数为零的点:$$\phi=\frac{1}{m}\sum_{i=1}^{m}1\{y^{(i)}=1\} \\ \mu_0= \frac{\sum_{i=1}^{m}1\{y^{(i)}=0\}x^{(i)}} {\sum_{i=1}^m1\{y^{(i)}=0\}} \\ \mu_1= \frac{\sum_{i=1}^{m}1\{y^{(i)}=1\}x^{(i)}} {\sum_{i=1}^m1\{y^{(i)}=1\}} \\ \Sigma = \frac{1}{m}\sum_{i=1}^m(x^{(i)}-\mu_{y^{(i)}})(x^{(i)}-\mu_{y^{(i)}})^T$$得到参数的估计值$(\phi,\mu_0,\mu_1,\Sigma)$,亦即得到分布函数$p(x|y)$。对照上面的图,$\mu_0,\mu_1$是两个二维向量,在图中的位置是两个正态分布各自的中心点,$\Sigma$则决定者多元正态分布的形状。
![此处输入图片的描述][2]
从这一步可以看出获取参数的方式是“学习”得到的,即从大量样本-先验知识去估计模型,这样想是很自然的逻辑.然而严格的依据却是大数定律law of large numbers (LLN),大数定律的证明很精彩,可自行查找资料。- 通过贝叶斯公式比较$p(y=1|x)$和$p(y=0|x)$,来判别类属性。
Generative Learning algorithms的更多相关文章
- Andrew Ng机器学习公开课笔记 -- Generative Learning algorithms
网易公开课,第5课 notes,http://cs229.stanford.edu/notes/cs229-notes2.pdf 学习算法有两种,一种是前面一直看到的,直接对p(y|x; θ)进行建模 ...
- 生成学习算法(Generative Learning algorithms)
一.引言 前面我们谈论到的算法都是在给定\(x\)的情况下直接对\(p(y|x;\theta)\)进行建模.例如,逻辑回归利用\(h_\theta(x)=g(\theta^T x)\)对\(p(y|x ...
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(1)--Introduction
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1 Introduction 1 1.1 ...
- Machine Learning Algorithms Study Notes(3)--Learning Theory
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- 机器学习算法之旅A Tour of Machine Learning Algorithms
In this post we take a tour of the most popular machine learning algorithms. It is useful to tour th ...
- 5 Techniques To Understand Machine Learning Algorithms Without the Background in Mathematics
5 Techniques To Understand Machine Learning Algorithms Without the Background in Mathematics Where d ...
- 机器学习 Generative Learning Algorithm (B)
Naive Bayes 在GDA模型中,特征向量x是连续的实数向量,在这一讲里,我们将要讨论另外一种算法用来处理特征向量x是离散值的情况. 我们先考虑一个例子,用机器学习的方法建立一个垃圾邮件过滤器, ...
- Introduction to Deep Learning Algorithms
Introduction to Deep Learning Algorithms See the following article for a recent survey of deep learn ...
随机推荐
- 利用DreamweaverCS5制作一个含有动态标题的教程
DreamweaverCS5怎么制作一个含有动态标题?做一个网页就先要做一个标题,一个好标题会让网页让人印象深刻,有动态的标题会让网页更生动,下面我就介绍一下怎么制作一个含有动态的标题 做一个网页 ...
- 由chkconfig 引发的联想——怎么查看程序是否已经安装/成功安装
由chkconfig 引发的联想--怎么查看程序是否已经安装/成功安装 某天需要运行chkconfig,root登录依然找不到该命令. [root@localhost ~]# chkconfig ba ...
- codevs1127
学校里有一个水房,水房里一共装有m 个龙头可供同学们打开水,每个龙头每秒钟的供水量相等,均为1. 现在有n 名同学准备接水,他们的初始接水顺序已经确定.将这些同学按接水顺序从1到n 编号,i 号同学的 ...
- JavaScript 面向对象思想 贪吃蛇游戏
js代码: 游戏的对象 ,食物,蛇 ,游戏控制思路如下 (完整代码在https://github.com/774044859yf/ObjectSnakeGame下载) var snake = { aS ...
- There is no satiety in study
好不容易考上了硕士.这个时候,才终于明白什么叫做学无止境.用了1周linux,发现需要学习的东西太多了.life is too short to learn c plus plus 果然如此.不过我们 ...
- redBag
var redBag = (function () { var initialed = false, raining = true, createInterval, walkInterval, cre ...
- js数组(二)
一.位置方法 indexOf()和laseIndexOf() indexOf是从数组的第0项开始向后查找,没有找到返回-1,要求使用=== var numbers = [1,2,3,4,5,4,3,2 ...
- lua学习笔记(2)-常用调用
assert(loadstring("math.max(7,8,9)"))dofile("scripts/xxx.lua")math.floor()math.r ...
- Java输入输出流(转载)
转自http://blog.csdn.net/hguisu/article/details/7418161 目录(?)[+] 1.什么是IO Java中I/O操作主要是指使用Java进行输入,输出操作 ...
- jdk1.6,jdk1.7共存
当然可以,安装的时候记得选择不同的安装目录,安装好以后,可以在开发工具(如eclipse)中切换不同的编译环境和运行环境.其实只要安装eclipse就自带了jdk1.3-1.6的编译环境了. Mac下 ...