-
-
Notifications
You must be signed in to change notification settings - Fork 26.7k
[MRG+2] TruncatedSVD: Calculate explained variance. #3067
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
[MRG+2] TruncatedSVD: Calculate explained variance. #3067
Conversation
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.
cosmetics: please remove multiple blank lines at the end of a file.
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.
👍
|
@ogrisel I need to run lint checks before this is ready. However can you please give me an idea if this looks okay? |
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.
You can compare the first 10:
assert_almost_equal(
svd_10.explained_variance_ratio_,
svd_20.explained_variance_ratio_[:10],
)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.
👍
|
Looks good to me. @larsmans now the fit will always do a transform (to be able to compute the explained variance) but I don't think it's a problem in practice. |
|
@ogrisel I forgot to update the docstrings. Should I do that as part of this PR? |
|
Sure yes. |
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.
X.getformat() not in ["csr", "csc"]
|
Changes Unknown when pulling 5c43aba on mdbecker:truncated_svd_calculate_explained_variance into * on scikit-learn:master*. |
|
@larsmans Fixed. Let me know if you find anything else. Thanks! |
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.
You don't need to put \ at the end of docstring lines. Please remove them.
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.
👍
|
For some reason, github does not show your repo as potential target for a pull request from mine... Here is an updated example to demonstrate the usage of Please include it in your PR. |
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.
I think you don't need normalized whitespace anymore here.
|
Coverage remained the same when pulling eee44de9c17bc5cc052c528b361c2995eba4c99d on mdbecker:truncated_svd_calculate_explained_variance into b70a481 on scikit-learn:master. |
|
This looks ready for merge to me. @larsmans any other comment? |
|
LGTM, feel free to merge! |
…ned_variance [MRG+2] TruncatedSVD: Calculate explained variance.
|
Great, thanks @mdbecker right on time for the official ending of the sprints! |
[MRG] Update authors based on #3067
Fixes #3047
We tested this similar to in #2663 and determined that it makes sense to calculate explained variance as part of the fit method but then we merged the _fit method with the fit_transform method to avoid doing some duplicate work. This change will cause a minor performance regression in the case where fit is called by itself separate from transform (i.e. when calling on different inputs) which I believe is not the normal use case for this estimator.