Approximate Nearest Neighbor - Pynndescent

450 Views Asked by At

I am using Pynndescent for the approximate nearest neighbor (ANN) in python for my research project. I follow the same code provided by the author of (Pynndescent). Unfortunately, there is no function in the pynndescent library for the fit/transform so I can predict the result and extract the other evaluations like Precision, recall, f1-score and confusion matrix. Would you please help?

Thank you

1

There are 1 best solutions below

0
Leland McInnes On

PyNNDescent is an approach to computing nearest neighbors, not performing nearest neighbor classification or regression. For the latter you will want something like sklearn's KNeighborsClassifier or KNeighborsRegressor. In more positive news the more recent versions of these support the use of sklearn's KNeighborsTransformer in a pipeline approach. The PyNNDescent library includes a class PyNNDescentTransformer that follows the KNeighborsTransformer API and thus can be used in an equivalent pipeline approach with KNeighborsClassifier or KNeighborsRegressor. See the PyNNDescent documentation on pipelines, documentation on sklearn's KNeighborsTransformer and this example using KNeighborsTransformer for background on how these pieces can be put together. There is, admittedly, limited documentation on this right now.