跳到主要内容

京都大学 情報学研究科 知能情報学専攻 2018年2月実施 情報学基礎 F-2

Author

祭音Myyura (co-authored with GPT 5.6 SOL)

Description

An ensemble is a tuple X=(x,AX,PX)X=(x,\mathcal A_X,\mathcal P_X), where the random variable xx takes values in

AX={a1,a2,,aj}\mathcal A_X=\{a_1,a_2,\ldots,a_j\}

with probabilities PX={p1,p2,,pj}\mathcal P_X=\{p_1,p_2,\ldots,p_j\}, where P(x=ai)=pi0P(x=a_i)=p_i\ge0 and i=1jpi=1\sum_{i=1}^{j}p_i=1. Let H(X)H(X) denote Shannon entropy and E[x]\mathbb E[x] denote expectation.

  1. For an arbitrary ensemble XX, what is E[1/P(x)]\mathbb E[1/P(x)]?

  2. If ff is convex, prove Jensen's inequality

    E[f(x)]f(E[x]).\mathbb E[f(x)]\ge f(\mathbb E[x]).
  3. Using the inequality above, prove

    H(X)log2AX.H(X)\le\log_2|\mathcal A_X|.

A binary symbol code CC maps AX\mathcal A_X to {0,1}+\{0,1\}^{+}. If c(x)c(x) is the codeword for xx and (x)\ell(x) its length, then

L(C,X)=xAXP(x)(x).L(C,X)=\sum_{x\in\mathcal A_X}P(x)\ell(x).
  1. Let AX={a,b,c,d}\mathcal A_X=\{a,b,c,d\}, PX={1/2,1/4,1/8,1/8}\mathcal P_X=\{1/2,1/4,1/8,1/8\}, and let the codewords for a,b,c,da,b,c,d respectively be {0,01,011,111}\{0,01,011,111\}. If one bit is selected at random from the infinite encoded sequence c(x1)c(x2)c(x3)c(x_1)c(x_2)c(x_3)\cdots, what is the probability that it is 1?

  2. Let AX={a,b,c,d,e,f,g}\mathcal A_X=\{a,b,c,d,e,f,g\} and

    PX={0.01,0.24,0.05,0.20,0.47,0.01,0.02}.\mathcal P_X=\{0.01,0.24,0.05,0.20,0.47,0.01,0.02\}.

    Give a uniquely decodable binary code satisfying L(C,X)2L(C,X)\le2.

题目描述

设有限随机变量 XX 的取值集为 AX=a1,,aj\mathcal A_X={a_1,\ldots,a_j},概率为 pip_iH(X)H(X) 表示 Shannon 熵。

  1. E[1/P(x)]\mathbb E[1/P(x)]
  2. 证明凸函数的 Jensen 不等式 E[f(x)]f(E[x])\mathbb E[f(x)]\ge f(\mathbb E[x])
  3. 利用上式证明 H(X)log2AXH(X)\le\log_2|\mathcal A_X|
  4. 对概率 {1/2,1/4,1/8,1/8}\{1/2,1/4,1/8,1/8\} 与依次对应的码字 {0,01,011,111}\{0,01,011,111\},求从无限编码比特流中均匀抽到 1 的概率。
  5. 对概率 {0.01,0.24,0.05,0.20,0.47,0.01,0.02}\{0.01,0.24,0.05,0.20,0.47,0.01,0.02\} 构造平均码长不超过 22 的唯一可译二元码。

Kai

Q.1

On the support of XX,

E ⁣[1P(x)]=i:pi>0pi1pi=suppX.\mathbb E\!\left[\frac1{P(x)}\right] =\sum_{i:p_i>0}p_i\frac1{p_i} =|\operatorname{supp}X|.

Thus, if every listed outcome has positive probability,

E[1/P(x)]=j=AX.\boxed{\mathbb E[1/P(x)]=j=|\mathcal A_X|}.

Q.2

For j=2j=2, the result is the definition of convexity:

f(p1a1+p2a2)p1f(a1)+p2f(a2).f(p_1a_1+p_2a_2)\le p_1f(a_1)+p_2f(a_2).

Assume the result for j1j-1 points and put q=i=1j1pi=1pjq=\sum_{i=1}^{j-1}p_i=1-p_j. If 0<q<10<q<1, then

f ⁣(i=1jpiai)=f ⁣(qi=1j1piqai+pjaj)qf ⁣(i=1j1piqai)+pjf(aj)i=1jpif(ai).\begin{aligned} f\!\left(\sum_{i=1}^{j}p_i a_i\right) &=f\!\left(q\sum_{i=1}^{j-1}\frac{p_i}{q}a_i+p_ja_j\right)\\ &\le qf\!\left(\sum_{i=1}^{j-1}\frac{p_i}{q}a_i\right)+p_jf(a_j)\\ &\le\sum_{i=1}^{j}p_if(a_i). \end{aligned}

The cases q=0q=0 or q=1q=1 are immediate. Hence

f(E[x])E[f(x)].\boxed{f(\mathbb E[x])\le\mathbb E[f(x)]}.

Q.3

Let s=suppXs=|\operatorname{supp}X|. Apply Q.2 to the positive random variable Y=1/P(x)Y=1/P(x) and the convex function f(y)=log2yf(y)=-\log_2y. By Q.1, E[Y]=s\mathbb E[Y]=s, and

E[f(Y)]=E[log2P(x)]=H(X).\mathbb E[f(Y)] =\mathbb E[\log_2P(x)] =-H(X).

Therefore

H(X)log2s.-H(X)\ge-\log_2s.

so

H(X)log2slog2AX.\boxed{H(X)\le\log_2s\le\log_2|\mathcal A_X|}.

The final bound is an equality exactly for the uniform distribution on all of AX\mathcal A_X.

Q.4

For one source symbol, the expected number of encoded 1 bits is

E[N1]=12(0)+14(1)+18(2)+18(3)=78.\mathbb E[N_1] =\frac12(0)+\frac14(1)+\frac18(2)+\frac18(3) =\frac78.

The expected codeword length is

E[]=12(1)+14(2)+18(3)+18(3)=74.\mathbb E[\ell] =\frac12(1)+\frac14(2)+\frac18(3)+\frac18(3) =\frac74.

Hence the long-run fraction of 1 bits is

E[N1]E[]=7/87/4=12.\boxed{ \frac{\mathbb E[N_1]}{\mathbb E[\ell]} =\frac{7/8}{7/4}=\frac12 }.

Q.5

A Huffman construction gives the following prefix code:

SymbolProbabilityCodewordLength
aa0.011111106
bb0.24102
cc0.0511104
dd0.201103
ee0.4701
ff0.011111116
gg0.02111105

It is prefix-free, hence uniquely decodable. Its expected length is

L(C,X)=0.01(6)+0.24(2)+0.05(4)+0.20(3)+0.47(1)+0.01(6)+0.02(5)=1.972.\begin{aligned} L(C,X) &=0.01(6)+0.24(2)+0.05(4)+0.20(3)\\ &\qquad+0.47(1)+0.01(6)+0.02(5)\\ &=\boxed{1.97\le2}. \end{aligned}