#NEWLINE# def negentropy( self , E_x = None , E_ln_p = None ) : #NEWLINE# #INDENT# '\n        Compute the negative entropy of the discrete distribution.\n\n        :param E_x:     Expected observation\n        :param E_ln_p:  Expected log probability\n        :return:\n        ' #NEWLINE# if ( E_x is None ) : #NEWLINE# #INDENT# E_x = self . expected_x ( ) #NEWLINE# #UNINDENT# if ( E_ln_p is None ) : #NEWLINE# #INDENT# E_ln_p = np . log ( self . p ) #NEWLINE# #UNINDENT# H = E_x . dot ( E_ln_p ) #NEWLINE# return np . nan_to_num ( H )