Skip to content

Instantly share code, notes, and snippets.

@seanbenhur
Created May 15, 2021 12:15
Show Gist options
  • Save seanbenhur/e652a8f7244a73ddf4aa3afd708273e8 to your computer and use it in GitHub Desktop.
Save seanbenhur/e652a8f7244a73ddf4aa3afd708273e8 to your computer and use it in GitHub Desktop.
model = make_pipeline_imb(TfidfVectorizer(), RandomUnderSampler(), MultinomialNB())
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print(classification_report(y_test,y_pred))
# precision recall f1-score support
#
# 0 0.73 0.87 0.79 319
# 1 0.97 0.86 0.91 389
# 2 0.95 0.90 0.93 394
# 3 0.76 0.76 0.76 251
# accuracy 0.86 1353
# macro avg 0.85 0.85 0.85 1353
#weighted avg 0.87 0.86 0.86 1353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment