8000 FIX Fixes KNeighborsRegressor.predict with array-likes by Micky774 · Pull Request #22687 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

FIX Fixes KNeighborsRegressor.predict with array-likes #22687

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

Merged

Conversation

Micky774
Copy link
Contributor
@Micky774 Micky774 commented Mar 4, 2022

Reference Issues/PRs

Fixes #22683

What does this implement/fix? Explain your changes.

Previously KenighborsRegressor.predict was documented to accept "array-likes" however when weights is given as a callable, predict(X) calls X.shape[0]. To make predict compatible with array-likes this PR changes X.shape[0]-->len(X) and adds a non-regression test that fails on the main branch.

Any other comments?

Copy link
Member
@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Copy link
Member
@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

Just a small request. Otherwise LGTM.

@thomasjpfan thomasjpfan changed the title FIX Make KNeighborsRegressor.predict compatible with array-likes FIX Fixes KNeighborsRegressor.predict with array-likes Mar 5, 2022
@thomasjpfan thomasjpfan merged commit 742d39c into scikit-learn:main Mar 5, 2022
thomasjpfan added a commit to thomasjpfan/scikit-learn that referenced this pull request Mar 8, 2022
…22687)

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
@Micky774 Micky774 deleted the kneighbors_regressor_predict_arraylike branch March 19, 2022 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KNeighborsRegressor with a callable weights stopped working with numpy 1.22.2
4 participants
0