多元高斯分布的MLE、贝叶斯条件概率和线性判别分析LDA的生成方法总结

匿名 (未验证) 提交于 2019-12-03 00:22:01

Gaussian model

给出 d 维随机向量(pattern) x ,即随机变量 {x1,x2,...,xn} 其高斯分布表示:

(1)q(x;μ,)=1(2π)d2det()12exp(12(xμ)T1(xμ))

其中 μd 维度的列向量代表期望(expectation),d×d 的协方差矩阵(variance-covariance matrix),即:
(2)μ=E[x]=xq(x;μ,)dx

(3)=V[x]=(xμ)(xμ)Tq(x;μ,)dx

假设n 个样本之间i.i.d. ,则高斯分布的对数似然(log-likelihood)是:

(4)logL(μ,)=ndlog2π2nlog(det())212i=1n(xiμ)T1(xiμ)

由(4)求偏导得到似然方程:

(5)logLμ=n1μ+1i=1nxi

(6)logL=n21+121(i=1n(xiμ)(xiμ)T)1

令(5)和(6)为0,得最大似然估计(maximum likelihood estimator)如下:

(7)μ^ML=1ni=1mxi

(8)^ML=1ni=1n(xiμ^ML)(xiμ^ML)T

这里(7)和(8)分别对应于样本均值和样本协方差矩阵,并假设有足够多的训练样本(training smaples),所以 ^ML 是可逆的(invertible).

  • 注释:这里的样本协方差矩阵是有偏的,为什么,见这里

  • 注释:协方差代表的意义是什么?这里


  • 做假设:随机变量 {x1,x2,...,xn} 之间相互独立,则有相关系数p=0 (这里相关系数为0是两变量独立的必要非充分条件。相关系数反映的是两变量间的线性关系,但是变量间除了线性关系还有其它关系,这时候相关系数就不能作为一种度量了。),则协方差矩阵为:
    (9)= diag((σ(1))2,...,(σ(d))2)

得到第j 个标准差的ML:

(10)σ^ML(j)=1ni=1n(xi(j)μi(j))2
  • 在进一步假设n个变量的方差都一样的是 σ2 ,得到协方差矩阵为:

    (11)σ^ML=1ndi=1n(xiμ)T(xiμ)=1dj=1d(σ^ML(j))2
    • 这里的 1nd 是表示除以n个样本之后剩下的是 d 个随机变量协方差的和,由于都相等,所以除以d 就是样本协方差的估计。

Class-Posterior Probability:logp(y|x) and Class-Prior Probability:p(y)

假设类条件(class-conditional)概率密度 p(x|y) 服从正态分布且样本之间独立同分布,由以上的推导可以得到类条件概率密度p(x|y) 的MLE:

(1)μ^y=1nyi:yi=yxi

(2)^y=1nyi:yi=yn(xiμ^y)(xiμ^y)T

其中ny 表示训练样本中属于类y的数量,μ^y^y 表示训练样本属于类别y 的前提下,该类训练样本的期望和协方差矩阵。

那么由贝叶斯公式:

(3)p(y|x)=p(x|y)p(y)p(x)

推得:
(4)logp(y|x)=logp(x|y)+logp(y)logp(x)

其中类别y 的先验最简单的估计就是在样本中的比值:
(5)p^(y)=nyn

带入公式(1)(2)(5)到(4)中得:
(6)logp^(y|x)=12(xμ^)T^y(xμ^)12log(det(^y))+lognyn+C

这里C 是常数。
  • Linear discriminant analysis (LDA), normal discriminant analysis (NDA), or discriminant function analysis is a generalization of Fisher’s linear discriminant.
  • LDA explicitly attempts to model the difference between the classes of data. PCA on the other hand does not take into account any difference in class, and factor analysis builds the feature combinations based on differences rather than similarities
  • Discriminant analysis is used when groups are known a priori (unlike in cluster analysis). Each case must have a score on one or more quantitative predictor measures, and a score on a group measure

假设训练样本 {x,y} ,这里y 等于0或者1表示两个类别;LDA假设条件概率密度p(x|y=0)p(x|y=1) 都分别服从正态分布 (μ0,0)
(μ1,1)
,同贝叶斯里的公式(6)得到属于类别1而不是类别2的公式(类1的公式减去类0的):

* Without any further assumptions, the resulting classifier is referred to as QDA (quadratic discriminant analysis).
* Quadratic discriminant analysis (QDA) 的定义:
- is closely related to linear discriminant analysis (LDA), where it is assumed that the measurements from each class are normally distributed. Unlike LDA however, in QDA there is no assumption that the covariance of each of the classes is identical. When the normality assumption is true, the best possible test for the hypothesis that a given measurement is from a given class is the likelihood ratio test.

LDA进一步做假设:
* Homoscedasticity: In statistics, a sequence or a vector of random variables is if all random variables in the sequence or vector have the same finite variance. This is also known as homogeneity of variance.
即随机变量都方差相同。
* Full Rank:满秩,应该是在各个类别下,随机变量之间互相不能被彼此表示,因为
- 半正定矩阵的行列式是非负的;协方差是半正定矩阵,行列式不为负。若其中一个随机变量被其他随机变量表示,则行列式为零。所以要求满秩即时类内的随机变量相互独立,这是因为行列式会作为分母成为密度函数的正则化项,即求积分为1保证密度函数的成立。
- 若对称矩阵A的每个元素均为实数,A是Hermite矩阵;所以样本中每一类的协方差矩阵都是hermite矩阵。埃尔米特矩阵是正规矩阵,因此埃尔米特矩阵可被酉对角化,而且得到的对角阵的元素都是实数。这意味着埃尔米特矩阵的特征值都是实的,而且不同的特征值所对应的特征向量相互正交,因此可以在这些特征向量中找出一组C的正交基。



得到

wx>c

其中

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!