-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
ENH Checks n_features_in_ in preprocessing module #18577
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
glemaitre
merged 13 commits into
scikit-learn:master
from
thomasjpfan:n_features_in_preprocessing
Oct 21, 2020
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4397033
ENH Checks n_features_in_ in preprocessing module
thomasjpfan 1c6fe9d
REV Lower diffs
thomasjpfan 3dddafc
DOC Uses fit_transform
thomasjpfan 78965e2
Merge remote-tracking branch 'upstream/master' into n_features_in_pre…
thomasjpfan c70679e
ENH Do not check when n_features_in_ is not defined
thomasjpfan be4bb32
REV Reduces diff
thomasjpfan 1e5b1de
Merge branch 'master' into n_features_in_preprocessing
ogrisel a2d8a16
DOC Whats new tweaks (#18604)
jnothman 43df0de
Remove unrelated change to whats_new/0.24.rst
ogrisel 4b97541
Merge branch 'master' of github.com:scikit-learn/scikit-learn into n_…
ogrisel dcb160d
Merge branch 'master' of github.com:scikit-learn/scikit-learn into n_…
ogrisel 442bebf
CLN Address comments
thomasjpfan f2a88f5
DOC add information about in_fit in QuantileTransformer._check_input
glemaitre 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 |
---|---|---|
|
@@ -1310,12 +1310,8 @@ def test_quantile_transform_check_error(): | |
|
||
X_bad_feat = np.transpose([[0, 25, 50, 0, 0, 0, 75, 0, 0, 100], | ||
[0, 0, 2.6, 4.1, 0, 0, 2.3, 0, 9.5, 0.1]]) | ||
err_msg = ("X does not have the same number of features as the previously" | ||
" fitted " "data. Got 2 instead of 3.") | ||
with pytest.raises(ValueError, match=err_msg): | ||
transformer.transform(X_bad_feat) | ||
err_msg = ("X does not have the same number of features " | ||
"as the previously fitted data. Got 2 instead of 3.") | ||
err_msg = ("X has 2 features, but QuantileTransformer is expecting " | ||
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. Should we remove this check since we have a common check? |
||
"3 features as input.") | ||
with pytest.raises(ValueError, match=err_msg): | ||
transformer.inverse_transform(X_bad_feat) | ||
|
||
|
@@ -2434,7 +2430,8 @@ def test_power_transformer_shape_exception(method): | |
|
||
# Exceptions should be raised for arrays with different num_columns | ||
# than during fitting | ||
wrong_shape_message = 'Input data has a different number of features' | ||
wrong_shape_message = (r"X has \d+ features, but PowerTransformer is " | ||
r"expecting \d+ features") | ||
|
||
with pytest.raises(ValueError, match=wrong_shape_message): | ||
pt.transform(X[:, 0:1]) | ||
|
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
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.
Good catch!