query_radius(self, X, r, count_only = False):
query the tree for neighbors within a radius r
Parameters ---------- X : array-like of shape (n_samples, n_features) An array of points to query r : distance within which neighbors are returned r can be a single value, or an array of values of shape x.shape:-1
if different radii are desired for each point. return_distance : boolean (default = False) if True, return distances to neighbors of each point if False, return only neighbors Note that unlike the query() method, setting return_distance=True here adds to the computation time. Not all distances need to be calculated explicitly for return_distance=False. Results are not sorted by default: see ``sort_results`` keyword. count_only : boolean (default = False) if True, return only the count of points within distance r if False, return the indices of all points within distance r If return_distance==True, setting count_only=True will result in an error. sort_results : boolean (default = False) if True, the distances and indices will be sorted before being returned. If False, the results will not be sorted. If return_distance == False, setting sort_results = True will result in an error.
Returns ------- count : if count_only == True ind : if count_only == False and return_distance == False (ind, dist) : if count_only == False and return_distance == True
count : array of integers, shape = X.shape:-1
each entry gives the number of neighbors within a distance r of the corresponding point.
ind : array of objects, shape = X.shape:-1
each element is a numpy integer array listing the indices of neighbors of the corresponding point. Note that unlike the results of a k-neighbors query, the returned neighbors are not sorted by distance by default.
dist : array of objects, shape = X.shape:-1
each element is a numpy double array listing the distances corresponding to indices in i.