Skip to content

[MRG] Update quantile_transform copy default to True - #13459

Merged
qinhanmin2014 merged 8 commits into
scikit-learn:masterfrom
HunterMcGushion:quantile-transform-copy-default
Mar 20, 2019
Merged

qinhanmin2014 merged 8 commits into
scikit-learn:masterfrom
HunterMcGushion:quantile-transform-copy-default

Conversation

@HunterMcGushion

Copy link
Copy Markdown
Contributor

What does this implement/fix? Explain your changes.

  • Changes default value for the copy kwarg in :func:preprocessing.data.quantile_transform from False to True
  • The original default of copy=False was in conflict with the function's documentation:
    copy : boolean, optional, (default=True)
  • This was the only function in the module, whose default copy kwarg value was False
  • Seems like True was the intended default, since performing an in-place transformation by default is pretty unexpected - At least, it was for me

Any other comments?

  • If the signature was correct, and copy=False was the intended default, I'd be happy to update the documentation instead
  • In any case, the documentation conflicts with the actual signature

@HunterMcGushion HunterMcGushion changed the title Update quantile_transform copy default to True [MRG] Update quantile_transform copy default to True Mar 17, 2019

@qinhanmin2014 qinhanmin2014 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@HunterMcGushion

HunterMcGushion commented Mar 18, 2019 •

Copy link
Copy Markdown
Contributor Author

@qinhanmin2014, got it. Sorry for overlooking that. What version should the FutureWarning list for the change to take place?

Would it make sense to change the docstring to at least match the current default, since the two are still in conflict?

@qinhanmin2014

Copy link
Copy Markdown
Member

What version should the FutureWarning list for the change to take place?

0.23 (next release is 0.21)

Would it make sense to change the docstring to at least match the current default, since the two are still in conflict?

We usually add some notes in the docstring, e.g., see https://scikit-learn.org/dev/modules/generated/sklearn.metrics.auc.html.

@HunterMcGushion

Copy link
Copy Markdown
Contributor Author

Alright, so leave line 2492 unchanged, and just add a note that the default value stated there is incorrect and will be fixed in 0.23?

@qinhanmin2014

Copy link
Copy Markdown
Member

Alright, so leave line 2492 unchanged, and just add a note that the default value stated there is incorrect and will be fixed in 0.23?

Please refer to https://scikit-learn.org/dev/developers/contributing.html#change-the-default-value-of-a-parameter

@HunterMcGushion

Copy link
Copy Markdown
Contributor Author

Ah, of course. I feel quite ridiculous. Thanks for pointing me in the right direction again

@jnothman

Copy link
Copy Markdown
Member

Thanks for raising this! I agree it's an unnecessary surprise.

@HunterMcGushion

HunterMcGushion commented Mar 19, 2019 •

Copy link
Copy Markdown
Contributor Author

Thanks, @qinhanmin2014 and @jnothman! Looks like a few of the checks are failing because the FutureWarning just added is being raised.

So just to make sure I'm following the guidelines, I should just wrap the failing tests with @pytest.mark.filterwarnings(...), correct?

@qinhanmin2014

qinhanmin2014 commented Mar 19, 2019 •

Copy link
Copy Markdown
Member

So just to make sure I'm following the guidelines, I should just wrap the failing tests with @pytest.mark.filterwarnings(...), correct?

Yes, please. Maybe add some comments, e.g., @pytest.mark.filterwarnings(...) # 0.23

The deprecation message seems strange, please try to follow the contributing guide. (e.g., The default value of XXX will change from XXX to XXX in XXX in order to.../because...)

@HunterMcGushion

Copy link
Copy Markdown
Contributor Author

@qinhanmin2014, regarding 08faa3c, is this the proper way to deal with deprecations in the docstring examples? Or should I use warnings.filterwarnings?

Comment thread sklearn/preprocessing/data.py Resolved
Comment thread doc/whats_new/v0.21.rst Resolved
Comment thread sklearn/preprocessing/data.py Resolved

@qinhanmin2014 qinhanmin2014 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @HunterMcGushion

@qinhanmin2014 qinhanmin2014 added this to the 0.21 milestone Mar 20, 2019
@jnothman

Copy link
Copy Markdown
Member

Thanks @HunterMcGushion!

@qinhanmin2014
qinhanmin2014 merged commit b646a81 into scikit-learn:master Mar 20, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants