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 ...
随机推荐
- Spring配置多数据源
如何在应用启动之后灵活切换数据源的关键点: 将SessionFactory接口中的dataSource配置为AbstractRoutingDataSource的instance,sessionFact ...
- Hql参数占位符使用(转+整理)
在Hibernate 4版本中,对于Hql有一点点改变,如果你还是按照以前的方式去编写HQL Query query = sessionFactory.openSession().createQuer ...
- js学习心得(一)(菜鸟)
js基础已经打了好几次了,慕课跟着学了一遍,视频看了一些,还读了诸如 jsdom艺术,js精粹以及锋利jq(没读完). 这次再次重头读并写一遍代码,工具书是js,查缺补漏高级程序设计第二版,犀牛书有点 ...
- Asp.net身份认证记录
基础知识 身份标识在客户端主要是两个存储位置: cookie 常用 url 很少用 url作为cookie禁用的备选方案 form 几乎不用 很麻烦,每次请求都必须是form提交方式 authoriz ...
- WCF 启用multipleSiteBindingsEnabled 情况下报终结点地址错误
报错信息如下: Server Error in '/MyWcfService' Application. When 'system.serviceModel/serviceHostingEnviron ...
- ODI 系列学习--整体架构概念
ODI 系列学习--整体架构概念 ODI整体架构没有Oracle Database复杂,因为它属于程序功能的使用,更多是程序开发和配置的工作,当然ODI的优化涉及到很多数据库优化的工作,从整体架构入手 ...
- DataTables warning 错误警告
今天使用 Charisma 框架的 jquery datatable 插件时出现如下错误: 搜索才发现 DataTables 目前不支持有单元格合并的表格.而且只要单元格数目不同就会有错误,不能使用搜 ...
- JS中如何使用Cookie
1.关于JS设置Cookie的说明 在Javascript脚本里,一个cookie 实际就是一个字符串属性.当你读取cookie的值时,就得到一个字符串,里面当前WEB页使用的所有cookies的名称 ...
- [Django] Pinax 项目下APP的 安装与使用
Pinax下有数十个APP,怎么将这些APP集成到已有的Django 工程(http://www.cnblogs.com/xiaoqu/p/3196081.html)文件中去呢?现在用django-u ...
- 重启VirtualBox里面的系统提示VT-x features locked or unavailable in MSR错误
有次不小心设置了一下virtualbox里面的一些配置,然后启动系统时出现了如下提示 在网上找了一些资料尝试了一些方法偶然有一次成功 原来是自己把那个cpu个数设置成了2,改成1就好了,不知道为什么做 ...