Expose supported brute force metrics in all_neighbors#1827
Open
jinsolp wants to merge 6 commits intorapidsai:mainfrom
Open
Expose supported brute force metrics in all_neighbors#1827jinsolp wants to merge 6 commits intorapidsai:mainfrom
all_neighbors#1827jinsolp wants to merge 6 commits intorapidsai:mainfrom
Conversation
tarang-jain
reviewed
Feb 20, 2026
viclafargue
approved these changes
Mar 20, 2026
Contributor
viclafargue
left a comment
There was a problem hiding this comment.
Thanks! Not familiar with which metric would be supported by the different algorithms. However, the code change in itself looks good to me.
Comment on lines
+24
to
+38
| static const std::unordered_set<DT> mrd_allowed_metrics = { | ||
| DT::L2Expanded, DT::L2SqrtExpanded, DT::CosineExpanded}; | ||
|
|
||
| static const std::unordered_set<DT> bf_allowed_metrics = {DT::L2Expanded, | ||
| DT::L2SqrtExpanded, | ||
| DT::CosineExpanded, | ||
| DT::L1, | ||
| DT::L2Unexpanded, | ||
| DT::L2SqrtUnexpanded, | ||
| DT::InnerProduct, | ||
| DT::Linf, | ||
| DT::Canberra, | ||
| DT::LpUnexpanded, | ||
| DT::CorrelationExpanded, | ||
| DT::JensenShannon}; |
Contributor
There was a problem hiding this comment.
Small detail, a switch statement might be slightly faster than building and searching a std::unordered_set, but the std::unordered_set probably offers cleaner code.
Contributor
Author
There was a problem hiding this comment.
thanks for the suggestion, but for readability i prefer to stick to the unordered sets!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1715
Exposes supported brute force metrics in
all_neighborsAPI.