original_docstring:  Discrete entropy estimator
          sx is a list of samples
      
docstring: Discrete entropy estimator
  sx is a list of samples
docstring_tokens: Discrete entropy estimator sx is a list of samples
code: def entropyd(sx, base=2):
      """ Discrete entropy estimator
          sx is a list of samples
      """
      unique, count = np.unique(sx, return_counts=True, axis=0)
      # Convert to float as otherwise integer division results in all 0 for proba.
      proba = count.astype(float) / len(sx)
      # Avoid 0 division; remove probabilities == 0.0 (removing them does not change the entropy estimate as 0 * log(1/0) = 0.
      proba = proba[proba > 0.0]
      return np.sum(proba * np.log(1. / proba)) / log(base)
code_tokens: def entropyd ( sx , base = 2 ) : unique , count = np . unique ( sx , return_counts = True , axis = 0 ) proba = count . astype ( float ) / len ( sx ) proba = proba [ proba > 0.0 ] return np . sum ( proba * np . log ( 1. / proba ) ) / log ( base )
short_docstring: Discrete entropy estimator
  sx is a list of samples
short_docstring_tokens: Discrete entropy estimator sx is a list of samples
comment: """ Discrete entropy estimator
          sx is a list of samples
      """$SEP$# Convert to float as otherwise integer division results in all 0 for proba.$SEP$# Avoid 0 division; remove probabilities == 0.0 (removing them does not change the entropy estimate as 0 * log(1/0) = 0.