-
Notifications
You must be signed in to change notification settings - Fork 140
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
Support for Other KNN Distance Metrics #26
Comments
You need to adjust the distance computation here. We could add a flag to support different distance metrics. Feel free to submit a PR if you would like to contribute on this one. |
Ok, will do. How does the knn computation introduced here compare to other ANN methods (say an approximated way to make this faster)? |
What do you mean with ANN methods? |
Ah I see, well for CPU computation we fallback to scipy. The GPU version does parallelization over the number of examples (block parallelization) and number of nodes (thread parallelization), so it is only fast when using a fair amount of batched examples and when not having too many data points in each example (ideally around |
Ah makes sense. The data I am dealing with can range in size to order ~ 10k x 100k GPU computed affinity does seem tractable if it can handle this size of data |
I forked it. If the goal is just to form an unweighted adjacency, is the more sensible calculation ||a|| ||b|| - dot(a,b) rather than 1-dot(a,b)/(||a|| * ||b||), I suppose it doesn't matter, but I may implement the former, I see you've done that for euclidean. |
Sounds good to me :) |
Just a heads up, I've never coded in cuda before, and its been a bit of time since I've done any serious c++, so please forgive me if I botch some of this. ;) |
For the non-cuda implementation, seems the cosine metric is not as used with KDTree, except given some transformation. We may have to use another indexing method. |
I'll just replace the c implementation for now with sklearn's. It's slower, we can just use it as a placeholder as we make changes to the PR. |
This is really genius! I was really confused at first, so it may be helpful to add a few lines of explanation in the source code. |
Could one compute the knn_graph using a cosine distance metric?
The text was updated successfully, but these errors were encountered: