Lesson 13 of 15
Channel Capacity
Channel Capacity
Shannon's channel capacity is the maximum rate at which information can be transmitted reliably over a noisy channel:
Binary Symmetric Channel (BSC)
The simplest noisy channel flips each bit independently with probability :
BSC Capacity
The maximum MI over BSC() is achieved by the uniform input distribution:
where is the binary entropy function:
Special Cases
| Error probability | Capacity |
|---|---|
| (noiseless) | bit |
| (pure noise) | bits |
| (inverted) | bit (just flip output) |
import math
def binary_entropy(p):
if p <= 0 or p >= 1:
return 0.0
return -p * math.log2(p) - (1-p) * math.log2(1-p)
def binary_channel_capacity(p_error):
return 1 - binary_entropy(p_error)
print(binary_channel_capacity(0.0)) # 1.0
print(binary_channel_capacity(0.5)) # 0.0
print(round(binary_channel_capacity(0.1), 4)) # 0.531
Your Task
Implement:
binary_entropy(p)— ; return for orbinary_channel_capacity(p_error)—bsc_capacity(p)— alias forbinary_channel_capacity
Python runtime loading...
Loading...
Click "Run" to execute your code.