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
[ENH] k-nearest neighbors regressor: support for non-brute algorithms and non-precomputed mode to improve memory efficiency #6217
Conversation
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 for your contribution. I think your changes are fine on their own, but you probably discovered some previously unknown bugs that's causing failures in CI.
@fkiraly can you please take a look? This seems to be coming from this line:
metric="precomputed", |
Hi @yarnabrina @fkiraly. It seems like sklearn doesn't support all tree algorithms to accept a precomputed distance matrix. (mentioned there) BTW, could you please tell me why the parameter |
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.
@Z-Fran, thanks!
Well-spotted, indeed we find bugs in a couple places when we add new test parameters.
But you've already identified and fixed it, nice!
I'm happy to merge this PR, although it introduces duplication in the kneighbors estimators.
Generally, if you end up copying multiple lines of code, that is an "antipattern", violating the DRY ("don't repeat yourself") principle.
Simlar code also exists in other places, in relation to the distances, so it might be good to move it into a single location, e.g., in a new module distances._adapters.sklearn
.
I'd consider that a task for a separate PR though - so you can take a stab at it, or we should track it as an issue for someone else to pick up ("resolve duplication in...")
More generally, there's some open work around the distances, which could be a nice longer project if you are interested.
@fkiraly I'm sorry for not getting back to you sooner. I will resolve the duplication for a separate PR after merging this PR. I will also track some open work around the distances in my free time. |
KNeighborsTimeSeriesRegressor
Reference Issues/PRs
#3429 (comment)
What does this implement/fix? Explain your changes.
adds test parameter sets for
KNeighborsTimeSeriesRegressor
;adds support for non-brute algorithms and non-precomputed mode, mirroring #5937
For all contributions
How to: add yourself to the all-contributors file in the
sktime
root directory (not theCONTRIBUTORS.md
). Common badges:code
- fixing a bug, or adding code logic.doc
- writing or improving documentation or docstrings.bug
- reporting or diagnosing a bug (get this pluscode
if you also fixed the bug in the PR).maintenance
- CI, test framework, release.See here for full badge reference
maintainers
tag - do this if you want to become the owner or maintainer of an estimator you added.See here for further details on the algorithm maintainer role.