Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch query from python #41

Closed
scottgigante opened this issue Oct 24, 2019 · 2 comments
Closed

Batch query from python #41

scottgigante opened this issue Oct 24, 2019 · 2 comments

Comments

@scottgigante
Copy link

Thanks for building NGT, this is excellent!
I'm wondering what would be the most efficient way to compute the approximate k nearest neighbours for all data points in the index in python. I see you have a batch_insert function but I do not see an equivalent batch_query function.
The equivalent code in e.g. scikit-learn would be

import sklearn.neighbors
distances, indices = sklearn.neighbors.NearestNeighbors(n_neighbors).fit(data).kneighbors(data)
@masajiro
Copy link
Member

Thank you for your interest.

Although NGT does not have batch_query you mentioned, you only have to iterate search() with all of the registered objects after constructing an index.

@scottgigante
Copy link
Author

Thanks. I was hoping to avoid a Python for loop, but this will be sufficient. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants