#NEWLINE# def radius_neighbors( self , X , radius = None , return_distance = True ) : #NEWLINE# #INDENT# 'Finds the neighbors within a given radius of a point or points.\n\n        Return the indices and distances of some points from the dataset\n        lying in a ball with size ``radius`` around the points of the query\n        array. Points lying on the boundary are included in the results.\n\n        The result points are *not* necessarily sorted by distance to their\n        query point.\n\n        LSH Forest being an approximate method, some true neighbors from the\n        indexed dataset might be missing from the results.\n\n        Parameters\n        ----------\n        X : array_like or sparse (CSR) matrix, shape (n_samples, n_features)\n            List of n_features-dimensional data points. Each row\n            corresponds to a single query.\n\n        radius : float\n            Limiting distance of neighbors to return.\n            (default is the value passed to the constructor).\n\n        return_distance : boolean, optional (default = False)\n            Returns the distances of neighbors if set to True.\n\n        Returns\n        -------\n        dist : array, shape (n_samples,) of arrays\n            Each element is an array representing the cosine distances\n            to some points found within ``radius`` of the respective query.\n            Only present if ``return_distance=True``.\n\n        ind : array, shape (n_samples,) of arrays\n            Each element is an array of indices for neighbors within ``radius``\n            of the respective query.\n        ' #NEWLINE# if ( not hasattr ( self , 'hash_functions_' ) ) : #NEWLINE# #INDENT# raise ValueError ( 'estimator should be fitted.' ) #NEWLINE# #UNINDENT# if ( radius is None ) : #NEWLINE# #INDENT# radius = self . radius #NEWLINE# #UNINDENT# X = check_array ( X , accept_sparse = 'csr' ) #NEWLINE# ( neighbors , distances ) = ( [ ] , [ ] ) #NEWLINE# ( bin_queries , max_depth ) = self . _query ( X ) #NEWLINE# for i in range ( X . shape [ 0 ] ) : #NEWLINE# #INDENT# ( neighs , dists ) = self . _get_radius_neighbors ( X [ [ i ] ] , max_depth [ i ] , bin_queries [ i ] , radius ) #NEWLINE# neighbors . append ( neighs ) #NEWLINE# distances . append ( dists ) #NEWLINE# #UNINDENT# if return_distance : #NEWLINE# #INDENT# return ( _array_of_arrays ( neighs ) , _array_of_arrays ( neighbors ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return _array_of_arrays ( neighbors )