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
Add support for callable metrics #94
Conversation
Thanks for the PR. I am missing tests, so we verify that regular python functions properly get compiled to numba code and a test with already numba compiled code. Also, as mentioned in #93, it would be great if we could keep things consistent, and that you would add callable support to the BallTree as well. |
I'll try adding tests, but I'm not very familiar and may need some guidance. |
Tests are added and passing. Let me know if you want me to add something more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good! I've got a couple nitpicks about the empty lines, to keep the formatting and style consistent across the codebase, but otherwise looks good. Please fix these couple cosmetic changes.
Should be good to go! Style errors are taken care of. I need to find a better linter. Have you seen black? https://black.readthedocs.io/en/stable/index.html I've been thinking about using it for my projects. |
Awesome, looks great!
Yes, I'm a fan of black. Most of the code in |
I forgot to squash your commits before merging, so I had to go through some git-gymnastics to get everything down to one coherent commit. That's why there's another commit in the history here. I didn't want to bother you with this, but next time, it's better that you squash your commits into a single one with a descriptive commit message, or do an interactive rebase to organize your commits. I've taken care of it now, though. Thanks for your contribution 😄 |
Ah, sorry about that. I'll keep that in mind for next time. No problem! Glad I could help 😄 |
Issue
See #93
Description of changes
Added the option for callable metrics to the
openTSNE.nearest_neighbors
module.NNDescent
checks if metric is compiled withnumba
, gives an informative warning, and then attempts to automatically compile it. If the function is already compiled orNNDescent
is not being used then the callable is passed without any further checks. Docstrings have also been updated to match other docstrings with multiple types. If you'd like unit tests for this, then please provide guidance on how best to do this.Includes