Abstract
Despite the loss of semantic information, bag-of-ngram based methods still achieve state-of-the-art results for tasks such as sentiment classification of long movie reviews. Many document embeddings methods have been proposed to capture semantics, but they still can't outperform bag-of-ngram based methods on this task. In this paper, we modify the architecture of the recently proposed Paragraph Vector, allowing it to learn document vectors by predicting not only words, but n-gram features as well. Our model is able to capture both semantics and word order in documents while keeping the expressive power of learned vectors. Experimental results on IMDB movie review dataset shows that our model outperforms previous deep learning models and bag-of-ngram based models due to the above advantages. More robust results are also obtained when our model is combined with other models.
Introduction
In sentiment analysis, particularly for long documents like movie reviews, two main approaches usually compete. Bag-of-n-grams (BoN) models are excellent at capturing local word order (e.g., distinguishing "not good" from "good") but treat every word as a unique, unrelated symbol, losing semantic similarity. Conversely, Document Embeddings, such as Paragraph Vector (PV), learn dense vectors that capture semantics but often struggle to outperform BoN on long documents.
The authors identify a specific weakness in the popular PV model: in its "Distributed Memory" version, the document vector only assists word vectors in predicting a target. If word vectors are sufficient, the document vector fails to learn a rich representation. The "Distributed Bag of Words" version, on the other hand, ignores word order entirely. This paper introduces DV-ngram, a model designed to capture both semantics and word order without losing expressive power.
Methods
The core of the proposed DV-ngram (Document Vector by predicting n-grams) is a modification of the Paragraph Vector architecture. Instead of using a window of context words to predict a target, the model learns a document vector by forcing it to predict all the words and n-grams (bigrams, trigrams) that appear within that specific document.
The model uses a simple neural network where the input is the document vector ($x$). The output layer is expanded to include the entire vocabulary ($V$) plus the set of all n-gram features ($F$). Because the document vector is the sole input used to predict its constituent n-grams, it is forced to "absorb" the structural and content information of the text. To handle the massive output layer, the authors utilize Negative Sampling, making training efficient by updating only a small subset of features per step. Once learned, these unsupervised vectors are fed into a Logistic Regression classifier for sentiment prediction.
Experimental Setup
The model was evaluated on the IMDB sentiment classification dataset, a standard benchmark consisting of 100,000 movie reviews (25,000 labeled positive, 25,000 labeled negative, and 50,000 unlabeled). With an average document length of 231 words, this dataset provides a rigorous test for long-form sentiment analysis.
Results
The results demonstrate that capturing higher-order word sequences is vital for sentiment. The trigram version (DV-tri) consistently outperformed the original Paragraph Vector (PV) by 3.41% in accuracy.
As shown in the comparison, DV-tri achieved 92.14% accuracy on the IMDB dataset, outperforming previous state-of-the-art single models like NBSVM (91.87%). Furthermore, the use of unlabeled data proved to be a significant advantage; the 50,000 unlabeled reviews helped refine the embeddings before classification. When combined with other techniques (NBSVM and RNN-LM), the ensemble achieved a new state-of-the-art result of 93.05%.
Conclusion
DV-ngram successfully bridges the gap between semantic-rich distributed representations and word-order-sensitive bag-of-n-gram models. While the current approach uses simple n-gram selection, future work could explore more sophisticated word sequence selection methods. Additionally, while negative sampling mitigates computational costs, the model remains more intensive than simple word-based approaches. Future research will determine how this architecture generalizes to shorter texts or different domains where n-gram patterns may vary.
Summary updated