信息论 (Information Theory): Introduction and information measures

本文介绍了信息论的基本概念,包括熵、微分熵、联合熵、条件熵、相对熵(KL散度)和互信息。熵衡量随机变量的不确定性,微分熵适用于连续随机变量,条件熵描述给定一个变量后另一个变量的不确定性。相对熵用于度量两个概率分布的相似性,互信息则表示两个变量之间的信息相关性。这些概念在信息传输、编码理论和机器学习等领域有着广泛应用。
摘要由CSDN通过智能技术生成

Information Theory, 1948

Entropy (熵)

Information

  • 考虑一个离散随机变量 X X X,当观测到它的一个具体值 x x x 时,我们能得到多少信息呢?信息量可以被理解为 “degree of surprise”,也就是说,一个不太可能发生的事件带来的信息量比经常发生的事件带来的信息量更多,一个必然会发生的事件则不会带来任何信息,因此,(1) 信息量 h ( x ) h(x) h(x) p ( x ) p(x) p(x) 的减函数。同时,如果事件 x , y x,y x,y 相互独立 ( p ( x , y ) = p ( x ) p ( y ) p(x,y)=p(x)p(y) p(x,y)=p(x)p(y)),则同时观察到 x , y x,y x,y 带来的信息量为分别观察到 x , y x,y x,y 带来的信息量之和相同,也就是 (2) h ( x , y ) = h ( x ) + h ( y ) h(x,y)=h(x)+h(y) h(x,y)=h(x)+h(y). 由此可得信息量 h ( x ) h(x) h(x) 的形式如下:
    在这里插入图片描述其中, h ( x ) ≥ 0 h(x)\geq0 h(x)0对数函数的底数是任意的当底数为 2 时,信息量的单位为 bits当底数为 e e e 时,信息量的单位为 nats

Entropy

  • 假设发射者向接收者传输离散随机变量的值,则传输过程中的平均信息量 h ( x ) h(x) h(x) 取期望的形式:
    在这里插入图片描述其中, H [ x ] H[x] H[x] 即为随机变量 x x x 的熵。由于 lim ⁡ p → 0 p log ⁡ 2 p = 0 \lim_{p\rightarrow0}p\log_2 p=0 limp0plog2p=0,因此当 p ( x ) = 0 p(x)=0 p(x)=0 时取 p ( x ) log ⁡ 2 p ( x ) = 0 p(x)\log_2 p(x)=0 p(x)log2p(x)=0,不可能发生的事件不会带来任何信息量 (熵是关于 X X X 概率分布的凹函数,因此 H [ x ] H[x] H[x] 也可以被记作 H [ p ] H[p] H[p])
  • 一个随机变量的熵越大,意味着不确定性越大,那么也就是说,该随机变量包含的信息量越大,也表示平均意义上对随机变量的编码长度

Entropy in bits

  • (1) 考虑一个离散随机变量 x ∈ X x\in\mathcal X xX 服从均匀分布,则传输 x x x 的值时,需要的编码长度为 log ⁡ 2 ∣ X ∣ \log_2 |\mathcal X| log2X,也就是底数为 2 时 X X X 的熵
  • (2) 再考虑如下例子。假设一个离散随机变量有 8 种状态 { a , b , c , d , e , f , g , h } \{a, b, c, d, e, f, g, h\} {a,b,c,d,e,f,g,h},它们的概率分别为 ( 1 / 2 , 1 / 4 , 1 / 8 , 1 / 16 , 1 / 64 , 1 / 64 , 1 / 64 , 1 / 64 ) ( 1/2 , 1/4 , 1/8 , 1/16 , 1/64 , 1/64 , 1/64 , 1/64 ) (1/2,1/4,1/8,1/16,1/64,1/64,1/64,1/64),如果要高效地对其进行传输,可以利用哈夫曼编码得到每种状态的最优编码 0 0 0, 10 10 10, 110 110 110, 1110 1110 1110, 111100 111100 111100, 111101 111101 111101, 111110 111110 111110, 111111 111111 111111,最优编码的平均编码长度为
    在这里插入图片描述正好等于随机变量的熵:
    在这里插入图片描述
  • (3) noiseless coding theorem (Shannon, 1948) 指出,熵是传输随机变量需要的平均比特数的下界

