(prob, K=None, N=None, method='MLE')
Calculates the entropy of an (observed) probability ditribution
        based on Maximum Likelihood Estimation (MLE) (default) or using 
        a Miller correction. 

        @param prob: the observed probabilities
        @param K: the number of possible outcomes, i.e. outcomes with non-zero probability to be used 
            for the Miller correction (default None)
        @param N: number of samples based on which observed probabilities where computed. This
            is needed for the Miller correaction (default None)
        @param method: The method to be used to calculate entropy. Can be 'MLE' (default) or 'Miller'
Calculates the entropy of an (observed) probability ditribution
        based on Maximum Likelihood Estimation (MLE) (default) or using 
        a Miller correction.
Calculates the entropy of an ( observed ) probability ditribution based on Maximum Likelihood Estimation ( MLE ) ( default ) or using a Miller correction .
def __Entropy(prob, K=None, N=None, method='MLE'):
        """
        Calculates the entropy of an (observed) probability ditribution
        based on Maximum Likelihood Estimation (MLE) (default) or using 
        a Miller correction. 

        @param prob: the observed probabilities
        @param K: the number of possible outcomes, i.e. outcomes with non-zero probability to be used 
            for the Miller correction (default None)
        @param N: number of samples based on which observed probabilities where computed. This
            is needed for the Miller correaction (default None)
        @param method: The method to be used to calculate entropy. Can be 'MLE' (default) or 'Miller'
        """

        if method == 'MLE':
            idx = _np.nonzero(prob)
            return -_np.inner( _np.log2(prob[idx]), prob[idx] )
        elif method == 'Miller':
            assert K != None and N != None
            if N == 0:
                return 0
            else:
                idx = _np.nonzero(prob)
                return -_np.inner( _np.log2(prob[idx]), prob[idx] ) + (K-1)/(2*N)
def __Entropy ( prob , K = None , N = None , method = 'MLE' ) : if method == 'MLE' : idx = _np . nonzero ( prob ) return - _np . inner ( _np . log2 ( prob [ idx ] ) , prob [ idx ] ) elif method == 'Miller' : assert K != None and N != None if N == 0 : return 0 else : idx = _np . nonzero ( prob ) return - _np . inner ( _np . log2 ( prob [ idx ] ) , prob [ idx ] ) + ( K - 1 ) / ( 2 * N )