7.1 贝叶斯决策论
概率框架下是基于概率和误判损失来决策的
-
给定N个类别,令 代表将第 类样本误分为第 类产生的损失,则基于后验概率将样本x分到第 类的条件风险为
-
-
通常为正,所以 (1) 式可以理解为当样本本属于第 类的概率越大,那么将它分到第 类所产生的损失越大
-
贝叶斯判定准则
-
- 称作贝叶斯最优分类器,其总体风险称为贝叶斯风险
- 反应了学习性能的理论上限
判别式 vs. 生成式
-
后验概率 在现实中通常难以直接获得
- 机器学习可以从这个角度看作是基于有限的训练样本尽可能准确估计出后验概率
-
两种基本策略
-
判别式模型 生成式模型 思路 对 | 建模 对 建模 代表 决策树,SVM 贝叶斯分类器 - 注:prml 中还分了判别函数策略,其实属于判别式模型,因为 就是一个关于 的函数
-
贝叶斯定理
- (补充,来自PRML 第一章)首先我们介绍机器学习里概率论中最重要的两个公式如下
-
-
Here is a joint probability and is verbalized as “the probability of X and Y ”. Similarly, the quantity is a conditional probability and is verbalized as “the probability of Y given X”, whereas the quantity is a marginal probability and is simply “the probability of X”. These two simple rules form the basis for all of the probabilistic machinery that we use throughout this book
-
理解这两个公式最简单的就是数格子,如下图
-
-
sum rule
- The probability that X will take the value xi and Y will take the value yj is written and is called the joint probability of and . It is given by the number of points falling in the cell $ i,j $ as a fraction of the total number of points, and hence
- Here we are implicitly considering the limit Similarly, the probability that X takes the value xi irrespective of the value of is written as and is given by the fraction of the total number of points that fall in column i, so that
- 其中 $c_i = \sum_jn_{ij} $ , 根据 (3~4) 可以推出 sum rule:
- Note that is sometimes called the marginal probability, because it is obtained by marginalizing, or summing out, the other variables (in this case ).
-
product rule
- If we consider only those instances for which , then the fraction of such instances for which is written ) and is called the conditional probability of given . It is obtained by finding the fraction of those points in column that fall in cell and hence is given by
- 根据 (3, 4, 6)可以推出 product rule:
-
用以上两个公式其实就能推出贝叶斯公式
- From the product rule, together with the symmetry property
, we immediately obtain the following relationship between conditional probabilities
- - which is called Bayes’ theorem and which plays a central role in pattern recognition and machine learning
- 其中 是先验概率:样本空间中各类样本所占的比例,可通过各类样本出现的频率估计(大数定律)
- 是证据因子,与类别无关,可以当成起归一化的作用
- 是样本相对于类标记的类条件概率,也叫似然
- 由于 涉及关于 所有属性的联合概率,不能直接根据样本出现频率来估计,因为“未被观测到”与“出现概率为零”通常是不同的,所以主要困难在于估计似然
- From the product rule, together with the symmetry property
, we immediately obtain the following relationship between conditional probabilities
7.2 极大似然估计
如果是回归问题, Minimizing sum of square error is the same as maximum likelihood
solution under a Gaussian noise model
概率统计角度:
-
问题:已有一堆数据从某个概率分布中产生的,这个分布存在参数,我们目标是把参数估计出来
-
极大似然的思想:频率派认为观测到的样本肯定在原分布中出现的概率非常大(很好理解,在同一个分布中,只有概率特别大,才容易被采样出来嘛),所以做法是让估计出来的参数在观测数据上的联合概率尽可能大,而这个联合概率就叫似然。
-
做法:先假设某种概率分布形式,再基于训练样本对参数进行估计
-
假定 具有确定的概率分布形式,且被参数 唯一确定,则任务就是用训练集 来估计参数
-
记 为 , 对于训练集 中第 类样本组成的集合 的似然为
注意这里假设每个样本都是独立产生的 -
因为连乘在计算机中容易造成下溢 (数值分析) ,因此通常使用对数似然
-
所以 的MLE为
-
估计结果的准确性严重依赖于所假设的概率分布形式是否符合潜在的真实分布
-
可能会出现所要估计的概率为 0 的情况 ,影响后验概率的计算结果
-
-
(补充,来自模式分类 第三章)数估计有两类方法
-
将参数作为非随机量处理,如矩法估计、极大似然估计;
-
将参数作为随机变量,如贝叶斯估计
-
贝叶斯估计思想:引入损失函数 (1) 式,使所估计的 的使估计损失的期望最小
-
步骤:
- 确定未知参数集 的先验概密
- 由样本集 求
- 由贝叶斯公式计算
- 估计 :在观测 条件下的 的条件期望
-
极大似然估计是贝叶斯估计的一个特例
-
-
7.3 朴素贝叶斯分类器
- 由于在有限训练样本上直接估计联合概率,在计算上会遭遇组合爆炸,数据上会遭遇样本稀疏的问题,朴素贝叶斯假设
- 每个属性独立地对分类结果产生影响
- 每个特征同等重要
- 则贝叶斯公式可以重写为
- 其中 为特征数, 为 在第 个特征上的取值
- 因为
对所有类别相同,于是基于 (2) 式的贝叶斯判定准则有
- 上式就是朴素贝叶斯分类器的表达式
- 朴素贝叶斯分类器的训练过程就是给定数据集D,来估计类先验概率 ,及每个特征的条件概率
总结
待续……
参考
周志华. 机器学习. 7.1/7.2/7.3.
Bishop. Pattern Recognition And Machine Learning. 1.2.
李宏东. 模式分类(译). 3.