其中,
h
(
x
)
≥
0
h(x)\geq0
h(x)≥0,对数函数的底数是任意的,当底数为 2 时,信息量的单位为 bits,当底数为
e
e
e 时,信息量的单位为 nats
其中,
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
limp→0plog2p=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
正好等于随机变量的熵:
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 iH=N1(NlnN−N−i∑(nilnni−ni))=N1(NlnN−i∑nilnni)=i∑(Nni)lnN−i∑(Nni)lnni因此," role="presentation" style="position: relative;"> 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

因此我们可以把
i
i
i-th bin 内的值都替换为
x
i
x_i
xi 从而将连续概率分布量化为离散概率分布,它的熵为
其中,第 2 项
−
ln
Δ
-\ln\Delta
−lnΔ 在
Δ
→
0
\Delta\rightarrow0
Δ→0 时发散,这说明精准表示一个连续变量需要大量 bits
其中,等式右侧的项即为微分熵. 对于多元连续随机变量
x
\boldsymbol x
x (a vector),微分熵为
Maximum entropy configuration for a continuous variable - Gaussian Distribution
可以用拉格朗日乘子法转化为无条件约束的优化问题:
将其带入 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) 代入微分熵的表达式可得Conditional Entropy
上式即为给定
X
X
X 时
Y
Y
Y 的条件熵,并且有
H
[
Y
∣
X
]
≤
H
[
Y
]
H[Y|X]\leq H[Y]
H[Y∣X]≤H[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
Chain Rule

上式即为相对熵 / 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(p∥q) bits on the average to describe the random variable. i.e.Gibbs’s inequality
K
L
(
p
∥
q
)
≥
0
with equality if and
only if
p
(
x
)
=
q
(
x
)
for all
x
Proof
其中,
0
≤
λ
≤
1
0\leq\lambda\leq1
0≤λ≤1
由数学归纳法可知,凸函数
f
(
x
)
f(x)
f(x) 满足
其中,
λ
i
≥
0
\lambda_i\geq0
λi≥0,
∑
i
λ
i
=
1
\sum_i\lambda_i=1
∑iλi=1. 上式即为 Jensen’s inequality,证明如下:
并且 Jensen 不等式也可以推广到连续随机变量
KL divergence for density estimation
Cross entropy loss
上式即为随机变量
x
x
x,
y
y
y 的互信息,可以看到,独立程度越低,互信息越大 (a measure of the amount of information one random variable contains about another)Properties
Mutual Information and Entropy
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]
Chain Rule for Entropy

Proof
Conditional mutual information

Chain rule for information

Conditional Relative Entropy

Chain rule for relative entropy


Independence Bound on Entropy

