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 ...
随机推荐
- Android中 Http请求
HttpClient public class MainActivity extends Activity { private Button button; @Override protected v ...
- 献给写作者的 Markdown 新手指南
「简书」作为一款「写作软件」在诞生之初就支持了 Markdown,Markdown 是一种「电子邮件」风格的「标记语言」,我们强烈推荐所有写作者学习和掌握该语言.为什么?可以参考: 『为什么作家应该用 ...
- DataTable转换为LIST
public List<string[]> SetList(DataTable dt) { List<string[]> list = ne ...
- Android ImageView图片自适应
网络上下载下来的图片自适应:android:adjustViewBounds="true"(其详细解释在下面) <ImageView android:id=" ...
- TCP/IP详解之:TCP
第17章 TCP:传输控制协议 TCP提供了一种可靠的面向连接的字节流运输层服务 TCP的服务 尽管TCP和UDP都使用相同的网络层(IP),TCP却向应用层提供与UDP完全不同的服务. TCP通过下 ...
- html 中head显示 在标题栏里面的图片
在<head>标签里加<link rel="Shortcut Icon" href="你的ico图片地址" /> 一般标题栏里的图片是1 ...
- java如何防止反编译
综述(写在前面的废话) Java从诞生以来,其基因就是开放精神,也正因此,其可以得到广泛爱好者的支持和奉献,最终很快发展壮大,以至于有今天之风光!但随着java的应用领域越来越广,特别是一些功能要发布 ...
- TableViewController的添加,删除,移动
#import "RootTableViewController.h" @interface RootTableViewController () { UITableViewCel ...
- POJ 3104 Drying(二分答案)
[题目链接] http://poj.org/problem?id=3104 [题目大意] 给出n件需要干燥的衣服,烘干机能够每秒干燥k水分, 不在烘干的衣服本身每秒能干燥1水分 求出最少需要干燥的时间 ...
- Python学习笔记3-Python元组、数组、字典集合的操作
在Python中数组中的每一项可以是不同的数据类型 元组:只能读不能写的数组 aTuple=(1,'abc','tmc',79.0,False) print aTuple[1:3] print typ ...