Skip to content

Expose supported brute force metrics in all_neighbors#1827

Open
jinsolp wants to merge 6 commits intorapidsai:mainfrom
jinsolp:all-neighbors-bf-metrics
Open

Expose supported brute force metrics in all_neighbors#1827
jinsolp wants to merge 6 commits intorapidsai:mainfrom
jinsolp:all-neighbors-bf-metrics

Conversation

@jinsolp
Copy link
Copy Markdown
Contributor

@jinsolp jinsolp commented Feb 19, 2026

Closes #1715

Exposes supported brute force metrics in all_neighbors API.

@jinsolp jinsolp self-assigned this Feb 19, 2026
@jinsolp jinsolp requested review from a team as code owners February 19, 2026 23:35
@jinsolp jinsolp added non-breaking Introduces a non-breaking change feature request New feature or request labels Feb 19, 2026
@jinsolp jinsolp moved this to In Progress in Unstructured Data Processing Feb 19, 2026
Copy link
Copy Markdown
Contributor

@viclafargue viclafargue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the suggestion, but for readability i prefer to stick to the unordered sets!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request non-breaking Introduces a non-breaking change

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

[FEA] Expose supported metrics for brute force in all_neighbors

3 participants