Skip to content

Instantly share code, notes, and snippets.

@vikeshsingh37
Created April 5, 2020 14:39
Show Gist options
  • Save vikeshsingh37/f7415d77e57c510434bce395bf3bfa89 to your computer and use it in GitHub Desktop.
Save vikeshsingh37/f7415d77e57c510434bce395bf3bfa89 to your computer and use it in GitHub Desktop.
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegression
train_text = df_train_augmented.text.tolist()
X_train = CountVectorizer(ngram_range=(1, 2)).fit_transform(train_text)
clf = LogisticRegression(solver="lbfgs")
clf.fit(X=X_train, y=df_train_augmented.label.values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment