An alternative text representation to TF-IDF and Bag-of-Words

Zhixiang Eddie Xu, Minmin Chen, Kilian Q. Weinberger, Fei ShaarXiv 2013

TL;DR

The paper introduces Dense Cohort of Terms (dCoT), an unsupervised feature learning algorithm that transforms sparse, high-dimensional "Bag-of-Words" vectors into low-dimensional dense representations. By using a "marginalized" denoising approach, dCoT learns to reconstruct frequent words from rare synonyms in closed-form, making it orders of magnitude faster than LDA or LSI while significantly improving classification accuracy—especially when labeled data is scarce.

What Problem Does This Paper Address?

In natural language processing, the classic sparse Bag-of-Words (sBoW) and TF-IDF representations are workhorses, but they have a glaring weakness: they are "literal." If one document uses the word "splendid" and another uses "terrific," a standard sBoW model sees them as entirely unrelated. This is the problem of synonymy.

Furthermore, text data is often "overly sparse." In short documents like emails or abstracts, most words in the dictionary never appear. This leads to overfitting because a classifier can't learn that "splendid" and "terrific" both imply a positive sentiment unless it sees a massive amount of labeled data containing both. Existing solutions like Latent Semantic Indexing (LSI) or Latent Dirichlet Allocation (LDA) attempt to solve this but are often computationally expensive or struggle to explicitly map rare terms to their common counterparts.

Methods

The authors propose dCoT, which is inspired by Denoising Autoencoders (SDA) but optimized for the unique constraints of text.

The dCoT architecture: mapping sparse BoW inputs to dense prototype terms.
  1. Prototype Selection: The algorithm identifies a set of "prototype" features—typically the $r$ most frequent words in the corpus (e.g., "good").
  2. Artificial Corruption: To learn the relationship between words, the model "corrupts" the input by randomly removing words (setting their counts to zero).
  3. Reconstruction: The goal is to learn a mapping ($W$) that can reconstruct the original frequent prototype words from the remaining, potentially rarer, words in the corrupted document.
  4. The Marginalization Trick: Instead of generating thousands of corrupted versions of the data and training iteratively (which is slow), the authors calculate the expected reconstruction error over all possible corruptions. This allows them to solve for the optimal mapping $W$ in a single closed-form linear step.
  5. Recursive Stacking: The output of one dCoT layer can be fed into another. This "deep" approach helps capture higher-order correlations. For example, if "delicious" and "tasty" never appear together, the first layer might map "delicious" to "food," and the second layer might map "food" to "tasty."

Datasets

The authors evaluated dCoT on two standard benchmarks:

  • Reuters-21578: A classic collection of news wire articles categorized by topic (65 categories used).
  • Dmoz: A large, hierarchical dataset of webpage links, where the authors focused on the 16 top-level categories.

Key Insights and Ideas

  • Rare-to-Common Mapping: dCoT effectively acts as a "translator" that maps rare, specific terms (like "reagan" or "bush") to more general prototype terms (like "president").
  • Speed via Math: By marginalizing the noise, the authors bypass the need for backpropagation or gradient descent. Training becomes a matter of matrix multiplication and inversion, which is incredibly efficient.
  • The Power of Noise: Surprisingly, the model performs best at high noise levels (removing 50-90% of words). This forces the model to learn very robust correlations rather than just memorizing co-occurrences.
  • Non-linearity Matters: While the core solver is linear, applying a tanh squashing function to the output is crucial for creating "bag-of-word-like" features that are either clearly present or absent.

Key Results

Performance comparison of dCoT against standard baselines on Reuters and Dmoz datasets.
  • Accuracy: dCoT consistently outperformed TF-IDF, LSI, and LDA. The performance gain was most dramatic in semi-supervised settings (where you have a lot of text but very few labels). On the Dmoz dataset with only 500 labeled samples, dCoT achieved ~48% accuracy compared to ~32% for TF-IDF.
  • Computational Efficiency: The training time difference is staggering. On the Reuters dataset, LDA took ~3 hours and 10 minutes, while dCoT took only 2 minutes.
  • Qualitative Success: The model successfully grouped synonyms. For instance, specific terms like "nasdaq" correctly reconstructed "stock," "securities," and "trading."

Limitations and Future Work

  • Prototype Heuristic: The current model relies on a simple heuristic (most frequent words) to pick prototypes. More sophisticated selection methods might yield even better results.
  • Linear Foundation: Although stacked and squashed with tanh, the underlying mapping is linear. Very complex, non-linear linguistic structures might still be better captured by deep neural networks, albeit at a much higher computational cost.
  • Vocabulary Scaling: While fast, the matrix inversion step still scales with the size of the vocabulary, which could be a bottleneck for extremely large-scale web datasets without further optimization.

Summary updated

Abstract

In text mining, information retrieval, and machine learning, text documents are commonly represented through variants of sparse Bag of Words (sBoW) vectors (e.g. TF-IDF). Although simple and intuitive, sBoW style representations suffer from their inherent over-sparsity and fail to capture word-level synonymy and polysemy. Especially when labeled data is limited (e.g. in document classification), or the text documents are short (e.g. emails or abstracts), many features are rarely observed within the training corpus. This leads to overfitting and reduced generalization accuracy. In this paper we propose Dense Cohort of Terms (dCoT), an unsupervised algorithm to learn improved sBoW document features. dCoT explicitly models absent words by removing and reconstructing random sub-sets of words in the unlabeled corpus. With this approach, dCoT learns to reconstruct frequent words from co-occurring infrequent words and maps the high dimensional sparse sBoW vectors into a low-dimensional dense representation. We show that the feature removal can be marginalized out and that the reconstruction can be solved for in closed-form. We demonstrate empirically, on several benchmark datasets, that dCoT features significantly improve the classification accuracy across several document classification tasks.
BibTeX
@misc{xu2013alternative,
  author = {Zhixiang Eddie Xu and Minmin Chen and Kilian Q. Weinberger and Fei Sha},
  title = {{An alternative text representation to TF-IDF and Bag-of-Words}},
  year = {2013},
  eprint = {1301.6770},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1301.6770},
}
Figure