The fastest useful text baseline there is
Trains in seconds on data that would take a transformer hours. Worth running before you provision anything.
from sklearn.naive_bayes import MultinomialNB, ComplementNB
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import make_pipeline
from sklearn.metrics import classification_report
# ComplementNB is designed for imbalanced text and usually beats
# MultinomialNB there - an easy swap most people never try.
for NB in (MultinomialNB, ComplementNB):
pipe = make_pipeline(TfidfVectorizer(ngram_range=(1, 2), min_df=2), NB())
pipe.fit(X_train, y_train)
print(NB.__name__)
print(classification_report(y_test, pipe.predict(X_test), digits=3))
# Set your expectations from this number. If a fine-tuned transformer
# is not clearly beating it, the transformer is not earning its
# serving cost.