Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MAINT Improve Nearest Neighbor documentation + code consistency #19793

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
merged 3 commits into from
Apr 5, 2021

Conversation

chrisyeh96
Copy link
Contributor

@chrisyeh96 chrisyeh96 commented Mar 31, 2021

  1. Fix typos

  2. Use self.metric == "precomputed" instead of combination of both self.effective_metric and self.metric. (self.effective_metric is only different from self.metric only for minkowski metric. For "precomputed" metric, self.effective_metric and self.metric are equivalent.)

  3. Use n_samples_fit instead of a combination of both n_indexed and n_samples_fit

  4. Other minor changes

1) Fix typos
2) Use self.metric == "precomputed" instead of combination of both self.effective_metric and self.metric
3) Use n_samples_fit instead of a combination of both n_indexed and n_samples_fit
4) Other minor changes
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.

I think most of the code changes are an improvement.

For the documentation changes, we do use n_indexed in other places, such as check_pairwise_arrays. To move forward, I suggest reverting the docstring changes relating to n_indexed and opening another PR for n_indexed.

In general, keeping PRs smaller makes them easier to merge.

sklearn/neighbors/_base.py Outdated Show resolved Hide resolved
@chrisyeh96
Copy link
Contributor Author

@thomasjpfan Per your instructions, I've reverted the relevant changes.

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.

I think staying consistent with the rest of the library using self.metric == 'precomputed' is net win.

LGTM

@thomasjpfan thomasjpfan changed the title Improve Nearest Neighbor documentation + code consistency MAINT Improve Nearest Neighbor documentation + code consistency Apr 4, 2021
@TomDLT TomDLT merged commit aa1fba9 into scikit-learn:main Apr 5, 2021
@TomDLT
Copy link
Member

TomDLT commented Apr 5, 2021

Thanks @chrisyeh96 !

@chrisyeh96 chrisyeh96 deleted the patch-2 branch April 6, 2021 00:10
thomasjpfan pushed a commit to thomasjpfan/scikit-learn that referenced this pull request Apr 19, 2021
@glemaitre glemaitre mentioned this pull request Apr 22, 2021
12 tasks
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.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.