[MRG] FIX Update power_transform docstring and add FutureWarning#12317
[MRG] FIX Update power_transform docstring and add FutureWarning#12317ogrisel merged 7 commits intoscikit-learn:masterfrom
Conversation
f361416 to
916f891
Compare
916f891 to
dffa9ce
Compare
|
Good catch but unfortunately, now that 0.20 is released we cannot change the default value of a public function like this. We probably need to go through a |
sklearn/preprocessing/data.py
Outdated
| ---------- | ||
| X : array-like, shape (n_samples, n_features) | ||
| The data to be transformed using a power transformation. | ||
| The data used to estimate the optimal transformation parameters. |
There was a problem hiding this comment.
I'd leave the original version: ultimately the goal of power_transform() is to transform X, the estimation of lambda is just an intermediary step.
| Set to False to perform inplace computation. | ||
| Set to False to perform inplace computation during transformation. | ||
|
|
||
| Examples |
There was a problem hiding this comment.
Just noticed that the docstring is missing a Return section
sklearn/preprocessing/data.py
Outdated
| NaNs are treated as missing values: disregarded to compute the statistics, | ||
| and maintained during the data transformation. | ||
| NaNs are treated as missing values: disregarded in fit, and maintained in | ||
| transform. |
There was a problem hiding this comment.
nitpick: fit and transform (with double backticks)
|
Damn! We waited with the release for being able to do this! It's pretty bad we messed this up. |
|
Yeah sorry, my bad. It really slipped under my radar. |
|
@NicolasHug I should have caught that :-/ don't worry about it. |
jnothman
left a comment
There was a problem hiding this comment.
I don't think changing this in 0.20.1 accords with our backwards compatibility policies, unfortunately.
11da2a1 to
c899d07
Compare
|
Darn, now I wish I had taken a look sooner too. Updated it to a throw a |
59b0e62 to
c4abc8f
Compare
sklearn/preprocessing/data.py
Outdated
| """ | ||
| if method == 'warn': | ||
| warnings.warn("The default value of 'method' will change from " | ||
| "'box-cox' to 'yeo-johnson' in version 0.21. Set " |
There was a problem hiding this comment.
0.21? No, by default we'd say 0.23. I don't really see the advantage in doing differently here.
|
For people that don't upgrade from 0.20.0 to 0.20.1 we can't suddenly
change it without warning in 0.21.
|
c4abc8f to
4ac4b07
Compare
sklearn/preprocessing/data.py
Outdated
|
|
||
| Returns | ||
| ------- | ||
| X_trans : array-like, shape (n_samples, n_features) |
sklearn/preprocessing/data.py
Outdated
| method : str, (default='box-cox') | ||
| The power transform method. Currently, 'box-cox' (Box-Cox transform) | ||
| is the only option available. | ||
| method : str, (default='warn') |
There was a problem hiding this comment.
don't specify default, as it is obscure. Explain below the current behaviour.
amueller
left a comment
There was a problem hiding this comment.
Looks good apart from Joel's comments.
e52b471 to
62b43e3
Compare
|
Updated with Joel's notes. |
|
Thank you very much for the fix! |
|
@chang Please add an entry to the change log at |
|
Indeed, merged too quickly. This should be backported to v0.20.1rst I think. |
|
No worries, I can open a separate PR for the changelog tomorrow. |
|
No reason not to warn from 0.20.1, I just don't think we can fairly switch
without warning.
|
|
So the consensus is hurry this one into 0.20.1? Fine. as long as we remember to finish the deprecation in 0.23 (since the entry is now in 0.20.1, not 0.21.) |
|
As you prefer. Otherwise we could deprecate in 0.20.1 or 0.20.2 and remove in 0.22. As you prefer. |
Reference Issues/PRs
#11520
What does this implement/fix? Explain your changes.
Edit: A change to the defaults of a public method needs to go through the deprecation cycle. This PR has been revised to update the docstring and introduce a
FutureWarningtopower_transform().Looks like the function version of
PowerTransformerwasn't updated when Yeo-Johnson was added. Just matching the defaults and updating the docstring with this PR. Congrats on the 0.20 release!!Any other comments?