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

Initialize indices with 1, allows for Infs and NaNs in the data #126

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nlw0
Copy link

@nlw0 nlw0 commented Oct 1, 2021

The patch merely modifies the algorithm to initialize the index list with 1 instead of -1. New tests are added that reproduce issues #78 and #125.

It's a bit of a decision what to do with NaNs, in my opinion it's best if we ensure indices are always valid, and a NaN distance is as good as Inf.

@nlw0
Copy link
Author

nlw0 commented Oct 1, 2021

Tried out NaN on data, and turns out in that case we still have problems. Hard to figure out what to do in that case, will need more work, not as easy as this patch. Left a commented test for that issue.

@nlw0
Copy link
Author

nlw0 commented Oct 1, 2021

Turns out this patch actually does not solve #78, we return a valid index, but it's not the correct one in that case... Not sure how to solve it. for #125 it's fine.

@@ -31,6 +16,21 @@ end
end
end

# # Test for issue #78
Copy link

Choose a reason for hiding this comment

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

Not sure why you commented this out,
but if its merely because the test fails, a @test_broken might be appropriate so we know its broken :)

@axsk
Copy link

axsk commented Oct 25, 2021

I guess this might also solve #127 (maybe add the test)

Considering #78 this might be related to something else (since it only happens with BallTrees) so I think it would be nice to have this merged either way.

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

Successfully merging this pull request may close these issues.

2 participants