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

DOC Ensures that RadiusNeighborsClassifier passes numpydoc validation #20842

Merged

Conversation

jmloyola
Copy link
Member

@jmloyola jmloyola commented Aug 25, 2021

Reference Issues/PRs

Addresses #20308

What does this implement/fix? Explain your changes.

This PR ensures RadiusNeighborsClassifier is compatible with numpydoc.

  • Remove RadiusNeighborsClassifier from DOCSTRING_IGNORE_LIST.
  • Remove Deprecate unused parameter kwargs from RadiusNeighborsClassifier.
  • Verify that all tests are passing.
  • Add test to check that the FutureWarning is correctly raised.

Any other comments?

Just to reiterate, note that the parameter kwargs was removed deprecated from the __init__ method of RadiusNeighborsClassifier since it was not used.

@@ -437,7 +440,6 @@ def __init__(
outlier_label=None,
metric_params=None,
n_jobs=None,
**kwargs,
Copy link
Member Author

@jmloyola jmloyola Aug 26, 2021

Choose a reason for hiding this comment

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

@ogrisel, We should go through a deprecation cycle here too, right?

Copy link
Contributor

@glemaitre glemaitre Aug 31, 2021

Choose a reason for hiding this comment

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

Indeed, this is a fix: beforehand, a user could pass an arbitrary parameter that would be discarded indeed.
We could remove kwargs and consider it as a bug fix and it will force us to add a bug fix entry in the what's new.

Please add an entry to the change log at doc/whats_new/v*.rst. Like the other entries there, please reference this pull request with :pr: and credit yourself (and other contributors if applicable) with :user:.

Copy link
Contributor

@glemaitre glemaitre Sep 1, 2021

Choose a reason for hiding this comment

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

I just spoke with @ogrisel IRL, and it seems better to indeed deprecate kwargs. So we still need an entry in what's new but this time it should announce the deprecation instead of the hard removal.

So what we need to do here is to check the length of kwargs in __init__ and raise a FutureWarning mentioning that the parameters are ignored and that in 1.2 (or 1.3 since we might merge after the release) an error will be raised instead of this warning.

We will also need a small test to check that we properly raise the warning.

Copy link
Contributor

@glemaitre glemaitre left a comment

We only need to add the what's new entry. The rest is fine.

@rth
Copy link
Member

@rth rth commented Sep 2, 2021

Just a comment that the latest status on this PR is not the above approval but the comment in #20842 (comment) requesting to go through a deprecation cycle for kwargs removal.

@glemaitre glemaitre self-requested a review Sep 2, 2021
glemaitre
glemaitre previously requested changes Sep 2, 2021
Copy link
Contributor

@glemaitre glemaitre left a comment

I just remove my approval to be sure that no one merges by mistake. Sorry about that.

@jmloyola
Copy link
Member Author

@jmloyola jmloyola commented Sep 3, 2021

Done. 🤓
Let me know if there is anything else I need to do to improve the code.

rth
rth approved these changes Sep 3, 2021
Copy link
Member

@rth rth left a comment

Thanks @jmloyola !

I'll count Gullaume's previous approval for merging this PR.

@rth rth dismissed glemaitre’s stale review Sep 3, 2021

Comment addressed

@rth rth merged commit d270739 into scikit-learn:main Sep 3, 2021
33 checks passed
@jmloyola jmloyola deleted the fix_numpydoc_radiusneighborsclassifier branch Sep 3, 2021
samronsin pushed a commit to samronsin/scikit-learn that referenced this issue Nov 30, 2021
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.

None yet

3 participants