Last active
February 12, 2018 18:01
-
-
Save lievcin/1e6a28b1d77bb2a2ff2889bff3c27f6f to your computer and use it in GitHub Desktop.
This file contains 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
pipeline = Pipeline([ | |
# Use FeatureUnion to combine the features from subject and body | |
('union', FeatureUnion( | |
transformer_list=[ | |
('review_text', Pipeline([ | |
('selector', ItemSelector(key='review_text')), | |
('count_dict', CountVectorizer()), | |
])), | |
('rating', Pipeline([ | |
('selector', ItemSelector(key='rating')), | |
('rating_dict', CountVectorizer()) | |
])), | |
('verified_purchase', Pipeline([ | |
('selector', ItemSelector(key='verified_purchase')), | |
('verified_dict', CountVectorizer()) | |
])) | |
] | |
)), | |
('classifier', MultinomialNB(alpha=0.2)), | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment