Typical workflow for k-nearest neighbors - Typical workflow for k-nearest neighbors - 5.3 English - 68552

AOCL API Guide (68552)

Document_ID
68552
Release_Date
2026-05-13
Version
5.3 English

The standard way of computing the k-nearest neighbors is as follows.

  1. Initialize a aoclda.neighbors.nearest_neighbors() object with options set in the class constructor.

  2. Fit the k-NN for your training data set using aoclda.neighbors.nearest_neighbors.fit().

  3. Compute the indices of the nearest neighbors and optionally the corresponding distances using aoclda.neighbors.nearest_neighbors.kneighbors().

  1. Initialize a da_handle with da_handle_type da_handle_nn.

  2. Pass data to the handle using da_nn_set_data_?.

  3. Compute the indices of the nearest neighbors and optionally the corresponding distances using da_nn_kneighbors_?.