京都大学 情報学研究科 知能情報学専攻 2018年2月実施 情報学基礎 F-2
Author
祭音Myyura (co-authored with GPT 5.6 SOL)
Description
An ensemble is a tuple X=(x,AX,PX), where the random variable x takes values in
AX={a1,a2,…,aj}
with probabilities PX={p1,p2,…,pj}, where P(x=ai)=pi≥0 and ∑i=1jpi=1. Let H(X) denote Shannon entropy and E[x] denote expectation.
-
For an arbitrary ensemble X, what is E[1/P(x)]?
-
If f is convex, prove Jensen's inequality
E[f(x)]≥f(E[x]).
-
Using the inequality above, prove
H(X)≤log2∣AX∣.
A binary symbol code C maps AX to {0,1}+. If c(x) is the codeword for x and ℓ(x) its length, then
L(C,X)=x∈AX∑P(x)ℓ(x).
-
Let AX={a,b,c,d}, PX={1/2,1/4,1/8,1/8}, and let the codewords for a,b,c,d respectively be {0,01,011,111}. If one bit is selected at random from the infinite encoded sequence c(x1)c(x2)c(x3)⋯, what is the probability that it is 1?
-
Let AX={a,b,c,d,e,f,g} and
PX={0.01,0.24,0.05,0.20,0.47,0.01,0.02}.
Give a uniquely decodable binary code satisfying L(C,X)≤2.
题目描述
设有限随机变量 X 的取值集为 AX=a1,…,aj,概率为 pi,H(X) 表示 Shannon 熵。
- 求 E[1/P(x)]。
- 证明凸函数的 Jensen 不等式 E[f(x)]≥f(E[x])。
- 利用上式证明 H(X)≤log2∣AX∣。
- 对概率 {1/2,1/4,1/8,1/8} 与依次对应的码字 {0,01,011,111},求从无限编码比特流中均匀抽到
1 的概率。
- 对概率 {0.01,0.24,0.05,0.20,0.47,0.01,0.02} 构造平均码长不超过 2 的唯一可译二元码。
Kai
Q.1
On the support of X,
E[P(x)1]=i:pi>0∑pipi1=∣suppX∣.
Thus, if every listed outcome has positive probability,
E[1/P(x)]=j=∣AX∣.
Q.2
For j=2, the result is the definition of convexity:
f(p1a1+p2a2)≤p1f(a1)+p2f(a2).
Assume the result for j−1 points and put q=∑i=1j−1pi=1−pj. If 0<q<1, then
f(i=1∑jpiai)=f(qi=1∑j−1qpiai+pjaj)≤qf(i=1∑j−1qpiai)+pjf(aj)≤i=1∑jpif(ai).
The cases q=0 or q=1 are immediate. Hence
f(E[x])≤E[f(x)].
Q.3
Let s=∣suppX∣. Apply Q.2 to the positive random variable Y=1/P(x) and the convex function f(y)=−log2y. By Q.1, E[Y]=s, and
E[f(Y)]=E[log2P(x)]=−H(X).
Therefore
−H(X)≥−log2s.
so
H(X)≤log2s≤log2∣AX∣.
The final bound is an equality exactly for the uniform distribution on all of AX.
Q.4
For one source symbol, the expected number of encoded 1 bits is
E[N1]=21(0)+41(1)+81(2)+81(3)=87.
The expected codeword length is
E[ℓ]=21(1)+41(2)+81(3)+81(3)=47.
Hence the long-run fraction of 1 bits is
E[ℓ]E[N1]=7/47/8=21.
Q.5
A Huffman construction gives the following prefix code:
| Symbol | Probability | Codeword | Length |
|---|
| a | 0.01 | 111110 | 6 |
| b | 0.24 | 10 | 2 |
| c | 0.05 | 1110 | 4 |
| d | 0.20 | 110 | 3 |
| e | 0.47 | 0 | 1 |
| f | 0.01 | 111111 | 6 |
| g | 0.02 | 11110 | 5 |
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.97≤2.