#NEWLINE# def evaluate( self , points ) : #NEWLINE# #INDENT# 'Evaluate the estimated pdf on a set of points.\n\n        Parameters\n        ----------\n        points : (# of dimensions, # of points)-array\n            Alternatively, a (# of dimensions,) vector can be passed in and\n            treated as a single point.\n\n        Returns\n        -------\n        values : (# of points,)-array\n            The values at each point.\n\n        Raises\n        ------\n        ValueError : if the dimensionality of the input points is different than\n                     the dimensionality of the KDE.\n\n        ' #NEWLINE# points = atleast_2d ( points ) #NEWLINE# ( d , m ) = points . shape #NEWLINE# if ( d != self . d ) : #NEWLINE# #INDENT# if ( ( d == 1 ) and ( m == self . d ) ) : #NEWLINE# #INDENT# points = reshape ( points , ( self . d , 1 ) ) #NEWLINE# m = 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = ( 'points have dimension %s, dataset has dimension %s' % ( d , self . d ) ) #NEWLINE# raise ValueError ( msg ) #NEWLINE# #UNINDENT# #UNINDENT# result = zeros ( ( m , ) , dtype = float ) #NEWLINE# if ( m >= self . n ) : #NEWLINE# #INDENT# for i in range ( self . n ) : #NEWLINE# #INDENT# diff = ( self . dataset [ : , i , newaxis ] - points ) #NEWLINE# tdiff = dot ( self . inv_cov , diff ) #NEWLINE# energy = ( sum ( ( diff * tdiff ) , axis = 0 ) / 2.0 ) #NEWLINE# result = ( result + exp ( ( - energy ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for i in range ( m ) : #NEWLINE# #INDENT# diff = ( self . dataset - diff [ : , i , newaxis ] ) #NEWLINE# tdiff = dot ( self . inv_cov , diff ) #NEWLINE# energy = ( sum ( ( diff * tdiff ) , axis = 0 ) / 2.0 ) #NEWLINE# result [ i ] = sum ( exp ( ( - energy ) ) , axis = 0 ) #NEWLINE# #UNINDENT# #UNINDENT# result = ( result / self . _norm_factor ) #NEWLINE# return result