feat: Add Chebyshev distance (L_∞ norm) support#290
Open
cbueth wants to merge 14 commits intosdd:v5.x.xfrom
Open
feat: Add Chebyshev distance (L_∞ norm) support#290cbueth wants to merge 14 commits intosdd:v5.x.xfrom
cbueth wants to merge 14 commits intosdd:v5.x.xfrom
Conversation
…lidean distance metrics
- deprecate `rd_update` with `D::accumulate` for consistent handling of sum-based and max-based metrics - conditional logic for SIMD (L1/L2) and general L∞ - differentiate distance accumulation behaviour
- integration `nearest_n` tests (Chebyshev, Manhattan, SquaredEuclidean).
…doc, add Gaussian scenario to tests
… trait - improve test coverage
Owner
|
Hi again Carlson! Just seen this, I will check them out over the next day or two. Thanks! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v5.x.x #290 +/- ##
==========================================
+ Coverage 94.89% 95.03% +0.13%
==========================================
Files 54 54
Lines 5685 6264 +579
Branches 5685 6264 +579
==========================================
+ Hits 5395 5953 +558
- Misses 273 287 +14
- Partials 17 24 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
Sounds good, thanks :) |
Owner
|
Thanks. As it is, the commit lint step fails because some of your commit message subjects are not confirming to Conventional Commits standard. You can either fix them individually with interactive rebase, or squash them into one commit with a catch-all subject like |
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.
This is a PR #286, reopened for the fitting branch. I rebased my suggested changes, dropping all other commits. Locally all test still pass. I have added a few cases to increase code coverage. Find the PR description over at #286. I will just add onto. it here.
For the default implementation of
accumulateI understood best to usenum_traits::SaturatingAdd, but this trait is only implemented for integer types, not for floating-point types (f32, f64). So now I changed it to usestd::ops::Addas the bound, which works for both integers and floats. This means the defaultrd + deltaworks correctly for floating-point types (produces inf on overflow), but fixed-point types need to override accumulate with rd.saturating_add(delta) to prevent overflow. I ignorantly assume that this covers a larger userbase and think this solution is the best we can do without specialization (is currently unstable https://std-dev-guide.rust-lang.org/policy/specialization.html / rust-lang/rust#31844). To my understanding this is still a breaking change for users with fixed-point types who implement customDistanceMetrics. The only feasible alternative I see would be with a macro to generate implementations that can differentiate the two. Please correct me if I got this wrong.Secondly, I want to clarify a statement from my previous #286 (comment).
I was only not able to find a relevant test where the
<=removed in c934656 did (dist_belongs_in_heap) make a difference, so I changed them to<. But still, there are other occurences that are still included and that did make a difference in the test with gaussian data. So if you think there are some cases where having the<=fordist_belongs_in_heap, these can be re-added. Right now there are many parametrizes test cases withnearest_n, but not forwithin.If there are suggestions for changes, don't heasitate to say so.
Closes #286