Entropy in physics
熵的概念最早其实可以追溯到物理学中。在物理学中,熵就表示混乱程度。假设有 N N N 个相同物体被放在若干 bins 中,其中 i i i-th bin 中放 n i n_i ni 个物体,则分配方案的数量为
在这里插入图片描述熵被定义为 W W W 的对数形式再加上一个缩放因子的形式
在这里插入图片描述 N → ∞ N\rightarrow\infty N n i / N n_i/N ni/N 固定时,使用 Stirling’s approximation 可以得到
在这里插入图片描述将其代入 H H H 的表达式可得
H = 1 N ( N ln ⁡ N − N − ∑ i ( n i ln ⁡ n i − n i ) ) = 1 N ( N ln ⁡ N − ∑ i n i ln ⁡ n i ) = ∑ i ( n i N ) ln ⁡ N − ∑ i ( n i N ) ln ⁡ n i \begin{aligned} H&=\frac{1}{N}(N\ln N-N-\sum_i(n_i\ln n_i-n_i)) \\&=\frac{1}{N}(N\ln N-\sum_in_i\ln n_i) \\&=\sum_i\left(\frac{n_i}{N}\right)\ln N-\sum_i\left(\frac{n_i}{N}\right)\ln n_i \end{aligned} H=N1(NlnNNi(nilnnini))=N1(NlnNinilnni)=i(Nni)lnNi(Nni)lnni因此,
在这里插入图片描述

Properties

  • (1) 概率分布越尖锐,熵越小;概率分布越平坦,熵越大。当 X X X 服从均匀分布时熵最大 H [ X ] = ln ⁡ ∣ X ∣ H[X]=\ln|\mathcal X| H[X]=lnX,其中 X \mathcal X X 为采样空间; X X X 只能取 1 个值时 ( p i = 1 , p j ≠ i = 0 p_i=1,p_{j\neq i}=0 pi=1,pj=i=0) 熵最小 H [ X ] = 0 H[X]=0 H[X]=0
    0 ≤ H ( X ) ≤ ln ⁡ ∣ X ∣ 0\leq H(X)\leq\ln|\mathcal X| 0H(X)lnX证明下面求熵的最大值。求熵的最大值可以转化为求熵的负数的最小值,这就转化为了一个凸优化问题:
    min ⁡ ∑ i p ( x i ) ln ⁡ p ( x i ) s . t . ∑ i p ( x i ) = 1 , 0 ≤ p ( x i ) ≤ 1 \min\sum_ip(x_i)\ln p(x_i)\\ s.t.\sum_ip(x_i)=1,0\leq p(x_i)\leq1 minip(xi)lnp(xi)s.t.ip(xi)=1,0p(xi)1暂时忽略第 2 个约束条件,可以写出拉格朗日函数:
    L ( p ( x i ) , λ ) = ∑ i p ( x i ) ln ⁡ p ( x i ) + λ ( ∑ i p ( x i ) − 1 ) L(p(x_i),\lambda)=\sum_ip(x_i)\ln p(x_i)+\lambda(\sum_ip(x_i)-1) L(p(xi),λ)=ip(xi)lnp(xi)+λ(ip(xi)1)令其偏导为 0:
    ∂ L ∂ p ( x i ) = 1 + ln ⁡ p ( x i ) + λ = 0 ∂ L ∂ λ = ∑ i p ( x i ) − 1 = 0 \frac{\partial L}{\partial p(x_i)}=1+\ln p(x_i)+\lambda=0\\ \frac{\partial L}{\partial\lambda}=\sum_ip(x_i)-1=0 p(xi)L=1+lnp(xi)+λ=0λL=ip(xi)1=0因此有
    p ( x 1 ) = p ( x 2 ) = . . . = p ( x ∣ X ∣ ) = 1 ∣ X ∣ H [ X ] = ln ⁡ ∣ X ∣ p(x_1)=p(x_2)=...=p(x_{|\mathcal X|})=\frac{1}{|\mathcal X|}\\ H[X]=\ln|\mathcal X| p(x1)=p(x2)=...=p(xX)=X1H[X]=lnX该解满足第 2 个约束条件 0 ≤ p ( x i ) ≤ 1 0\leq p(x_i)\leq1 0p(xi)1,是一个可行解
    在这里插入图片描述

Differential entropy (微分熵)

  • 熵的定义可以被推广到连续随机变量的情况。考虑将 X \mathcal X X 分为若干个宽为 Δ \Delta Δ 的 bins,对于 i i i-th bin,存在 x i x_i xi 使得
    在这里插入图片描述因此我们可以把 i i i-th bin 内的值都替换为 x i x_i xi 从而将连续概率分布量化为离散概率分布,它的熵为
    在这里插入图片描述其中,第 2 项 − ln ⁡ Δ -\ln\Delta lnΔ Δ → 0 \Delta\rightarrow0 Δ0 时发散,这说明精准表示一个连续变量需要大量 bits
  • 我们先忽略第 2 项 − ln ⁡ Δ -\ln\Delta lnΔ 并且考虑 Δ → 0 \Delta\rightarrow0 Δ0 的情况,此时有
    在这里插入图片描述其中,等式右侧的项即为微分熵. 对于多元连续随机变量 x \boldsymbol x x (a vector),微分熵为
    在这里插入图片描述

