# 信息论

## 信息的度量

### 信息熵

${\displaystyle H(X)=\mathbb {E} _{X}[I(x)]=\sum _{x\in {\mathcal {X}}}^{}p(x)\log _{2}\left({\frac {1}{p(x)}}\right)}$

${\displaystyle S(X)=k_{B}H(X)}$

#### 例子

{\displaystyle {\begin{aligned}\mathbb {P} (X=1)&=1/5,\\\mathbb {P} (X=2)&=2/5,\\\mathbb {P} (X=3)&=2/5,\end{aligned}}}

${\displaystyle H(X)={\frac {1}{5}}\log _{2}(5)+{\frac {2}{5}}\log _{2}\left({\frac {5}{2}}\right)+{\frac {2}{5}}\log _{2}\left({\frac {5}{2}}\right)\approx 1.522.}$

### 联合熵与条件熵

${\displaystyle H(X,Y)=\sum _{x\in {\mathcal {X}}}\sum _{y\in {\mathcal {Y}}}^{}p(x,y)\log \left({\frac {1}{p(x,y)}}\right).}$

${\displaystyle H(Y|X)=\sum _{x\in {\mathcal {X}}}\sum _{y\in {\mathcal {Y}}}^{}p(x,y)\log \left({\frac {1}{p(y|x)}}\right).}$

${\displaystyle H(X,Y)=H(X)+H(Y|X)=H(Y)+H(X|Y)=H(Y,X).}$

#### 链式法則

{\displaystyle {\begin{aligned}H(X_{1},X_{2},...,X_{n})&=H(X_{1})+H(X_{2},...,X_{n}|X_{1})\\&=H(X_{1})+H(X_{2}|X_{1})+H(X_{3},...,X_{n}|X_{1},X_{2})\\&=H(X_{1})+\sum _{i=2}^{n}H(X_{i}|X_{1},...,X_{i-1})\end{aligned}}.}

### 互信息

${\displaystyle I(X;Y)=H(X)-H(X|Y)=H(X)+H(Y)-H(X,Y)=H(Y)-H(Y|X)=I(Y;X).}$

${\displaystyle I(X;Y)\leq \min(H(X),H(Y)),}$