zoukankan      html  css  js  c++  java
  • 概率分布

    概率分布


    1 二元变量


    1 伯努利(Bernoulli)分布的形式如下

    [ ext{Bern}(x|mu)=mu^x(1-mu)^{1-x}. ]

    实际上伯努利分布没有自己的记号,考虑其作为二项分布的一个特例,可以用(B(1,mu))作为伯努利实验结果的表示。即若(Xsim B(1,mu)),则

    [Pleft(X=x ight)= ext{Bern}(x|mu). ]

    容易得出,其均值与方差分别为

    [egin{aligned} mathbb E[x]&=mu\ ext{var}[x]&=mu(1-mu). end{aligned}]

    假定我们有(N)个独立观察到的样本构成的数据集(mathcal{D}=left{x_1,...,x_N ight}),则似然函数为

    [p(mathcal D|mu)=prod_{n=1}^Np(x_n|mu)=prod_{n=1}^Nmu^{x_n}(1-mu)^{1-x_n}, ]

    似然对数为

    [ln p(mathcal D|mu)=sum_{n=1}^Nln p(x_n|mu)=sum_{n=1}^Nleft{x_nlnmu+(1-x_n)ln(1-mu) ight}, ]

    关于(mu)的梯度为零,求得最大似然估计为

    [mu_ ext{ML}=frac{1}{N}sum_{n=1}^Nx_n. ]

    二项分布形式如下

    [ ext{Bin}(m|N,mu)=left(egin{matrix}N\mend{matrix} ight)mu^m(1-mu)^{N-m}. ]

    假设(Xsim B(N,mu)),则

    [P(X=m)= ext{Bin}(m|N,mu). ]

    其均值和方差分别由下式给出

    [egin{aligned} mathbb E[m]&=Nmu\ ext{var}[m]&=Nmu(1-mu). end{aligned}]

    2 注意到通过(N)次独立伯努利实验对参数(mu)进行估计时,似然函数为(mu)(1-mu)指数之积,由此引入如下beta先验分布

    [ ext{Beta}(mu|a,b)=frac{Gamma(a+b)}{Gamma(a)Gamma(b)}mu^{a-1}(1-mu)^{b-1}, ext{ } ext{ }0leqmuleq1. ]

    其中(Gamma(a+b)/Gamma(a)Gamma(b))是归一化常数,(Gamma(cdot))形式如下

    [Gamma(x)equiv int_0^infty u^{x-1}e^{-u} ext{ d}u. ]

    该分布的均值和方差分别为

    [egin{aligned} mathbb E[mu]&=frac{a}{a+b}\ ext{var}[mu]&= frac{ab}{(a+b)^2(a+b+1)}. end{aligned}]

    由于后验分布正比于先验分布于似然分布之积(倍数为与随机变量无关的某常数),因此在对二项分布进行参数估计时,后验分布满足

    [p(mu|m,l,a,b)proptomu^{m+a-1}(1-mu)^{l+b-1}, ]

    其中(l)满足

    [m+l=N. ]

    通过简单对比,容易给出后验分布的完整表示

    [p(mu|m,l,a,b)=frac{Gamma(N+a+b)}{Gamma(m+a)(l+b)}mu^{m+a-1}(1-mu)^{l+b-1}. ]

    当数据规模趋于无穷时,贝叶斯估计和最大似然估计相同。

    2 多元变量


    1 考虑伯努利分布的(K)维扩展,使用(mathbf{x}={x_1,...,x_K})表示状态随机变量,满足

    [egin{aligned}x_kin{0,1},\ sum_{k=1}^K x_k=1. end{aligned}]

    若以下概率条件成立

    [P(x_k=1)=mu_k, ]

    则随机变量的分布为

    [p(mathbf{x}|oldsymbol{mu})=prod_{k=1}^Kmu_k^{x_k}, ]

    其中(oldsymbolmu=(mu_1,...,mu_K)^ ext T),约束条件为(mu_kgeq 0)(sum_kmu_k=1)
    现在假定我们有(N)个独立观察到的样本构成的数据集(mathcal D={mathbf{x}_1,...,mathbf x_K}),则似然函数为

    [p(mathcal D|oldsymbolmu)=prod_{n=1}^Nprod_{k=1}^Kmu_k^{x_{nk}}=prod_{k=1}^Kmu_k^{sum_nx_{nk}}=prod_{k=1}^K mu_k^{m_k}, ]

    对数似然函数为

    [ln p(mathcal D|oldsymbolmu)=sum_{k=1}^K m_klnmu_k, ]

    考虑到约束条件

    [sum_{k=1}^Kmu_k=1, ]

    利用拉格朗日乘子法可求得最大似然解

    [mu_k^{ ext{ML}}=frac{m_k}{N}. ]

    给定参数(oldsymbolmu),在(N)次独立观测中(m_1,...,m_K)的联合分布即多项分布(二项分布的扩展)

    [ ext{Mult}(m_1,m_2,...,m_K|oldsymbolmu,N)=left(egin{matrix} N\m_1m_2...m_Kend{matrix} ight)prod_{k=1}^Kmu_k^{m_k},]

    其中

    [left(egin{matrix} N\m_1m_2...m_Kend{matrix} ight)=frac{N!}{m_1!m_2!...m_K!},]

    同时有约束条件

    [sum_{k=1}^K m_k=N. ]

    2 通过比较,多项分布的共轭先验应该具有如下形式

    [p(oldsymbolmu|oldsymbolalpha)proptoprod_{k=1}^K mu_k^{alpha_k-1}, ]

    其中(0leqmu_kleq 1)(sum_kmu_k=1)(oldsymbolalpha=(alpha_1,...,alpha_K)^ ext T)。归一化后的狄利克雷分布为

    [ ext{Dir}(oldsymbolmu|oldsymbolalpha)=frac{Gamma(alpha_0)}{Gamma(alpha_1)cdotsGamma(alpha_K)}prod_{k=1}^Kmu_k^{alpha_k-1}, ]

    其中

    [alpha_0=sum_{k=1}^Kalpha_k. ]

    3 高斯分布


    1 对于(D)维随机变量(mathbf{x}),多元高斯分布形式如下

    [mathcal{N}(mathbf{x}|oldsymbolmu,mathbfSigma)=frac{1}{(2pi)^{D/2}}frac{1}{|mathbfSigma|^{1/2}}expleft{-frac{1}{2}(mathbf x-oldsymbolmu)^ ext TmathbfSigma^{-1}(mathbf x-oldsymbolmu) ight}, ]

    特别地,当(D=1)时,单变量高斯分布为

    [mathcal N(x|mu,sigma^2)=frac{1}{(2pisigma^2)^{1/2}}expleft{-frac{1}{2sigma^2}(x-mu)^2 ight}. ]

    引出高斯分布的两个场景,一个是连续变量最大熵分布(给定均值和方差),另一个是中心极限定理,即(N)个独立同分布随机变量之和随着(N)增大收敛于高斯分布(依赖于(N))。特别地,当(N)增大时,二项分布( ext{Bin}(m|N,mu))快速收敛于高斯分布(mathcal N(mu N,mu(1-mu)N))

    考虑多元高斯分布中依赖于(mathbf x)的二次型

    [Delta^2=(mathbf x-oldsymbolmu)^ ext TmathbfSigma^{-1}(mathbf x-oldsymbolmu), ]

    也称(mathbf{x})(oldsymbolmu)的马氏(Mahalanobis)距离,特别地,当协方差阵为单位阵时,该马氏距离退化为两向量间(D)维欧氏距离。
    考虑到二次型的性质,不失一般性地,假定(mathbfSigma)为对称阵。

    性质1:若(mathbf A)为对称阵,则(mathbf A^{-1})也为对称阵。可利用特征值和特征向量说明,参见下文。

    我们知道,任意(n)阶方阵(mathbf A)(n)个特征值(包括重根)。特别地,当(mathbf A)为对称阵时,(mathbf A)的每个(k)重特征值有(k)个线性无关的特征向量,并且属于不同特征值的特征向量正交,从而(mathbf A)的所有特征值对应的所有特征向量可组成一个(n)阶线性无关组,特别地,它可以是单位正交组。

    假设(mathbfSigma)(D)个特征向量分别为(lambda_1,...,lambda_D),其对应的特征向量分别为(mathbf u_1,...,mathbf u_D),对其正交规范化(斯密特正交化后规范化),特征向量满足

    [mathbf u_i^ ext Tmathbf u_j=I_{ij}. ]

    从而可用这组特征向量表示协方差阵(mathbfSigma)

    [mathbfSigma=sum_{i=1}^Dlambda_imathbf u_imathbf u_i^ ext T. ]

    [mathbf{U}=(mathbf u_1,...,mathbf u_D)^ ext T, ]

    从而(|mathbf U|=1)
    由于

    [mathbfSigmamathbf u_j=lambda_jmathbf u_j, ]

    从而

    [mathbfSigmamathbf u_j=sum_{i=1}^Dlambda_iI_{ij}mathbf u_i, ]

    [mathbfSigmamathbf u_j=sum_{i=1}^Dlambda_imathbf u_imathbf u_i^ ext Tmathbf u_j, ]

    从而

    [left(mathbfSigma-sum_{i=1}^Dlambda_imathbf u_imathbf u_i^ ext T ight)mathbf U^ ext T=mathbf{0}, ]

    从而

    [ m rleft(mathbfSigma-sum_{i=1}^Dlambda_imathbf u_imathbf u_i^ ext T ight)=0, ]

    [mathbfSigma=sum_{i=1}^Dlambda_imathbf u_imathbf u_i^ ext T. ]

    类似地,可将其逆矩阵表示为

    [mathbfSigma^{-1}=sum_{i=1}^Dfrac{1}{lambda_i}mathbf u_imathbf u_i^ ext T. ]

    将上面的结果带入二次型中,得

    [Delta^2=sum_{i=1}^Dfrac{y_i^2}{lambda_i}, ]

    其中(y_i)是特征向量和差向量的内积,我们可以将其看成后者在某方向上的投影

    [y_i=mathbf u_i^ ext T(mathbf x-oldsymbolmu), ]

    定义(mathbf y=(y_1,...,y_D)^ ext T),从而

    [mathbf y=mathbf U(mathbf x-oldsymbolmu). ]

    2 假定高斯分布是良定义的,即假定协方差阵(mathbfSigma)为正定阵。由于(mathbf x=(x_1,...,x_D)^ ext T)定义在笛卡尔直角坐标系中,考虑(mathbf y=(y_1,...,y_D)^ ext T)表示的坐标系,雅克比矩阵(mathbf J)

    [J_{ij}=frac{partial x_i}{partial y_j}=U_{ji}, ]

    从而

    [egin{aligned} mathbf J&=mathbf U^ ext T, end{aligned}]

    由于(mathbf U)为单位正交阵,因此(|mathbf J|=1)(与空间位置无关)。由于变换是线性的,因此在(y_j)坐标系中,高斯分布为

    [egin{aligned} p(mathbf y)&=p(mathbf x)|mathbf J|\&= frac{1}{(2pi)^{D/2}}frac{1}{|mathbfSigma|^{1/2}}expleft{-frac 1 2(mathbf x-oldsymbolmu)^ ext TmathbfSigma^{-1}(mathbf x-oldsymbolmu) ight}\&=left( prod_{j=1}^Dfrac{1}{(2pilambda_j)^{1/2}} ight)expleft{-frac 1 2sum_{j=1}^Dfrac{y_j^2}{lambda_j} ight} \&=prod_{j=1}^Dfrac{1}{(2pilambda_j)^{1/2}}expleft{-frac{y_j^2}{2lambda_j} ight}. end{aligned}]

    计算高斯分布的二阶矩

    [egin{aligned} mathbb E[mathbf xmathbf x^ ext T]&=frac{1}{(2pi)^{D/2}}frac{1}{|mathbfSigma|^{1/2}} intexpleft{-frac 1 2(mathbf x-oldsymbolmu)^ ext TmathbfSigma^{-1}(mathbf x-oldsymbolmu) ight}mathbf {xx}^ ext T ext{ d}mathbf x\&= frac{1}{(2pi)^{D/2}}frac{1}{|mathbfSigma|^{1/2}} intexpleft{-frac 1 2mathbf z^ ext TmathbfSigma^{-1}mathbf z ight}(mathbf z+oldsymbolmu)(mathbf z+oldsymbolmu)^ ext T ext{ d}mathbf z\&= oldsymbol{mumu}^ ext T+frac{1}{(2pi)^{D/2}}frac{1}{|mathbfSigma|^{1/2}} intexpleft{-frac 1 2mathbf z^ ext TmathbfSigma^{-1}mathbf z ight}mathbf{zz}^ ext T ext{ d}mathbf z\&xlongequal[mathbf z=mathbf U^ ext Tmathbf y]{mathbf y=mathbf Umathbf z} oldsymbol{mumu}^ ext T+frac{1}{(2pi)^{D/2}}frac{1}{|mathbfSigma|^{1/2}} intexpleft{-frac 1 2sum_{k=1}^Dfrac{y_k^2}{lambda_k} ight}mathbf U^ ext Tmathbf{yy}^ ext Tmathbf U ext{ d}mathbf y\&= oldsymbol{mumu}^ ext T+frac{1}{(2pi)^{D/2}}frac{1}{|mathbfSigma|^{1/2}}sum_{i=1}^Dsum_{j=1}^Dmathbf u_imathbf u_j^ ext T intexpleft{-frac 1 2sum_{k=1}^Dfrac{y_k^2}{lambda_k} ight}y_iy_j ext{ d}mathbf y\&= oldsymbol{mumu}^ ext T+sum_{i=1}^D{mathbf u_imathbf u_i^ ext Tlambda_i}\&= oldsymbol{mumu}^ ext T+mathbfSigma. end{aligned}]

    其协方差矩阵为

    [ ext{cov}[mathbf x]=mathbb E left[(mathbf x-mathbb E[mathbf x])(mathbf x-mathbb E[mathbf x])^ ext T ight]=mathbfSigma.]

    3 结论:若两个随机变量联合分布服从高斯分布,则两者条件分布和边缘分布均服从高斯分布。假设(mathbf x)(D)维随机变量,且(mathbf xsimmathcal N(mathbf x|oldsymbolmu,mathbfSigma)),将(mathbf x)拆分为两部分

    [mathbf x=left(egin{matrix}mathbf x_a\mathbf x_bend{matrix} ight), ]

    其中(mathbf x_a)(M)维向量,同时可将均值向量写为

    [oldsymbolmu=left(egin{matrix}oldsymbolmu_a\oldsymbolmu_bend{matrix} ight), ]

    将协方差矩阵(mathbfSigma)拆分成四部分

    [mathbfSigma=left(egin{matrix}mathbfSigma_{aa}&mathbfSigma_{ab}\mathbfSigma_{ba}&mathbfSigma_{bb}end{matrix} ight), ]

    定义精度矩阵作为协方差阵的逆

    [mathbfLambdaequivmathbfSigma^{-1}, ]

    对精度矩阵进行类似的分解

    [mathbfLambda=left(egin{matrix}mathbfLambda_{aa}&mathbfLambda_{ab}\mathbfLambda_{ba}&mathbfLambda_{bb}end{matrix} ight), ]

    由于(mathbfSigma)为对称阵,因此有

    [mathbfSigma_{ab}^ ext{T} = mathbfSigma_{ba}, ]

    由于对称阵的逆仍然是对称阵,因此有

    [mathbfLambda_{ab}^ ext T=mathbfLambda_{ba}. ]

    从而二次型可展开为如下形式

    [egin{aligned} -frac{1}{2}(mathbf x-oldsymbolmu)^ ext TmathbfSigma^{-1}(mathbf x-oldsymbolmu)=&-frac{1}{2}left(egin{matrix}mathbf x_a-oldsymbolmu_a\mathbf x_b-oldsymbolmu_bend{matrix} ight)^ ext Tleft(egin{matrix}mathbfLambda_{aa}&mathbfLambda_{ab}\mathbfLambda_{ba}&mathbfLambda_{bb}end{matrix} ight)left(egin{matrix}mathbf x_a-oldsymbolmu_a\mathbf x_b-oldsymbolmu_bend{matrix} ight)\=&-frac 1 2(mathbf x_a-oldsymbolmu_a)^ ext TmathbfLambda_{aa}(mathbf x_a-oldsymbolmu_a)-frac 1 2(mathbf x_a-oldsymbolmu_a)^ ext TmathbfLambda_{ab}(mathbf x_b-oldsymbolmu_b)\&-frac 1 2(mathbf x_b-oldsymbolmu_b)^ ext TmathbfLambda_{ba}(mathbf x_a-oldsymbolmu_a)-frac 1 2(mathbf x_b-oldsymbolmu_b)^ ext TmathbfLambda_{bb}(mathbf x_b-oldsymbolmu_b), end{aligned}]

    由于

    [p(mathbf x_a|mathbf x_b)=frac{p(mathbf x)}{p(mathbf x_b)}, ]

    固定(mathbf x_b),条件概率与联合概率线性相关,注意到二次型的改写形式此时是关于(mathbf x_a)的平方函数,因此规范化的条件分布必然也是高斯分布。
    利用对称性,通过对一般形式高斯分布二次型的展开与当前条件分布二次型展开形式的系数比较,我们能快速地确定条件分布的均值和方差

    [egin{aligned}mathbfSigma_{a|b}&=mathbfLambda_{aa}^{-1}\ oldsymbolmu_{a|b}&=oldsymbolmu_a-mathbfLambda_{aa}^{-1}mathbfLambda_{ab}(mathbf x_b-oldsymbolmu_b), end{aligned}]

    利用分块矩阵的求逆公式,可以将上述结果用原协方差阵分块矩阵表示,由于

    [left(egin{matrix}mathbf A&mathbf B\mathbf C&mathbf Dend{matrix} ight)^{-1}=left(egin{matrix}mathbf M&-mathbf Mmathbf{BD}^{-1}\-mathbf D^{-1}mathbf{CM}&mathbf D^{-1}+mathbf D^{-1}mathbf{CMBD}^{-1}end{matrix} ight), ]

    其中

    [mathbf M=(mathbf A-mathbf Bmathbf D^{-1}mathbf C)^{-1}, ]

    从而协方差分块矩阵和精度分块矩阵的对应关系为

    [egin{aligned} mathbfLambda_{aa}&=(mathbfSigma_{aa}-mathbfSigma_{aa}mathbfSigma_{bb}^{-1}mathbfSigma_{ba})^{-1}\ mathbfLambda_{ab}&=-(mathbfSigma_{aa}-mathbfSigma_{ab}mathbfSigma_{bb}^{-1}mathbfSigma_{ba})^{-1}mathbfSigma_{ab}mathbfSigma_{bb}^{-1}, end{aligned}]

    从而均值和方差可重写为

    [egin{aligned} oldsymbolmu_{a|b}&=oldsymbolmu_a+mathbfSigma_{ab}mathbfSigma_{bb}^{-1}(mathbf x_a-mathbf x_b)\ mathbfSigma_{a|b}&=mathbfSigma_{aa}-mathbfSigma_{ab}mathbfSigma_{bb}^{-1}mathbfSigma_{ba}. end{aligned}]

    该条件分布是线性高斯模型的一个例子,假定(mathbf x_b)作为(mathbf x_a)的前驱结点,由于条件分布(mathbf x_a|mathbf x_b)服从某个高斯分布,其均值是父结点((mathbf x_b))的线性函数,协方差与(mathbf x_a)无关。

    4 对于边缘分布的情况,(mathbf x_a)服从如下高斯分布

    [p(mathbf x_a)=mathcal N(mathbf x_a|oldsymbolmu_a,mathbfSigma_{aa}). ]

    现在考虑反向的问题(例如在线性高斯模型的实例中),给定两个随机变量的条件和边缘分布,求其联合分布。具体地,假定

    [egin{aligned} p(mathbf x)&=mathcal N(mathbf x|oldsymbolmu,mathbfLambda^{-1})\ p(mathbf y|mathbf x)&=mathcal N(mathbf y|mathbf Amathbf x+mathbf b,mathbf L^{-1}) ,end{aligned}]

    定义

    [mathbf z=left(egin{matrix}mathbf x\mathbf yend{matrix} ight), ]

    从而联合变量(mathbf z)的分布对数形式为

    [egin{aligned} ln p(mathbf z)&=ln p(mathbf x)+ln p(mathbf y|mathbf x)\&= -frac12(mathbf x-oldsymbolmu)^ ext TmathbfLambda(mathbf x-oldsymbolmu)-frac12(mathbf y-mathbf{Ax}-mathbf b)^ ext Tmathbf L(mathbf y-mathbf{Ax}-mathbf b)+ ext{const}, end{aligned}]

    首先分析上式中的二次项以得到精度矩阵(mathbf R)

    [mathbf R=left(egin{matrix} mathbfLambda+mathbf A^ ext Tmathbf{LA}&-mathbf A^ ext Tmathbf L\-mathbf{LA}&mathbf L end{matrix} ight),]

    利用分块矩阵求逆公式,得(mathbf z)协方差矩阵为

    [ ext{cov}[mathbf z]=mathbf R^{-1}=left(egin{matrix} mathbfLambda^{-1}&mathbfLambda^{-1}mathbf A^ ext T\ mathbf AmathbfLambda^{-1}&mathbf L^{-1}+mathbf AmathbfLambda^{-1}mathbf A^ ext T end{matrix} ight),]

    通过分析线性项并进行系数对比,可得联合高斯分布的均值为

    [mathbb E[mathbf z]=mathbf R^{-1}left(egin{matrix} mathbf Aoldsymbolmu-mathbf A^ ext Tmathbf{Lb}\mathbf{Lb} end{matrix} ight)=left(egin{matrix}oldsymbolmu\mathbf Aoldsymbolmu+mathbf bend{matrix} ight).]

    现在我们可以利用前面的结论立即给出(mathbf y)边缘高斯分布的数字特征

    [egin{aligned} mathbb E[mathbf y]&=mathbf Aoldsymbolmu+mathbf b\ ext{cov}[mathbf y]&=mathbf L^{-1}+mathbf{ALambda}^{-1}mathbf{A}^ ext T, end{aligned}]

    以及给定(mathbf y)(mathbf x)的条件分布形式

    [egin{aligned} mathbb E[mathbf x|mathbf y]&=(mathbfLambda+mathbf A^ ext Tmathbf{LA})^{-1}left{mathbf A^ ext Tmathbf L(mathbf y-mathbf b)+mathbfLambdaoldsymbolmu ight}\ ext{cov}[mathbf x|mathbf y]&=(mathbfLambda+mathbf A^ ext Tmathbf{LA})^{-1}. end{aligned}]

    4 指数族分布


    5 非参数化方法


    1 参数化方法的运行结果依赖于模型的选择(多大程度上正确描述了真实数据的分布情况),相较而言,非参数化方法所作的假设要少得多。非参数化方法也分为基于频率和贝叶斯两类,这里主要讨论前者。考虑最简单的使用直方图进行密度估计,假设随机变量(x)为一维连续变量,将(x)的取值区间切分为若干宽度为(Delta_i)的小块,落到第(i)块内的观测样本数为(n_i),总样本数为(N),从而给出对该块概率密度(p_i)的估计为

    [p_i=frac{n_i}{NDelta_i}, ]

    显然这种估计方法给出的密度估计呈阶梯状,当选取的块宽(Delta_i)较小时,由绘制出的频数直方图可见,此时的密度估计对样本(尤其是其随机性)较为敏感,

    我们说密度估计对样本随机性敏感是指这种估计过分还原了样本作为真实分布反映的特性从而损失了其对原本分布共性的复原。在极端情形下,当块宽极小时,密度估计和样本可以近似等价(相互无损失转换)。

    其平滑性较差,而当块宽(Delta_i)较大时,此时的密度估计容易丢失重要的分布特征,如下图所示(第一行)。实际上适当的(Delta_i)的选取才能给出对原始分布的最佳估计,这与所谓模型复杂度或控制模型复杂度的正则化参数的选取殊途同归。
    图1
    直方图估计的缺点主要是密度估计不连续以及维数受限的问题。在(D)维空间中,每一维使用(M)个小块,总需(M^D)个小块,随着(D)的增大,该数量呈指数式上升。此外所需的训练数据规模也以该速度增加。为了解决维数扩展的问题,以下介绍两种非参数化密度估计方法,分别是核估计最近邻

    2 受直方图估计的启发,密度估计应该在待估计点的附近(locality)进行。假设观测数据由某个定义在(D)维空间的密度函数(p(mathbf{x}))给出,考虑包含(mathbf{x})的一个小区域(mathcal{R}),其概率为

    [P=int_mathcal{R}{p(mathbf{x})}{ m{d}}mathbf{x}, ]

    假设观测数据规模(包含的观测点数目)为(N),落在区域(mathcal{R})内的数目为(K),从而(K)作为随机变量,其分布满足

    [P{B(N,P)=K}=inom{N}{K}P^K(1-P)^{N-K}, ]

    由于(mathbb{E}[K/N]=mathbb{E}[K]/N=P),且( ext{var}[K/N]= ext{var}[K]/N^2=P(1-P)/N),从而当(N)充分大时,满足

    [Ksimeq NP, ]

    [lim_{N ightarrow infty}mathbb{E}left[frac{K-NP}{NP} ight]=0, ]

    [lim_{N ightarrow infty} ext{var}left[frac{K-NP}{NP} ight]=lim_{N ightarrow infty}frac{1-P}{NP}=0. ]

    假设(mathcal{R})足够小,从而概率密度近似为某定值,满足

    [Psimeq p(mathbf{x})V, ]

    从而对(p(mathbf{x}))的估计为

    [p(mathbf{x})=frac{K}{NV}, ]

    值得注意的是,为了给出对概率密度“足够好”的估计,我们使用了两条不一致的假设。一方面,(mathcal{R})应该充分小,从而区域密度恒定;另一方面,(mathcal{R})也应该足够大从而保证落入该区域的观测点数目足够接近(NVp(mathbf{x}))

    (N)充分大时,(K/V)充分大((K)(V)减),(p(mathbf{x}))将收敛于真实密度。

    核方法固定(V)调整(K),而最近邻固定(K),调整(V)

    3 核函数法固定体积统计频数。区域(mathcal{R})是以(D)维空间中的点(mathbf{x})为中心的超立方体,其边长为(h),定于如下核函数(此处亦称Parzen窗)

    [k(mathbf{u})=left{egin{aligned}1, ext{ } ext{ } ext{ }&|u_i|leq frac{1}{2}, ext{ } ext{ } ext{ } ext{ } ext{ } ext{ }i=1,...,D,\0, ext{ } ext{ } ext{ }& ext{其他},end{aligned} ight. ]

    显然当且(mathbf{x_n})落在(mathcal{R})内(或边界上)时,核函数值(k((mathbf{x}-mathbf{x_n})/h))(1)。从而落在(mathcal{R})内数据点总数(K)满足

    [K=sum_{n=1}^Nkleft(frac{mathbf{x}-mathbf{x}_n}{h} ight), ]

    从而对点(mathbf{x})处的密度估计为

    [egin{aligned}p(mathbf{x})&=frac{K}{NV}\&=frac{1}{N}sum_{n=1}^{N}{frac{1}{h^D}kleft(frac{mathbf{x}-mathbf{x}_n}{h} ight)},end{aligned} ]

    与直方图估计法一样,该核函数的选取意味着超立方体边界处密度估计值不连续,为此可以选取平滑的核函数,如高斯核:

    [k(mathbf{u})=expleft{-frac{Vertmathbf{x}-mathbf{x}_nVert^2}{2h^2} ight}, ]

    从而核密度估计模型为

    [p(mathbf{x})=frac{1}{N}sum_{n=1}^N{frac{1}{sqrt{2pi}h}expleft{-frac{Vertmathbf{x}-mathbf{x}_nVert^2}{2h^2} ight}}. ]

    很显然,该模型是以(N)个数据点为中心的(D)维高斯模型的混合,常系数(1/{Nsqrt{2pi}h})使得该密度模型正确规范化。
    推而广之,核密度估计或Parzen估计模型只需选取的核函数满足如下两个条件

    [egin{aligned}k(mathbf{u})&geq 0,\int k(mathbf{u})&=1.end{aligned} ]

    该估计方法在训练阶段计算代价为(0),在测试阶段计算代价为(O(N))

    4 核估计的一个缺点是参数(h)的选取(决定平滑程度/模型复杂度)是全局的,而实际上我们希望(h)可以自适应地根据数据点位置进行调整。(K)近邻方法是固定(K)调整(V)进行密度估计的方法:选取以(mathbf{x})为中心恰好能包含(K)个数据点的球体,其体积记为(V),从而该出的密度估计值为(p(mathbf{x})=K/VN)。这里控制模型复杂度的参数为(K)。利用贝叶斯公式可将该模型用于分类问题,误分率最低的决策是将(mathbf{x})赋给球内出现频数最高的类别。特别地,当(K=1)使,将(mathbf{x})赋给距离其最近的数据点所属类别,当(N)趋于无穷大时,其误分率不会超过最优决策(按真实类别分布计算)的两倍。

  • 相关阅读:
    Digital Video Stabilization and Rolling Shutter Correction using Gyroscope 论文笔记
    Distortion-Free Wide-Angle Portraits on Camera Phones 论文笔记
    Panorama Stitching on Mobile
    Natural Image Stitching with the Global Similarity Prior 论文笔记 (三)
    Natural Image Stitching with the Global Similarity Prior 论文笔记(二)
    Natural Image Stitching with the Global Similarity Prior 论文笔记(一)
    ADCensus Stereo Matching 笔记
    Efficient Large-Scale Stereo Matching论文解析
    Setting up caffe on Ubuntu
    Kubernetes配置Secret访问Harbor私有镜像仓库
  • 原文地址:https://www.cnblogs.com/astoninfer/p/9265832.html
Copyright © 2011-2022 走看看