comnum.entropy#
- comnum.entropy(px)#
The entropy
H = -Σ p log2 pof a distribution (bits): the information per symbol of a shaped source.- Parameters:
px (array_like) – the probabilities.
- Returns:
the entropy (bits).
- Return type:
- Raises:
ValueError – for an input that is not an array of numbers of the expected shape.
Examples
>>> import comnum >>> comnum.entropy([0.25, 0.25, 0.25, 0.25]) 2.0