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 ...
随机推荐
- (转)MarginTop 为何影响父元素的 MarginTop
这个问题困惑了很久,虽然没有大碍早就摸出来怎么搞定它,但始终不明白原因出在哪里,如果只是IE有问题我也不会太在意,可问题是所有上等浏览器都表现如此,这样叫我怎能安心?今天总算下狠心查出来怎么回事,居然 ...
- asp.net mvc 生成条形码
using System; using System.Collections; using System.Collections.Generic; using System.Drawing; usin ...
- Oracle GoldenGate配置异构数据库数据传输(oracle到sqlserer)的dml操作(带pump进程)
实验环境:os01:Red Hat Enterprise Linux Server release 5.1 (32位)db01:oracle 10.2.0.1.0 os02:Windows 7 (32 ...
- C++ typedef与const
1.typedef 在C/C++语言中,typedef常用来定义一个标识符及关键字的别名,它是语言编译过程的一部分,但它并不实际分配内存空间: typedef int INT; ...
- 嵌入式平台使用gtest进行白盒测试
看了coderzh大神写的gtest(http://www.cnblogs.com/coderzh/archive/2009/04/06/1426755.html)使用的帖子,觉得gtest这个工具比 ...
- Visual Studio 2012 Update3 安装失败错误“正在关闭管道'
问题描述: Visual Studio 2012 update3 安装失败错误“ 正在关闭管道' 环境: Windows 7 SP1(x86和x64) Windows 8(x86和x64) Windo ...
- android:TextAppearance.Material.Widget.Button.Inverse问题
如果在刚够构建Android Studio项目的时候,运行发现,出现没找到资源的错误!找不到com.android.support/appcompat-v7/23.0.1/res/values-v23 ...
- 用gdb调试程序笔记: 以段错误(Segmental fault)为例
用gdb调试程序笔记: 以段错误(Segmental fault)为例[转] 1.背景介绍2.程序中常见的bug分类3.程序调试器(如gdb)有什么用4.段错误(Segmental fault)介绍5 ...
- java应用程序远程登录linux并执行其命令(ssh jar包)
http://www.ganymed.ethz.ch/ssh2/在这个网址下载一个调用ssh和scp命令的jar包. 然后,就可以写程序了.将上面的jar包导入MyEclipse,下面是一个类的实例代 ...
- 安装virtualbox虚拟机的增强功能
转自:http://wubangtu.com/714 最近有很多人问我这个问题,现在全部写在这里,免得到时候又啰嗦一遍了,哈哈.欢迎大家前来围观: 安装virtualbox虚拟机的增强功能可以实现如下 ...