Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-034

BSC Mutual Information

Problem

Compute the mutual information in bits for a binary symmetric channel when the input is 1 with probability q and the crossover probability is p. With P(Y = 1) = q * (1 - p) + (1 - q) * p,

I = H(P(Y = 1)) - H(p)

where H is the binary entropy function in bits.

Hint

I(X; Y) = H(Y) - H(Y|X) and H(Y|X) is just the crossover entropy.

Test cases

case 1
in: [0.5,0.5]
expected: 0
case 2
in: [0.5,0]
expected: 1
case 3
in: [0.5,0.1]
expected: 0.5310044064107188
case 4
in: [0.3,0.2]
expected: 0.2361139273389372
Starter codePython
import math
def bsc_mutual_information(q, p):
    # Your code here
    pass

4 test cases · run your code against them in the editor