All problems
Z-Channel Mutual Information
Problem
Compute I(X;Y) in bits for a Z-channel where P(X = 1) = px1 and a 1 is flipped to 0 with probability q while a 0 is never flipped. With py1 = px1 * (1 - q):
I = H(py1) - px1 * H(q)
where H is the binary entropy function in bits.
Hint
Only inputs of 1 can be corrupted, so H(Y|X) = px1 * H(q).
Test cases
case 1
in: [0.5,0]
expected: 1
case 2
in: [0.5,0.5]
expected: 0.31127812445913283
case 3
in: [1,0.2]
expected: 0
case 4
in: [0.9,0.1]
expected: 0.27937542565354423
Starter codePython
import math
def z_channel_mi(px1, q):
# Your code here
pass4 test cases · run your code against them in the editor