Bayesian Performance Comparison of Text Classifiers

Dell Zhang, Jun Wang, Emine Yilmaz, Xiaoling Wang, Yuxin Zhou

Traditional evaluation of text classifiers has long relied on frequentist Null Hypothesis Significance Testing (NHST) and p-values to determine the superiority of one algorithm over another. However, this approach is fundamentally limited in its ability to provide nuanced insights. This paper proposes a robust Bayesian alternative that accounts for the inherent correlation between models tested on the same data and allows researchers to quantify "practical equivalence."

The Limitations of Frequentist Testing

In Information Retrieval (IR), the standard practice for comparing classifiers (e.g., Naive Bayes vs. SVM) involves NHST to identify "statistically significant" differences. This methodology faces several critical challenges:

  1. The Null Trap: NHST can reject a null hypothesis but cannot prove that two models are equivalent.
  2. Sample Size Sensitivity: Large datasets can make even trivial differences in metrics like F1 score appear "significant."
  3. Ignoring Correlation: Standard tests often assume independent errors, whereas classifiers typically fail on the same difficult documents.
  4. Metric Complexity: Applying frequentist tests to multivariate measures like F1 at the document level is mathematically cumbersome.

The Paired Bayesian Framework

To address these issues, the authors introduce a Paired Bayesian Model. Rather than analyzing aggregate scores, the framework models "atomic" results: the joint prediction outcomes for every document (e.g., both correct, both wrong, or only one correct).

The proposed paired Bayesian model for comparing two classifiers (A and B) and estimating the performance difference δ.

The model uses a Probabilistic Graphical Model (PGM) where document class labels follow a Bernoulli distribution and joint prediction outcomes follow a Multinomial distribution. By using conjugate priors (Beta and Dirichlet), the model incorporates prior beliefs about class proportions and accuracy.

Estimation and Decision Making

Because the mathematical derivation of F1 scores is complex, the framework employs Markov Chain Monte Carlo (MCMC) sampling to estimate the posterior distribution of $\delta$ (the performance difference).

MCMC trace plot showing the sampling of the performance difference δ over 50,000 iterations.

Instead of a binary p-value, the Bayesian approach utilizes two key metrics for decision-making:

  • Highest Density Interval (HDI): The range containing the 95% most credible values for the difference.
  • Region of Practical Equivalence (ROPE): A user-defined zone (e.g., +/- 0.05) representing a negligible difference. If the HDI falls entirely within the ROPE, the models are deemed "practically equivalent."

Experimental Results

Validation on synthetic data demonstrated that the paired model possesses significantly higher statistical power than unpaired versions, reaching certainty with smaller datasets. Real-world tests on the 20newsgroups dataset yielded several insights:

  • Multinomial vs. Bernoulli Naive Bayes: The Bayesian analysis confirmed the consistent superiority of the Multinomial version.
  • SVM-L1 vs. SVM-L2: ROPE analysis revealed these variants are practically equivalent across most categories, a nuance often missed by frequentist tests.
  • Naive Bayes vs. SVM: The competition was often "too close to call," suggesting that the perceived dominance of SVMs may be context-dependent.

Conclusion

The Bayesian framework offers a more informative and flexible alternative to traditional significance testing. While MCMC sampling is computationally more intensive than a t-test, the ability to conclude practical equivalence and visualize the full distribution of performance differences provides a much-needed depth to classifier evaluation in IR research.

Summary updated

BibTeX
@inproceedings{zhang2016bayesian,
  author = {Dell Zhang and Jun Wang and Emine Yilmaz and Xiaoling Wang and Yuxin Zhou},
  title = {{Bayesian Performance Comparison of Text Classifiers}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2016},
  doi = {10.1145/2911451.2911547},
}
Figure