Skip to content

Instantly share code, notes, and snippets.

@sid321axn
Created August 4, 2020 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sid321axn/1929cc81b90f0e047f75e6f83e73591a to your computer and use it in GitHub Desktop.
Save sid321axn/1929cc81b90f0e047f75e6f83e73591a to your computer and use it in GitHub Desktop.
from sklearn.feature_extraction.text import TfidfVectorizer
tfidf_vectorizer = TfidfVectorizer(stop_words='english', max_df=0.8, ngram_range=(1,2))
tfidf_train_2 = tfidf_vectorizer.fit_transform(X_train)
tfidf_test_2 = tfidf_vectorizer.transform(X_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment