Skip to main content
QUICK REVIEW

[Paper Review] Improving a tf-idf weighted document vector embedding

Craig W. Schmidt|arXiv (Cornell University)|Feb 26, 2019
Topic ModelingComputer Science8 references12 citations
TL;DR

This paper proposes improved document embedding methods by optimizing a weighted sum of word vectors using term frequency differences relative to the corpus, with inverse document frequency (idf) weighting and principal component analysis (PCA) post-processing. The idf-delta-pca method outperforms doc2vec on TripAdvisor reviews and is competitive on CQADupStack, especially for longer documents, with PCA consistently improving performance.

ABSTRACT

We examine a number of methods to compute a dense vector embedding for a document in a corpus, given a set of word vectors such as those from word2vec or GloVe. We describe two methods that can improve upon a simple weighted sum, that are optimal in the sense that they maximizes a particular weighted cosine similarity measure. We consider several weighting functions, including inverse document frequency (idf), smooth inverse frequency (SIF), and the sub-sampling function used in word2vec. We find that idf works best for our applications. We also use common component removal proposed by Arora et al. as a post-process and find it is helpful in most cases. We compare these embeddings variations to the doc2vec embedding on a new evaluation task using TripAdvisor reviews, and also on the CQADupStack benchmark from the literature.

Motivation & Objective

  • To develop a more effective document embedding method than simple weighted sums of word vectors.
  • To investigate whether optimizing document vectors via term frequency deviation from corpus frequency improves semantic similarity.
  • To evaluate the impact of different weighting functions—idf, SIF, and sub-sampling—on document embedding quality.
  • To assess the effectiveness of common component removal (PCA post-processing) in improving document vector representations.
  • To compare the proposed methods against doc2vec on real-world review data and standard benchmarks.

Proposed method

  • The method computes a document vector as a weighted sum of word vectors, where weights are derived from the difference between document-term frequency (tf_i) and corpus-term frequency (tf_ic), i.e., δ_i = tf_i - tf_ic.
  • The optimal document vector u* is derived as the normalized vector of the weighted sum of δ_i * v_i, using the Cauchy-Schwarz inequality to ensure unit norm and maximal cosine similarity.
  • Three weighting functions are evaluated: inverse document frequency (idf), smooth inverse frequency (SIF), and word2vec sub-sampling; idf is found to perform best.
  • A PCA post-processing step is applied to remove the first principal component from document vectors, following Arora et al.'s common component removal technique.
  • The method is implemented in two forms: 'center' (using a fixed corpus-weighted average) and 'delta' (using document-specific deviations), both with and without PCA.
  • The approach is evaluated on a new TripAdvisor review benchmark and the CQADupStack dataset using ROC AUC for duplicate question detection.

Experimental results

Research questions

  • RQ1Does using the difference between document-term frequency and corpus-term frequency as a weight improve document vector quality?
  • RQ2Which weighting function—idf, SIF, or sub-sampling—yields the best performance for document embeddings?
  • RQ3How effective is PCA-based common component removal in enhancing document vector similarity?
  • RQ4How does document length affect the performance of different embedding strategies?
  • RQ5Can the proposed method outperform doc2vec on real-world review data and standard benchmarks?

Key findings

  • The idf-delta-pca method achieved the highest performance on the TripAdvisor review benchmark for documents with 300+ words, outperforming doc2vec and other variants.
  • For shorter documents (1–9 reviews per location), the idf-sum-pca method was best, with performance peaking at 1–2 reviews per document.
  • The idf-center-pca method was optimal for short documents below 450 words when PCA was used, while idf-delta-pca was best for longer documents.
  • The PCA post-processing step consistently improved performance for the sum and delta methods but had mixed results for the center method.
  • The unit-sum baseline (unweighted sum) significantly underperformed all other methods, confirming the necessity of proper weighting.
  • On the CQADupStack benchmark, doc2vec was best in 4 forums, idf-delta-pca in 5, and idf-center-pca in 2, showing strong competitiveness across diverse forums.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.