#NEWLINE# def density( self , xs , x ) : #NEWLINE# #INDENT# n = len ( xs ) #NEWLINE# if ( len ( xs ) > 0 ) : #NEWLINE# #INDENT# if ( self . weights is not None ) : #NEWLINE# #INDENT# w = ( np . mean ( ( self ( ( ( n - x ) * self . _Hrootinv ) ) . T * self . weights ) ) / sum ( self . weights ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# w = np . mean ( self ( ( ( xs - x ) * self . _Hrootinv ) ) ) #NEWLINE# #UNINDENT# return w #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return np . nan