Scaling Semi-supervised Naive Bayes with Feature Marginals

Michael Lucas, Doug DowneyACL 2013

Abstract: Semi-supervised learning (SSL) methods augment standard machine learning (ML) techniques to leverage unlabeled data. SSL techniques are often effective in text classification, where labeled data is scarce but large unlabeled corpora are readily available. However, existing SSL techniques typically require multiple passes over the entirety of the unlabeled data, meaning the techniques are not applicable to large corpora being produced today. In this paper, we show that improving marginal word frequency estimates using unlabeled data can enable semi-supervised text classification that scales to massive unlabeled data sets. We present a novel learning algorithm, which optimizes a Naive Bayes model to accord with statistics calculated from the unlabeled corpus. In experiments with text topic classification and sentiment analysis, we show that our method is both more scalable and more accurate than SSL techniques from previous work.

1. Introduction

Traditional semi-supervised learning (SSL) algorithms, such as Expectation-Maximization (EM) or Label Propagation, are often computationally prohibitive for modern web-scale text corpora. These methods typically require multiple iterative passes over the entire unlabeled dataset to learn a single target concept. In an era where new classification tasks emerge constantly, running such iterative processes over millions of documents is practically intractable.

This paper introduces Multinomial Naive Bayes with Feature Marginals (MNB-FM), a highly scalable SSL approach designed to bridge this gap. By extracting useful information from massive unlabeled datasets in a single pass, MNB-FM makes SSL scalable to modern data sizes without sacrificing classification accuracy.

2. Methodology

The core innovation of MNB-FM is the decoupling of unlabeled data processing from the task-specific learning phase. Instead of using unlabeled documents directly during the training loop, MNB-FM pre-computes a simple global statistic: the marginal probability of each word, $P(w)$, across the entire unlabeled corpus. This computation requires only a single pass and can be performed before the specific classification task is defined.

During the training phase, a standard Multinomial Naive Bayes (MNB) model estimates class-conditional probabilities—$P(w|+)$ and $P(w|-)$—using the available sparse labeled data. To mitigate the noise inherent in small labeled samples, MNB-FM enforces a constraint based on the law of total probability:

$$P(w) = P(w|+)P(+) + P(w|-)P(-)$$

By treating the global word frequency $P(w)$ as a known, robust constraint, the algorithm re-estimates the class-conditional probabilities using Constrained Maximum Likelihood Estimation. This approach allows the model to adjust its assumptions for words that may not even appear in the labeled training set, providing a more intelligent alternative to standard "add-1" smoothing.

3. Experimental Setup

The proposed method was evaluated against several baselines, including standard MNB, Naive Bayes with EM (NB+EM), Logistic Regression, Label Propagation (LP), and Semi-supervised Frequency Estimate (SFE). Testing was conducted across three diverse datasets:

  • Reuters RCV1: A large topic classification corpus (~800,000 documents).
  • Reuters ApteMod: A smaller dataset (~10,000 documents) used to accommodate baselines like Label Propagation that cannot scale to RCV1.
  • Amazon Sentiment Classification: Product reviews across 10 categories for positive/negative sentiment detection.

4. Key Results and Discussion

MNB-FM consistently outperformed standard MNB and other SSL baselines in F1 score across almost all datasets, particularly when labeled data was extremely limited (10 or 100 documents).

Summary of F1 scores across datasets and labeled data sizes. MNB-FM shows superior performance in most sparse-data scenarios.

As shown in Figure 6, MNB-FM achieves the highest F1 scores in nearly every category for the 10 and 100 labeled instance cases. For example, on the RCV1 dataset with just 10 labeled examples, MNB-FM achieved an average F1 of 0.494, significantly higher than the 0.387 achieved by standard MNB. A detailed breakdown of the RCV1 performance with 10 instances is provided in Figure 5.

Detailed F1 scores for RCV1 classes with only 10 labeled training instances, highlighting the significant gains of MNB-FM over standard MNB and iterative EM.

Beyond accuracy, MNB-FM demonstrated drastic improvements in computational efficiency. On a dataset of 100,000 unlabeled examples, MNB-FM completed training in 5.5 seconds, compared to 16.9 seconds for NB+EM. Label Propagation was unable to run on the larger RCV1 corpus due to its high computational demands.

While MNB-FM leads in classification (F1 score), the authors noted that Logistic Regression performed better on ranking tasks (R-precision) for highly skewed datasets. However, Logistic Regression's classification performance suffered due to poor decision thresholding when trained on very small datasets.

5. Conclusion

MNB-FM provides a scalable and accurate framework for semi-supervised text classification. By leveraging pre-computed word marginals, it avoids the iterative overhead of traditional SSL while providing robust probability estimates even for unseen words. Future work will explore the use of richer statistics, such as n-grams or co-occurrence data, and the adaptation of this technique for continuous-valued features.

Summary updated

BibTeX
@inproceedings{lucas2013scaling,
  author = {Michael Lucas and Doug Downey},
  title = {{Scaling Semi-supervised Naive Bayes with Feature Marginals}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2013},
  url = {https://openreview.net/forum?id=Hk4cLnl_-r},
}

Loading related content...

Figure