(cls, D, axis=None)
return - np.sum(D * np.log2(Dc), axis=axis)
Compute the entropy of distribution array `D`.

        `D` must be a distribution (i.e. sum to 1.0 over `axis`)

        Parameters
        ----------
        D : array
            Distribution.
        axis : optional int
            Axis of `D` along which to compute the entropy.
Compute the entropy of distribution array `D`.
Compute the entropy of distribution array D .
def _entropy_normalized(cls, D, axis=None):
        """
        Compute the entropy of distribution array `D`.

        `D` must be a distribution (i.e. sum to 1.0 over `axis`)

        Parameters
        ----------
        D : array
            Distribution.
        axis : optional int
            Axis of `D` along which to compute the entropy.

        """
        # req: (np.sum(D, axis=axis) >= 0).all()
        # req: (np.sum(D, axis=axis) <= 1).all()
        # req: np.all(np.abs(np.sum(D, axis=axis) - 1) < 1e-9)

        D = np.asarray(D)
        Dc = np.clip(D, np.finfo(D.dtype).eps, 1.0)
        return - np.sum(D * np.log2(Dc), axis=axis)
def _entropy_normalized ( cls , D , axis = None ) : # req: (np.sum(D, axis=axis) >= 0).all() # req: (np.sum(D, axis=axis) <= 1).all() # req: np.all(np.abs(np.sum(D, axis=axis) - 1) < 1e-9) D = np . asarray ( D ) Dc = np . clip ( D , np . finfo ( D . dtype ) . eps , 1.0 ) return - np . sum ( D * np . log2 ( Dc ) , axis = axis )