KL距离
KL距離
- 全稱:
Kullback-Leibler差異(Kullback-Leibler divergence) - 又稱:
相對(duì)熵(relative entropy) - 數(shù)學(xué)本質(zhì):
衡量相同事件空間里兩個(gè)概率分布相對(duì)差距的測(cè)度 - 定義:
D(p∣∣q)=∑x∈Xp(x)logp(x)q(x)D(p||q)= \sum_{x \in X} p(x) log \frac {p(x)}{q(x)} D(p∣∣q)=x∈X∑?p(x)logq(x)p(x)?
其中,p(x)p(x)p(x)與q(x)q(x)q(x)是兩個(gè)概率分布。
定義中約定:
0log(0/q)=00log(0/q)=00log(0/q)=0、plog(p/0)=∞plog(p/0)=\inftyplog(p/0)=∞
等價(jià)形式:
D(p∣∣q)=Ep[logp(X)q(X)]D(p||q)=E_{p}[log\frac{p(X)}{q(X)}]D(p∣∣q)=Ep?[logq(X)p(X)?]
-
說(shuō)明:
- 兩個(gè)概率分布的差距越大,KL距離越大;
- 當(dāng)兩個(gè)概率分布相同時(shí),KL距離為0
-
推論:
互信息衡量一個(gè)聯(lián)合分布與獨(dú)立性有多大的差距:
I(X;Y)=X(X)?H(X∣Y)=?∑x∈Xp(x)logp(x)+∑x∈X∑y∈Yp(x,y)logp(x∣y)=∑x∈X∑y∈Yp(x,y)logp(x∣y)p(x)=∑x∈X∑y∈Yp(x,y)logp(x,y)p(x)p(y)=D[p(x,y)∣∣p(x)p(y)]\begin{aligned} I(X;Y) &=X(X)-H(X|Y) \\ & =-\sum_{x \in X}p(x)logp(x)+\sum_{x \in X}\sum_{y \in Y}p(x,y)logp(x|y) \\ & =\sum_{x \in X}\sum_{y \in Y}p(x,y)log\frac{p(x|y)}{p(x)} \\ & =\sum_{x \in X}\sum_{y \in Y}p(x,y)log\frac{p(x,y)}{p(x)p(y)} \\ & =D[p(x,y)||p(x)p(y)] \end{aligned} I(X;Y)?=X(X)?H(X∣Y)=?x∈X∑?p(x)logp(x)+x∈X∑?y∈Y∑?p(x,y)logp(x∣y)=x∈X∑?y∈Y∑?p(x,y)logp(x)p(x∣y)?=x∈X∑?y∈Y∑?p(x,y)logp(x)p(y)p(x,y)?=D[p(x,y)∣∣p(x)p(y)]?
條件相對(duì)熵:
D[p(y∣x)∣∣q(y∣x)]=∑xp(x)∑yp(y∣x)logp(y∣x)q(y∣x)D[p(y|x)||q(y|x)]=\sum_{x}p(x)\sum_{y}p(y|x)log\frac{p(y|x)}{q(y|x)}D[p(y∣x)∣∣q(y∣x)]=x∑?p(x)y∑?p(y∣x)logq(y∣x)p(y∣x)?
相對(duì)熵的鏈?zhǔn)椒▌t:
D[p(x,y)∣∣q(x,y)]=D[p(x)∣∣q(x)]+D[p(y∣x)∣∣q(y∣x)]D[p(x,y)||q(x,y)]=D[p(x)||q(x)]+D[p(y|x)||q(y|x)]D[p(x,y)∣∣q(x,y)]=D[p(x)∣∣q(x)]+D[p(y∣x)∣∣q(y∣x)]
總結(jié)
- 上一篇: 第九周 10.25-10.31
- 下一篇: 读jQuery之十二(删除事件核心方法)