Skip to content

Instantly share code, notes, and snippets.

@ashokc
Created December 23, 2019 02:04
Show Gist options
  • Save ashokc/0cb345673878277e6ffa83894485b2ba to your computer and use it in GitHub Desktop.
Save ashokc/0cb345673878277e6ffa83894485b2ba to your computer and use it in GitHub Desktop.
def runModel (train_docs, train_labels, test_docs, test_labels, vectorizer):
model = LogisticRegression(tol=1.0e-6,random_state=0,max_iter=20000, class_weight='balanced')
train_X = vectorizer.transform(train_docs)
test_X = vectorizer.transform(test_docs)
model.fit(train_X, train_labels)
predicted_labels = model.predict (test_X)
scores = model.predict_proba(test_X)
return findMetrics (scores, predicted_labels, test_labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment