FIX Truncated SVD should raise a NotFittedError if not fitted#16821
Merged
rth merged 1 commit intoscikit-learn:masterfrom Apr 2, 2020
Merged
FIX Truncated SVD should raise a NotFittedError if not fitted#16821rth merged 1 commit intoscikit-learn:masterfrom
rth merged 1 commit intoscikit-learn:masterfrom
Conversation
rth
approved these changes
Apr 2, 2020
Member
rth
left a comment
There was a problem hiding this comment.
Thanks @alexitkes , LTGM.
This is fine, there is no need for a test, and the 1 CI job failing does so for an unrelated reason also on master.
Merging.
thomasjpfan
reviewed
Apr 2, 2020
| Reduced version of X. This will always be a dense array. | ||
| """ | ||
| X = check_array(X, accept_sparse='csr') | ||
| check_is_fitted(self) |
Member
There was a problem hiding this comment.
Should we check this before the check_array?
Member
There was a problem hiding this comment.
Maybe, but I don't think it matter that much. check_is_fitted is indeed a bit faster, so if it's not fitted it'll fail faster. But check_array can also fail for incorrect input, in which case there is no need to check_is_fitted, and it doesn't take ages either.
So overall +1 but I'm not sure it's worth making another PR for it.
gio8tisu
pushed a commit
to gio8tisu/scikit-learn
that referenced
this pull request
May 15, 2020
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #16806
Call
check_is_fittedwithin TruncatedSVD to raise a clear exception if not fitted.