amads.algorithms.entropy#
- amads.algorithms.entropy(d) float [source]#
Calculate the relative entropy of a distribution.
- Parameters:
d (
List
[float
]) – The input distribution.- Returns:
The relative entropy (0 <= H <= 1).
- Return type:
float
Notes
Implementation based on the original MATLAB code from: miditoolbox/1.1
Examples
>>> entropy([0.5, 0.5]) 1.0
>>> entropy([0.0, 1.0]) 0.0