Ranking Is Not the Problem: Leakage-Free Benchmarking of Sentiment Classifiers on Twitter and IMDB

Rakibul Hasan Sium
Nanjing University of Information Science and Technology
sium@nuist.edu.cn

In one paragraph

Comparisons of sentiment classifiers are often decided by evaluation practice rather than by the models: vectorizers fitted on test data, a fixed decision threshold, or accuracy reported on a corpus where one class holds 93 percent of the documents. This work evaluates eight model families (naive Bayes, logistic regression, a calibrated linear SVM, random forest, XGBoost, a soft-voting ensemble, a CNN and a BiLSTM) across five representations (counts, TF-IDF, Word2Vec, Doc2Vec, token sequences) on three corpora (racist and sexist tweet detection, COVID-19 vaccine tweets, IMDB reviews) under one leakage-free protocol: representations fitted per cross-validation fold, decision thresholds and model selection from out-of-fold predictions, one scoring pass on the held-out split. The benchmark ships as a maintained system with experiment tracking, model cards, a prediction service over PostgreSQL, drift monitoring, CI, Docker and cloud infrastructure definitions. Every number on this page is regenerated from saved predictions.

Key findings

0.939 to 0.952

ROC-AUC of every model family on the hate-speech task. They rank tweets almost equally well.

0.608 to 0.684

Their F1 on the positive class. The spread is calibration and threshold transfer, not ranking ability.

+0.09 / +0.14

F1 gained by tuning the threshold on out-of-fold predictions instead of using 0.5 (classical models / networks).

56 cells

Corpus x representation x model, each under the same protocol, each tracked, each regenerable.

Selected model per corpus

Selection uses cross-validated F1 on the training split only; the test split is scored once. F1 is on the positive class for binary tasks and macro-averaged for the three-class task.

CorpusTrain / testSelected modelTest F1AccuracyROC-AUCBest classical model
Hate speech (Twitter)25,569 / 6,393CNN on sequence0.6080.9550.948Random forest on TF-IDF: 0.680
Vaccine sentiment (Twitter)8,282 / 2,071CNN on sequence0.8120.8590.948Logistic regression on counts: 0.775
IMDB reviews25,000 / 25,000Linear SVM (calibrated) on TF-IDF0.8840.8820.953Linear SVM (calibrated) on TF-IDF: 0.884

Every model family at its best representation (test F1)

ModelHate speechVaccineIMDB
Naive Bayes0.658 (TF-IDF)0.698 (counts)0.851 (TF-IDF)
Logistic regression0.654 (TF-IDF)0.775 (counts)0.886 (TF-IDF)
Linear SVM (calibrated)0.654 (TF-IDF)0.744 (counts)0.884 (TF-IDF)
Random forest0.680 (TF-IDF)0.709 (counts)0.859 (TF-IDF)
XGBoost0.684 (Word2Vec)0.757 (counts)0.865 (TF-IDF)
Soft-voting ensemble0.662 (TF-IDF)0.757 (TF-IDF)0.888 (TF-IDF)
CNN0.608 (sequence)0.812 (sequence)0.875 (sequence)
BiLSTM0.658 (sequence)0.779 (sequence)0.876 (sequence)

Figures

Thirty figures in total (ROC, precision-recall, reliability, threshold sweeps, cross-validation stability, heatmaps, efficiency, per-class scores and confusion matrices for every corpus) are in the thesis and in the repository.

Method in brief

System architecture
  1. One YAML file defines the experiment: corpora, cleaning, representations, models, grid, folds, seed. It is logged with every run.
  2. The training split is cleaned once; each representation is fitted per cross-validation fold and shared by every model on that fold, so models are compared on identical inputs and nothing is fitted on validation or test documents.
  3. Out-of-fold probabilities determine the decision threshold (binary tasks) and the selected model. The test split is scored once, at that threshold.
  4. Each cell is an MLflow run; the selected pipeline is exported with a model card and a monitoring baseline.
  5. A Flask service predicts from the exported pipelines and logs to PostgreSQL; a drift monitor compares recent traffic with the baseline (population stability index, out-of-vocabulary rate) and stores its reports.

Documents

Citation

Sium, R. H. (2026). Ranking is not the problem: Leakage-free benchmarking of sentiment classifiers on Twitter and IMDB [Project page and source code]. Nanjing University of Information Science and Technology. https://rhs2.github.io/sentiment-ml-benchmark/

@misc{sium2026ranking,
  author       = {Sium, Rakibul Hasan},
  title        = {Ranking Is Not the Problem: Leakage-Free Benchmarking of
                  Sentiment Classifiers on Twitter and IMDB},
  year         = {2026},
  howpublished = {Project page and source code},
  url          = {https://rhs2.github.io/sentiment-ml-benchmark/},
  note         = {Extends the author's BSc thesis, Nanjing University of
                  Information Science and Technology, 2022}
}

Prior work: Sium, R. H. (2022). Research on machine learning classification algorithms: A comprehensive theoretical survey of sentiment analysis and deep learning approaches [Bachelor's thesis, Nanjing University of Information Science and Technology].