Calculate the entropy (expected surprisal).
entropy([1/16, 1/2, 1/4])
prob | The list of probabilities of which the entropy is to be calculated. |
return value | The entropy of the given probabilities. |
The function takes a list of probabilities as its argument, and returns the entropy.
The logarithm used for calculating entropy is base 2.