相对熵kullback-leibler divergence

来源:互联网 发布:网络直销的优点 编辑:程序博客网 时间:2024/05/16 14:38

相对熵(relative entropy)又称为KL散度Kullback–Leibler divergence,简称KLD[1],信息散度(information divergence),信息增益(information gain)。


KL散度是两个概率分布P和Q差别的非对称性的度量。 KL散度是用来 度量使用基于Q的编码来编码来自P的样本平均所需的额外的位元数。 典型情况下,P表示数据的真实分布,Q表示数据的理论分布,模型分布,或P的近似分布。


对于离散随机变量,其概率分布P 和 Q的KL散度可按下式定义为

{\displaystyle D_{\mathrm {KL} }(P\|Q)=\sum _{i}P(i)\ln {\frac {P(i)}{Q(i)}}.\!}D_{{{\mathrm  {KL}}}}(P\|Q)=\sum _{i}P(i)\ln {\frac  {P(i)}{Q(i)}}.\!

即按概率P求得的PQ的对数差的平均值。KL散度仅当概率PQ各自总和均为1,且对于任何i皆满足{\displaystyle Q(i)>0}Q(i)>0{\displaystyle P(i)>0}P(i)>0时,才有定义。式中出现{\displaystyle 0\ln 0}0\ln 0的情况,其值按0处理。

对于连续随机变量,其概率分布PQ可按积分方式定义为 [2]

{\displaystyle D_{\mathrm {KL} }(P\|Q)=\int _{-\infty }^{\infty }p(x)\ln {\frac {p(x)}{q(x)}}\,{\rm {d}}x,\!}D_{{{\mathrm  {KL}}}}(P\|Q)=\int _{{-\infty }}^{\infty }p(x)\ln {\frac  {p(x)}{q(x)}}\,{{\rm {d}}}x,\!

其中pq分别表示分布PQ的密度。

更一般的,若PQ为集合X的概率测度,且Q关于P绝对连续,则从PQ的KL散度定义为

{\displaystyle D_{\mathrm {KL} }(P\|Q)=-\int _{X}\ln {\frac {{\rm {d}}Q}{{\rm {d}}P}}\,{\rm {d}}P,\!}D_{{{\mathrm  {KL}}}}(P\|Q)=-\int _{X}\ln {\frac  {{{\rm {d}}}Q}{{{\rm {d}}}P}}\,{{\rm {d}}}P,\!

其中,假定右侧的表达形式存在,则{\displaystyle {\frac {{\rm {d}}Q}{{\rm {d}}P}}}{\frac  {{{\rm {d}}}Q}{{{\rm {d}}}P}}Q关于P的R–N导数。

相应的,若P关于Q绝对连续,则

{\displaystyle D_{\mathrm {KL} }(P\|Q)=\int _{X}\ln {\frac {{\rm {d}}P}{{\rm {d}}Q}}\,{\rm {d}}P=\int _{X}{\frac {{\rm {d}}P}{{\rm {d}}Q}}\ln {\frac {{\rm {d}}P}{{\rm {d}}Q}}\,{\rm {d}}Q,}D_{{{\mathrm  {KL}}}}(P\|Q)=\int _{X}\ln {\frac  {{{\rm {d}}}P}{{{\rm {d}}}Q}}\,{{\rm {d}}}P=\int _{X}{\frac  {{{\rm {d}}}P}{{{\rm {d}}}Q}}\ln {\frac  {{{\rm {d}}}P}{{{\rm {d}}}Q}}\,{{\rm {d}}}Q,

即为P关于Q的相对熵。

特性[编辑]

相对熵的值为非负数:

{\displaystyle D_{\mathrm {KL} }(P\|Q)\geq 0,\,}D_{{{\mathrm  {KL}}}}(P\|Q)\geq 0,\,