Maximum entropy configuration for a continuous variable - Gaussian Distribution

  • 下面求微分熵的最大值。该问题是一个条件优化问题 p ( x ) p(x) p(x) 满足如下约束:
    在这里插入图片描述可以用拉格朗日乘子法转化为无条件约束的优化问题
    在这里插入图片描述
  • 上式是一个有关概率分布 p ( x ) p(x) p(x) 的泛函,将其整理一下可得
    F [ p ( x ) ] = ∫ − ∞ ∞ [ − p ( x ) ln ⁡ p ( x ) + λ 1 p ( x ) + λ 2 x p ( x ) + λ 3 ( x − μ ) 2 p ( x ) ] d x + ( − λ 1 − λ 2 μ − λ 3 σ 2 ) = ∫ − ∞ ∞ G ( p ( x ) , x ) d x + C \begin{aligned} F[p(x)]&=\int_{-\infty}^{\infty}\left[-p(x)\ln p(x)+\lambda_1p(x)+\lambda_2xp(x)+\lambda_3(x-\mu)^2p(x)\right]dx+(-\lambda_1-\lambda_2\mu-\lambda_3\sigma^2) \\&=\int_{-\infty}^{\infty}G(p(x),x)dx+C \end{aligned} F[p(x)]=[p(x)lnp(x)+λ1p(x)+λ2xp(x)+λ3(xμ)2p(x)]dx+(λ1λ2μλ3σ2)=G(p(x),x)dx+C欧拉-拉格朗日方程可知,当 p ( x ) p(x) p(x) 使得 F [ p ( x ) ] F[p(x)] F[p(x)] 取极值时,对任意 x x x
    δ F δ p ( x ) = ∂ G ∂ p − d d x ( ∂ G ∂ p ′ ) = ∂ G ∂ p = − 1 − ln ⁡ p ( x ) + λ 1 + λ 2 x + λ 3 ( x − μ ) 2 = 0 \begin{aligned} \frac{\delta F}{\delta p(x)} &=\frac{\partial G}{\partial p}-\frac{d}{dx}\left(\frac{\partial G}{\partial p'}\right) =\frac{\partial G}{\partial p} \\&=-1-\ln p(x)+\lambda_1+\lambda_2x+\lambda_3(x-\mu)^2 \\&=0 \end{aligned} δp(x)δF=pGdxd(pG)=pG=1lnp(x)+λ1+λ2x+λ3(xμ)2=0因此,
    在这里插入图片描述将其带入 3 个约束式就可以得到拉格朗日乘子 λ 1 , λ 2 , λ 3 \lambda_1,\lambda_2,\lambda_3 λ1,λ2,λ3 的值 (过程比较复杂,可以参考 Exercise 1.34),最终可以得到
    在这里插入图片描述也就是说,正态分布可以使得微分熵最大 (在上述优化过程中,我们并没有约束 p ( x ) ≥ 0 p(x)\geq0 p(x)0,但由于求出来的 p ( x ) p(x) p(x) 满足该约束,因此非负的约束项可以不加),将 p ( x ) p(x) p(x) 代入微分熵的表达式可得
    H [ x ] = − ∫ p ( x ) ln ⁡ p ( x ) d x = − ∫ p ( x ) ln ⁡ { 1 2 π σ 2 } d x − ∫ p ( x ) { − ( x − μ ) 2 2 σ 2 } d x = − ln ⁡ { 1 2 π σ 2 } + σ 2 2 σ 2 = 1 2 { 1 + ln ⁡ ( 2 π σ 2 ) } \begin{aligned} H[x] &=-\int p(x) \ln p(x) d x \\ &=-\int p(x) \ln \left\{\frac{1}{2 \pi \sigma^{2}}\right\} d x-\int p(x)\left\{-\frac{(x-\mu)^{2}}{2 \sigma^{2}}\right\} d x \\ &=-\ln \left\{\frac{1}{2 \pi \sigma^{2}}\right\}+\frac{\sigma^{2}}{2 \sigma^{2}} \\ &=\frac{1}{2}\left\{1+\ln \left(2 \pi \sigma^{2}\right)\right\} \end{aligned} H[x]=p(x)lnp(x)dx=p(x)ln{2πσ21}dxp(x){2σ2(xμ)2}dx=ln{2πσ21}+2σ2σ2=21{1+ln(2πσ2)}其中, σ 2 \sigma^2 σ2 越大,微分熵越大,并且 H [ x ] H[x] H[x] 可能取负值

Joint Entropy and Conditional Entropy (联合熵,条件熵)

Conditional Entropy

  • 已知 x x x 的情况下观察到 y y y 的值带来的额外信息量为 − ln ⁡ p ( y ∣ x ) -\ln p(y|x) lnp(yx). 假如我们从联合概率 p ( x , y ) p(x,y) p(x,y) 中抽样 ( x , y ) (x,y) (x,y),则已知 x x x 时观察到 y y y 带来的平均额外信息量为
    在这里插入图片描述上式即为给定 X X X Y Y Y 的条件熵,并且有 H [ Y ∣ X ] ≤ H [ Y ] H[Y|X]\leq H[Y] H[YX]H[Y]
  • 条件熵也可写为下式:
    H [ Y ∣ X ] = − ∬ p ( y , x ) ln ⁡ p ( y ∣ x ) d y d x = − ∫ p ( x ) ∫ p ( y ∣ x ) ln ⁡ p ( y ∣ x ) d y d x = ∫ p ( x ) H [ Y ∣ x ] d x \begin{aligned} H[Y|X]&=-\iint p(y,x)\ln p(y|x)dydx \\&=-\int p(x)\int p(y|x)\ln p(y|x)dydx \\&=\int p(x)H[Y|x]dx \end{aligned} H[YX]=p(y,x)lnp(yx)dydx=p(x)p(yx)lnp(yx)dydx=p(x)H[Yx]dxZero conditional entropy: 由上式可知,当 H [ Y ∣ X ] = 0 H[Y|X]=0 H[YX]=0 时,对所有 x x x 都有 H [ Y ∣ x ] = 0 H[Y|x]=0 H[Yx]=0,也就是当 x x x 固定时, y y y 只能取某一个定值

Joint Entropy

H [ x , y ] = − ∬ p ( x , y ) ln ⁡ p ( x , y ) d y d x H[x,y]=-\iint p(x,y)\ln p(x,y)dydx H[x,y]=p(x,y)lnp(x,y)dydx

  • H [ x , x ] = H [ x ] H[x,x]=H[x] H[x,x]=H[x]
  • H [ x , y ] = H [ y , x ] H[x,y]=H[y,x] H[x,y]=H[y,x]

Chain Rule

在这里插入图片描述

Relative entropy / KL divergence / KL distance (相对熵, KL 散度, KL 距离)

  • 假如有一个未知的概率分布 p ( x ) p(x) p(x),我们用另一个概率分布 q ( x ) q(x) q(x) 来近似 p ( x ) p(x) p(x). 如果我们在传输 x x x 的值时使用 q ( x ) q(x) q(x) 构筑编码方式,则与实际使用 p ( x ) p(x) p(x) 构筑编码方式相比,需要的平均额外信息量 (in nats) 为
    在这里插入图片描述上式即为相对熵 / KL 散度 (KL divergence is a measure of the inefficiency of assuming that the distribution is q q q when the true distribution is p p p. e.g. if we knew the true distribution p p p of the random variable, we could construct a code with average description length H ( p ) H(p) H(p). If, instead, we used the code for a distribution q q q, we would need H ( p ) + K L ( p ∥ q ) H(p) + KL(p\|q) H(p)+KL(pq) bits on the average to describe the random variable. i.e. H ( q ) = H ( p ) + K L ( p ∥ q ) H(q)=H(p)+KL(p\|q) H(q)=H(p)+KL(pq)),它可以用来度量两个概率分布之间的距离 (两个概率分布的采样空间必须相同)。注意到,KL 散度是非对称量,即 K L ( p ∥ q ) ≠ K L ( q ∥ p ) KL(p\|q)\neq KL(q\|p) KL(pq)=KL(qp)
  • 注意到, 0 log ⁡ 0 0 = 0 , 0 log ⁡ 0 q = 0 , p log ⁡ p 0 = ∞ 0\log\frac{0}{0}=0,0\log\frac{0}{q}=0,p\log\frac{p}{0}=\infty 0log00=0,0logq0=0,plog0p=,因此如果存在 x ∈ X x\in\mathcal X xX 使得 p ( x ) > 0 p(x)>0 p(x)>0 q ( x ) = 0 q(x)=0 q(x)=0, 则 K L ( p ∥ q ) = ∞ KL(p\|q)=\infty KL(pq)=

Gibbs’s inequality

K L ( p ∥ q ) ≥ 0 with equality if and  only if  p ( x ) = q ( x )  for all  x \begin{aligned} &KL(p\|q)\geq0 \\\text{with } \text{equality } \text{if } \text{and } &\text{only } \text{if } p(x)=q(x) \text{ for } \text{all } x \end{aligned} with equality if and KL(pq)0only if p(x)=q(x) for all x

Proof

  • Jensen’s inequality:凸函数:
    在这里插入图片描述其中, 0 ≤ λ ≤ 1 0\leq\lambda\leq1 0λ1
    在这里插入图片描述由数学归纳法可知,凸函数 f ( x ) f(x) f(x) 满足
    在这里插入图片描述其中, λ i ≥ 0 \lambda_i\geq0 λi0 ∑ i λ i = 1 \sum_i\lambda_i=1 iλi=1. 上式即为 Jensen’s inequality,证明如下:
    f ( ∑ m = 1 M + 1 λ m x m ) = f ( λ M + 1 x M + 1 + ( 1 − λ M + 1 ) ∑ m = 1 M λ m 1 − λ M + 1 x m ) ≤ λ M + 1 f ( x M + 1 ) + ( 1 − λ M + 1 ) f ( ∑ m = 1 M λ m 1 − λ M + 1 x m ) ≤ λ M + 1 f ( x M + 1 ) + ( 1 − λ M + 1 ) ∑ m = 1 M λ m 1 − λ M + 1 f ( x m ) ≤ ∑ m = 1 M + 1 λ m f ( x m ) \begin{aligned} f\left(\sum_{m=1}^{M+1} \lambda_{m} x_{m}\right) &=f\left(\lambda_{M+1} x_{M+1}+\left(1-\lambda_{M+1}\right) \sum_{m=1}^{M} \frac{\lambda_{m}}{1-\lambda_{M+1}} x_{m}\right) \\ & \leq \lambda_{M+1} f\left(x_{M+1}\right)+\left(1-\lambda_{M+1}\right) f\left(\sum_{m=1}^{M} \frac{\lambda_{m}}{1-\lambda_{M+1}} x_{m}\right) \\ & \leq \lambda_{M+1} f\left(x_{M+1}\right)+\left(1-\lambda_{M+1}\right) \sum_{m=1}^{M} \frac{\lambda_{m}}{1-\lambda_{M+1}} f\left(x_{m}\right) \\ & \leq \sum_{m=1}^{M+1} \lambda_{m} f\left(x_{m}\right) \end{aligned} f(m=1M+1λmxm)=f(λM+1xM+1+(1λM+1)m=1M1λM+1λmxm)λM+1f(xM+1)+(1λM+1)f(m=1M1λM+1λmxm)λM+1f(xM+1)+(1λM+1)m=1M1λM+1λmf(xm)m=1M+1λmf(xm)如果将 λ i \lambda_i λi 视为离散随机变量 z z z 的概率分布,即 λ i = p ( z = z i ) \lambda_i=p(z=z_i) λi=p(z=zi) x i = ξ ( z i ) x_i=\xi(z_i) xi=ξ(zi),则 Jensen 不等式可以写为
    f ( E z [ ξ ( z ) ] ) ≤ E z [ f ( ξ ( z ) ) ] f(\mathbb E_z[\xi(z)])\leq\mathbb E_z[f(\xi(z))] f(Ez[ξ(z)])Ez[f(ξ(z))]其中, f f f 为凸函数, ξ \xi ξ 为任意函数。如果 f f f严格凸函数,则当且仅当 “ ξ ( z ) \xi(z) ξ(z) is constant with probability one or a l m o s t almost almost s u r e l y surely surely” 时等号成立 ( a l m o s t almost almost s u r e l y surely surely 表明可能存在例外,但例外发生的概率为 0),此时有 ξ ( z ) = ξ 0 \xi(z)=\xi_0 ξ(z)=ξ0 (on the range of z z z almost everywhere),因此 E z [ ξ ( z ) ] = ξ 0 \mathbb E_z[\xi(z)]=\xi_0 Ez[ξ(z)]=ξ0,Jensen 不等式的左右均为 f ( ξ 0 ) f(\xi_0) f(ξ0)
    在这里插入图片描述并且 Jensen 不等式也可以推广到连续随机变量
    在这里插入图片描述
  • 由于 − ln ⁡ x -\ln x lnx 为凸函数,将 Jensen 不等式代入 KL 散度公式可知
    K L ( p ∥ q ) = − ∫ p ( x ) ln ⁡ { q ( x ) p ( x ) } d x ⩾ − ln ⁡ ∫ p ( x ) q ( x ) p ( x ) d x ≥ 0 \mathrm{KL}(p \| q)=-\int p(\mathrm{x}) \ln \left\{\frac{q(\mathrm{x})}{p(\mathrm{x})}\right\} \mathrm{dx} \geqslant-\ln \int p(\mathrm x)\frac{q(\mathrm{x})}{p(\mathrm x)} \mathrm{d} \mathrm{x}\geq0 KL(pq)=p(x)ln{p(x)q(x)}dxlnp(x)p(x)q(x)dx0其中最后 − ln ⁡ ∫ p ( x ) q ( x ) p ( x ) d x ≥ 0 -\ln \int p(\mathrm x)\frac{q(\mathrm{x})}{p(\mathrm x)} \mathrm{d} \mathrm{x}\geq0 lnp(x)p(x)q(x)dx0 是因为 − ln ⁡ ∫ p ( x ) q ( x ) p ( x ) d x -\ln \int p(\mathrm x)\frac{q(\mathrm{x})}{p(\mathrm x)} \mathrm{d} \mathrm{x} lnp(x)p(x)q(x)dx 中,如果 p ( x ) = 0 p(x)=0 p(x)=0 p ( x ) q ( x ) p ( x ) = 0 p(x)\frac{q(x)}{p(x)}=0 p(x)p(x)q(x)=0,因此最后得出的 ∫ p ( x ) q ( x ) p ( x ) d x \int p(\mathrm x)\frac{q(\mathrm{x})}{p(\mathrm x)} \mathrm{d} \mathrm{x} p(x)p(x)q(x)dx 可能少掉某些 q ( x ) q(x) q(x) 项,使得最终的和小于 1. 由于 − ln ⁡ x -\ln x lnx 为严格凸函数,因此当且仅当 p ( x ) = q ( x ) p(x) = q(x) p(x)=q(x) almost everywhere 时 K L ( p ∥ q ) = 0 \mathrm{KL}(p \| q)=0 KL(pq)=0

KL divergence for density estimation

  • 假设我们想要建模的数据服从一个未知分布 p ( x ) p(x) p(x),我们用一个参数化的分布 q ( x ∣ θ ) q(x|\theta) q(xθ) 去近似 p ( x ) p(x) p(x),此时就通过最小化 K L ( p ∥ q ) KL(p\|q) KL(pq) 来优化参数 θ \theta θ
    arg min ⁡ θ K L ( p ( x ) ∣ ∣ q ( x ∣ θ ) ) = arg min ⁡ θ ∫ x p ( x ) log ⁡ p ( x ) q ( x ∣ θ ) d x = arg max ⁡ θ ∫ x p ( x ) log ⁡ q ( x ∣ θ ) d x = arg max ⁡ θ E x ∼ p ( x ) [ log ⁡ q ( x ∣ θ ) ] \begin{aligned} \argmin_\theta KL(p(x)||q(x|\theta)) &=\argmin_\theta \int_xp(x)\log\frac{p(x)}{q(x|\theta)}dx \\&=\argmax_\theta \int_xp(x)\log q(x|\theta)dx \\&=\argmax_\theta E_{x\sim p(x)}[ \log q(x|\theta)] \end{aligned} θargminKL(p(x)∣∣q(xθ))=θargminxp(x)logq(xθ)p(x)dx=θargmaxxp(x)logq(xθ)dx=θargmaxExp(x)[logq(xθ)]因此最小化 KL 散度等价于最大化对数似然
  • 由于我们并不知道 p ( x ) p(x) p(x) 的具体值,只能从中采样,因此期望项需要用蒙特卡洛法来近似,也就是 p ( x ) p(x) p(x) 中采样出 m m m 个样本点来近似地计算 KL 散度
    arg min ⁡ θ K L ( p ( x ) ∣ ∣ q ( x ∣ θ ) ) ≈ arg max ⁡ θ 1 m ∑ i = 1 m [ log ⁡ q ( x i ∣ θ ) ] = arg max ⁡ θ log ⁡ ∏ i = 1 m q ( x i ∣ θ ) = arg max ⁡ θ ∏ i = 1 m q ( x i ∣ θ ) \begin{aligned} \argmin_\theta KL(p(x)||q(x|\theta)) &\approx\argmax_\theta\frac{1}{m} \sum_{i=1}^m[ \log q(x^i|\theta)] \\&=\argmax_\theta \log\prod_{i=1}^m q(x^i|\theta) \\&=\argmax_\theta \prod_{i=1}^m q(x^i|\theta) \end{aligned} θargminKL(p(x)∣∣q(xθ))θargmaxm1i=1m[logq(xiθ)]=θargmaxlogi=1mq(xiθ)=θargmaxi=1mq(xiθ)

Cross entropy loss

  • 在 ML 的分类问题中,样本 i i i 的标签 t i t_i ti 可以被表示为 one-hot vector,该向量可以被看作是一个离散概率分布 p i ( z ) p_i(z) pi(z). 模型经过 softmax 的预测结果也可以被看作一个离散概率分布 q i ( z ∣ θ ) q_i(z|\theta) qi(zθ),我们想要让 p i ( z ) p_i(z) pi(z) q i ( z ∣ θ ) q_i(z|\theta) qi(zθ) 之间的 KL 散度尽量小:
    min ⁡ θ K L ( p i ( z ) ∥ q i ( z ∣ θ ) ) = min ⁡ θ E z ∼ p i ( z ) [ ln ⁡ p i ( z ) q i ( z ∣ θ ) ] = min ⁡ θ − E z ∼ p i ( z ) [ ln ⁡ q i ( z ∣ θ ) ] \begin{aligned} \min_\theta KL(p_i(z)\|q_i(z|\theta))&=\min_\theta\mathbb E_{z\sim p_i(z)}\left[\ln \frac{p_i(z)}{q_i(z|\theta)}\right] \\&=\min_\theta-\mathbb E_{z\sim p_i(z)}\left[\ln {q_i(z|\theta)}\right] \end{aligned} θminKL(pi(z)qi(zθ))=θminEzpi(z)[lnqi(zθ)pi(z)]=θminEzpi(z)[lnqi(zθ)]又因为 p i ( z ) p_i(z) pi(z) 只在标签处概率值为 1 (i.e. p i ( z ) = 1 p_i(z)=1 pi(z)=1, if z = t i z=t_i z=ti else 0),因此有
    min ⁡ θ K L ( p i ( z ) ∥ q i ( z ∣ θ ) ) = min ⁡ θ − ln ⁡ q i ( t i ∣ θ ) \begin{aligned} \min_\theta KL(p_i(z)\|q_i(z|\theta))&=\min_\theta-\ln {q_i(t_i|\theta)} \end{aligned} θminKL(pi(z)qi(zθ))=θminlnqi(tiθ)样本 i i i 的损失函数为
    L i = − ln ⁡ q i ( t i ∣ θ ) L_i=-\ln {q_i(t_i|\theta)} Li=lnqi(tiθ)上式即为交叉熵损失

Mutual information (互信息)

  • 现在考虑随机变量 x x x, y y y,如果它们相互独立,则有 p ( x , y ) = p ( x ) p ( y ) p(x,y)=p(x)p(y) p(x,y)=p(x)p(y),因此可以用如下的 KL 散度来衡量随机变量 x x x, y y y 的独立程度
    在这里插入图片描述上式即为随机变量 x x x, y y y互信息,可以看到,独立程度越低,互信息越大 (a measure of the amount of information one random variable contains about another)
  • ln ⁡ p ( x , y ) p ( x ) p ( y ) \ln\frac{p(x,y)}{p(x)p(y)} lnp(x)p(y)p(x,y) 被称为点互信息

Properties

  • I [ x , y ] ≥ 0 I[x,y]\geq0 I[x,y]0;当且仅当 x , y x,y x,y 独立时有
    I [ x , y ] = 0 I[x,y]=0 I[x,y]=0
  • I [ x , y ] = I [ y , x ] I[x,y]=I[y,x] I[x,y]=I[y,x]
  • I [ x , x ] = K L ( p ( x ) ∥ p ( x ) 2 ) = ∫ x p ( x ) ln ⁡ 1 p ( x ) d x = H [ x ] I[x,x]=KL(p(x)\|p(x)^2)=\int_xp(x)\ln\frac{1}{p(x)}dx=H[x] I[x,x]=KL(p(x)p(x)2)=xp(x)lnp(x)1dx=H[x]. Entropy then becomes the self-information of a random variable.

Mutual Information and Entropy

  • Mutual Information is the reduction in the uncertainty of one random variable due to the knowledge of the other.
    在这里插入图片描述 I [ X , Y ] = H [ X ] + H [ Y ] − H [ X , Y ] I[X,Y]=H[X]+H[Y]-H[X,Y] I[X,Y]=H[X]+H[Y]H[X,Y]在这里插入图片描述Proof sketch: e.g. To prove I [ X , Y ] = H [ X ] + H [ Y ] − H [ X , Y ] I[X,Y]=H[X]+H[Y]-H[X,Y] I[X,Y]=H[X]+H[Y]H[X,Y]
    • (1)
      log ⁡ p ( X , Y ) p ( X ) p ( Y ) = − log ⁡ p ( X ) − log ⁡ p ( Y ) + log ⁡ p ( X , Y ) \log \frac{p(X, Y)}{p(X) p(Y)}=-\log p(X)-\log p(Y)+\log p(X, Y) logp(X)p(Y)p(X,Y)=logp(X)logp(Y)+logp(X,Y)
    • (2) Take expectation E E E at both sides.
  • For two random variables X , Y X,Y X,Y, if X X X and Y Y Y are independent, then
    H [ X , Y ] = H [ X ] + H [ Y ] H[X,Y]=H[X]+H[Y] H[X,Y]=H[X]+H[Y]

Chain rules for entropy, relative entropy, and mutual information

Chain Rule for Entropy

  • The entropy of a collection of random variables is the sum of the conditional entropies.
    在这里插入图片描述
    • If X 1 , . . . , X n X_1, ... , X_n X1,...,Xn are independent,
      在这里插入图片描述

Proof

  • (1) Fact p ( x 1 , . . . , x n ) = p ( x 1 ) p ( x 2 ∣ x 1 ) . . . p ( x n ∣ x 1 , . . . , x n − 1 ) p(x_1,...,x_n)=p(x_1)p(x_2|x_1)...p(x_n|x_1,...,x_{n-1}) p(x1,...,xn)=p(x1)p(x2x1)...p(xnx1,...,xn1)
  • (2) Take log ⁡ ( ) \log() log() at each side
  • (3) Take expectation E E E at both sides: E ( X 1 + X 2 ) = E ( X 1 ) + E ( X 2 ) E(X_1+X_2)=E(X_1)+E(X_2) E(X1+X2)=E(X1)+E(X2)

Conditional mutual information

  • We now define the conditional mutual information as the reduction in the uncertainty of X X X due to knowledge of Y Y Y when Z Z Z is given.

在这里插入图片描述

  • I ( X ; Y ∣ Z ) ≥ 0 I(X;Y|Z)≥ 0 I(X;YZ)0 with equality if and only if X X X and Y Y Y are conditionally independent given Z Z Z

Chain rule for information

在这里插入图片描述


Conditional Relative Entropy

在这里插入图片描述


Chain rule for relative entropy

在这里插入图片描述

  • Proof:
    在这里插入图片描述

Information inequality (信息不等式)

Independence Bound on Entropy

在这里插入图片描述

  • Proof: By chain rule for entropies,
    在这里插入图片描述

References

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CONTENTS Contents v Preface to the Second Edition xv Preface to the First Edition xvii Acknowledgments for the Second Edition xxi Acknowledgments for the First Edition xxiii 1 Introduction and Preview 1.1 Preview of the Book 2 Entropy, Relative Entropy, and Mutual Information 2.1 Entropy 2.2 Joint Entropy and Conditional Entropy 2.3 Relative Entropy and Mutual Information 2.4 Relationship Between Entropy and Mutual Information 2.5 Chain Rules for Entropy, Relative Entropy,and Mutual Information 2.6 Jensen’s Inequality and Its Consequences 2.7 Log Sum Inequality and Its Applications 2.8 Data-Processing Inequality 2.9 Sufficient Statistics 2.10 Fano’s Inequality Summary Problems Historical Notes v vi CONTENTS 3 Asymptotic Equipartition Property 3.1 Asymptotic Equipartition Property Theorem 3.2 Consequences of the AEP: Data Compression 3.3 High-Probability Sets and the Typical Set Summary Problems Historical Notes 4 Entropy Rates of a Stochastic Process 4.1 Markov Chains 4.2 Entropy Rate 4.3 Example: Entropy Rate of a Random Walk on a Weighted Graph 4.4 Second Law of Thermodynamics 4.5 Functions of Markov Chains Summary Problems Historical Notes 5 Data Compression 5.1 Examples of Codes 5.2 Kraft Inequality 5.3 Optimal Codes 5.4 Bounds on the Optimal Code Length 5.5 Kraft Inequality for Uniquely Decodable Codes 5.6 Huffman Codes 5.7 Some Comments on Huffman Codes 5.8 Optimality of Huffman Codes 5.9 Shannon–Fano–Elias Coding 5.10 Competitive Optimality of the Shannon Code 5.11 Generation of Discrete Distributions from Fair Coins Summary Problems Historical Notes CONTENTS vii 6 Gambling and Data Compression 6.1 The Horse Race 159 6.2 Gambling and Side Information 164 6.3 Dependent Horse Races and Entropy Rate 166 6.4 The Entropy of English 168 6.5 Data Compression and Gambling 171 6.6 Gambling Estimate of the Entropy of English 173 Summary 175 Problems 176 Historical Notes 182 7 Channel Capacity 183 7.1 Examples of Channel Capacity 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值