MNT add n_features_in_ through the feature_extraction module#20180
Merged
ogrisel merged 4 commits intoscikit-learn:mainfrom Jun 1, 2021
Merged
MNT add n_features_in_ through the feature_extraction module#20180ogrisel merged 4 commits intoscikit-learn:mainfrom
ogrisel merged 4 commits intoscikit-learn:mainfrom
Conversation
jeremiedbb
commented
Jun 1, 2021
Comment on lines
-507
to
-514
| # test idf transform with incompatible n_features | ||
| X = [[1, 1, 5], | ||
| [1, 1, 0]] | ||
| t3.fit(X) | ||
| X_incompt = [[1, 3], | ||
| [1, 3]] | ||
| with pytest.raises(ValueError): | ||
| t3.transform(X_incompt) |
Member
Author
There was a problem hiding this comment.
This is now checked through the common tests
sklearn/utils/estimator_checks.py
Outdated
Comment on lines
+3124
to
+3125
| if ("2darray" not in tags["X_types"] and "sparse" not in tags["X_types"] or | ||
| tags["no_validation"]): |
Member
Author
There was a problem hiding this comment.
TfidfTransformer has tags["X_types"] = "sparse". I guess it does not hurt to allow it as well since sparse is 2d
47 tasks
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.
Part of #19333
the feature_extraction module contains CountVectorizer, DictVectorizer, FeatureHasher, HashingVectorizer, PatchExtractor, TfidfTransformer and TfidfVectorizer.
n_features_in_is only relevant for the TfidfTransformer.