#NEWLINE# def gradient( self , prediction_points ) : #NEWLINE# #INDENT# if ( len ( prediction_points . shape ) == 1 ) : #NEWLINE# #INDENT# prediction_points . shape = ( 1 , prediction_points . shape [ 0 ] ) #NEWLINE# #UNINDENT# normalized_pts = ( ( prediction_points - self . _tpm ) / self . _tpr ) #NEWLINE# if ( ( self . _pt_cache is not None ) and np . allclose ( self . _pt_cache [ 0 ] , normalized_pts ) ) : #NEWLINE# #INDENT# ( pdist , ploc ) = self . _pt_cache [ 1 : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( pdist , ploc ) = self . _KData . query ( normalized_pts , self . N ) #NEWLINE# #UNINDENT# grad = ( self . _find_dR ( normalized_pts [ : , np . newaxis , : ] , ploc , pdist [ : , : , np . newaxis ] ) * ( self . _tvr [ ( ... , np . newaxis ) ] / self . _tpr ) ) #NEWLINE# return ploc