k-Nearest Neighbors#

legate_raft.knn.run_knn(index: ndarray, search: ndarray, n_neighbors: int, metric: str = 'l2')#

Run a brute-force kNN.

Parameters:
  • index (legate store like) – The index to search the nearest neighbors in. This data should be large and may be distributed over multiple nodes.

  • search (legate store like) – The search query to find the nearest neighbors for. Right now, this must be small enough to be broadcast on (copied to) all workers.

  • n_neighbors (int) – The number of neighbors to find.

  • metric (str) – The metric to use, currently supports “L2”.

Returns:

  • result_dist (legate store) – A legate store with the distance to each nearest neighbors.

  • result_indices (legate store) – The indices of the nearest neighbors for each point in search.