#NEWLINE# @ cache_readonly #NEWLINE# def entropy( self ) : #NEWLINE# #INDENT# '\n        Returns the differential entropy evaluated at the support\n\n        Notes\n        -----\n        Will not work if fit has not been called. 1e-12 is added to each\n        probability to ensure that log(0) is not called.\n        ' #NEWLINE# _checkisfit ( kern ) #NEWLINE# def entr( x , s ) : #NEWLINE# #INDENT# pdf = kern . density ( s , x ) #NEWLINE# return ( pdf * np . log ( ( pdf + 1e-12 ) ) ) #NEWLINE# #UNINDENT# pdf = self . density #NEWLINE# kern = self . kernel #NEWLINE# if ( kern . domain is not None ) : #NEWLINE# #INDENT# ( a , b ) = self . domain #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( a , b ) = ( ( - np . inf ) , np . inf ) #NEWLINE# #UNINDENT# endog = self . endog #NEWLINE# return ( - integrate . quad ( entr , a , b , args = ( endog , ) ) [ 0 ] )