-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/26308 yeo johnson2 #3
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
base: main
Are you sure you want to change the base?
Conversation
❌ Linting issuesThis PR is introducing linting issues. Here's a summary of the issues. Note that you can avoid having linting issues by enabling You can see the details of the linting issues under the
|
@@ -84,6 +86,20 @@ def _object_dtype_isnan(X): | |||
return X != X | |||
|
|||
|
|||
#TODO: remove this when minimum version of scipy >= 1.9.0 | |||
def _yeojohnson_lambda( _neg_log_likelihood, x): | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add docstring here
#TODO: remove this when minimum version of scipy >= 1.9.0 | ||
def _yeojohnson_lambda( _neg_log_likelihood, x): | ||
|
||
x = x[~np.isnan(x)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this line move or not ? (check wrt scipy implementation to get the answer)
@@ -3525,9 +3526,10 @@ def _neg_log_likelihood(lmbda): | |||
|
|||
# the computation of lambda is influenced by NaNs so we need to | |||
# get rid of them | |||
x = x[~np.isnan(x)] | |||
#x = x[~np.isnan(x)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather leave this here and remove it from the other side
#x = x[~np.isnan(x)] | |
x = x[~np.isnan(x)] |
# choosing bracket -2, 2 like for boxcox | ||
return optimize.brent(_neg_log_likelihood, brack=(-2, 2)) | ||
#return optimize.brent(_neg_log_likelihood, brack=(-2, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment and the above comment as they should be in the new function now
@@ -2619,3 +2619,9 @@ def test_power_transformer_constant_feature(standardize): | |||
assert_allclose(Xt_, np.zeros_like(X)) | |||
else: | |||
assert_allclose(Xt_, X) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a test for the warning : scikit-learn#23319 (comment)
Documentation from pytest : https://stackoverflow.com/questions/45671803/how-to-use-pytest-to-assert-no-warning-is-raised
Reference Issues/PRs
This PR is finalizing scikit-learn#27818 to close scikit-learn#26308 and also fix the warning issue reported in scikit-learn#23319 (comment)
What does this implement/fix? Explain your changes.
Use scipy.stats.yeojohnson instead of our own implementation as @lorentzenchr suggested.
Any other comments?