-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Fixes to YeoJohnson transform #12522
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
853d2b3
YeoJohnson transform fixes
NicolasHug a39ccc9
Fixed doctest
NicolasHug 1c63516
Added whatnew entry
NicolasHug 030c6d1
addressed comments
NicolasHug 5b1d2e6
Merge branch 'master' into yeo_fix
NicolasHug fad83fe
fixed whatnew ?
NicolasHug 54f77f7
Merge branch 'yeo_fix' of github.com:NicolasHug/scikit-learn into yeo…
NicolasHug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2345,6 +2345,16 @@ def test_optimization_power_transformer(method, lmbda): | |
assert_almost_equal(1, X_inv_trans.std(), decimal=1) | ||
|
||
|
||
def test_yeo_johnson_darwin_example(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we should try to insist on such tests where possible, but we often forget |
||
# test from original paper "A new family of power transformations to | ||
# improve normality or symmetry" by Yeo and Johnson. | ||
X = [6.1, -8.4, 1.0, 2.0, 0.7, 2.9, 3.5, 5.1, 1.8, 3.6, 7.0, 3.0, 9.3, | ||
7.5, -6.0] | ||
X = np.array(X).reshape(-1, 1) | ||
lmbda = PowerTransformer(method='yeo-johnson').fit(X).lambdas_ | ||
assert np.allclose(lmbda, 1.305, atol=1e-3) | ||
|
||
|
||
@pytest.mark.parametrize('method', ['box-cox', 'yeo-johnson']) | ||
def test_power_transformer_nans(method): | ||
# Make sure lambda estimation is not influenced by NaN values | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ok so the
abs
here is the bugfix, right, and the rest is minor stability changes?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.
yes