Энтропия питона

import numpy as np

# 3 decimal points
round = 3

# entropy(q) = -( q * log2(q) + (1-q) * log2(1-q) )
def entropy(q):
    entropy = -(q * np.log2(q) + (1-q) * np.log2(1-q))
    entropy = np.round(entropy, round)
    return entropy
  
# print(entropy(0.3)) = 0.881
SMR