The standard way of computing the k-nearest neighbors for regression using AOCL-DA is as follows.
Initialize a
aoclda.nearest_neighbors.knn_regressor()object with options set in the class constructor.Fit the k-NN for your training data set using
aoclda.nearest_neighbors.knn_regressor.fit().Compute the indices of the nearest neighbors and optionally the corresponding distances using
aoclda.nearest_neighbors.knn_regressor.kneighbors().If only the target values of the test data are required, use
aoclda.nearest_neighbors.knn_regressor.predict(). Note that a previous call toaoclda.nearest_neighbors.knn_regressor.kneighbors()is not required.
Initialize a
da_handlewithda_handle_typeda_handle_nn.Pass data to the handle using da_nn_regressor_set_training_data_?.
Set the number of neighbors required and the metric or weights used in k-NN using da_options_set_? (see below).
Compute the indices of the nearest neighbors and optionally the corresponding distances using da_nn_kneighbors_?.
If only the target values of the test data are required, use da_nn_regressor_predict_?.