由吉布斯不等式(en:Gibbs' inequality)可知,当且仅当P = QDKL(P||Q)为零。

尽管从直觉上KL散度是个度量或距离函数, 但是它实际上并不是一个真正的度量或距离。因为KL散度不具有对称性:从分布PQ的距离(或度量)通常并不等于从QP的距离(或度量)。

{\displaystyle D_{\mathrm {KL} }(P\|Q)\neq D_{\mathrm {KL} }(Q\|P)}D_{{{\mathrm  {KL}}}}(P\|Q)\neq D_{{{\mathrm  {KL}}}}(Q\|P)


KL散度和其它量的关系[编辑]

自信息(en:self-information)和KL散度

{\displaystyle I(m)=D_{\mathrm {KL} }(\delta _{im}\|\{p_{i}\}),}I(m)=D_{{{\mathrm  {KL}}}}(\delta _{{im}}\|\{p_{i}\}),


互信息(en:Mutual information)和KL散度

{\displaystyle {\begin{aligned}I(X;Y)&=D_{\mathrm {KL} }(P(X,Y)\|P(X)P(Y))\\&=\mathbb {E} _{X}\{D_{\mathrm {KL} }(P(Y|X)\|P(Y))\}\\&=\mathbb {E} _{Y}\{D_{\mathrm {KL} }(P(X|Y)\|P(X))\}\end{aligned}}}{\begin{aligned}I(X;Y)&=D_{{{\mathrm  {KL}}}}(P(X,Y)\|P(X)P(Y))\\&={\mathbb  {E}}_{X}\{D_{{{\mathrm  {KL}}}}(P(Y|X)\|P(Y))\}\\&={\mathbb  {E}}_{Y}\{D_{{{\mathrm  {KL}}}}(P(X|Y)\|P(X))\}\end{aligned}}


信息熵(en: Shannon entropy)和KL散度

{\displaystyle {\begin{aligned}H(X)&=\mathrm {(i)} \,\mathbb {E} _{x}\{I(x)\}\\&=\mathrm {(ii)} \log N-D_{\mathrm {KL} }(P(X)\|P_{U}(X))\end{aligned}}}{\begin{aligned}H(X)&={\mathrm  {(i)}}\,{\mathbb  {E}}_{x}\{I(x)\}\\&={\mathrm  {(ii)}}\log N-D_{{{\mathrm  {KL}}}}(P(X)\|P_{U}(X))\end{aligned}}


条件熵(en:conditional entropy)和KL散度

{\displaystyle {\begin{aligned}H(X|Y)&=\log N-D_{\mathrm {KL} }(P(X,Y)\|P_{U}(X)P(Y))\\&=\mathrm {(i)} \,\,\log N-D_{\mathrm {KL} }(P(X,Y)\|P(X)P(Y))-D_{\mathrm {KL} }(P(X)\|P_{U}(X))\\&=H(X)-I(X;Y)\\&=\mathrm {(ii)} \,\log N-\mathbb {E} _{Y}\{D_{\mathrm {KL} }(P(X|Y)\|P_{U}(X))\}\end{aligned}}}{\begin{aligned}H(X|Y)&=\log N-D_{{{\mathrm  {KL}}}}(P(X,Y)\|P_{U}(X)P(Y))\\&={\mathrm  {(i)}}\,\,\log N-D_{{{\mathrm  {KL}}}}(P(X,Y)\|P(X)P(Y))-D_{{{\mathrm  {KL}}}}(P(X)\|P_{U}(X))\\&=H(X)-I(X;Y)\\&={\mathrm  {(ii)}}\,\log N-{\mathbb  {E}}_{Y}\{D_{{{\mathrm  {KL}}}}(P(X|Y)\|P_{U}(X))\}\end{aligned}}


交叉熵(en:cross entropy)和KL散度

{\displaystyle \mathrm {H} (p,q)=\mathrm {E} _{p}[-\log q]=\mathrm {H} (p)+D_{\mathrm {KL} }(p\|q).\!}{\mathrm  {H}}(p,q)={\mathrm  {E}}_{p}[-\log q]={\mathrm  {H}}(p)+D_{{{\mathrm  {KL}}}}(p\|q).\!

参考文献[编辑]

  1. ^ Kullback, S.; Leibler, R.A. On Information and Sufficiency. Annals of Mathematical Statistics. 1951, 22 (1): 79–86. doi:10.1214/aoms/1177729694. MR 39968.
  2. ^ C. Bishop (2006). Pattern Recognition and Machine Learning. p. 55.

0 0
原创粉丝点击