Hostname: page-component-74656f9884-rdgjk Total loading time: 0 Render date: 2026-11-07T23:19:15.813Z Has data issue: false hasContentIssue false

Text Preprocessing For Unsupervised Learning: Why It Matters, When It Misleads, And What To Do About It

Published online by Cambridge University Press:  19 March 2018

Matthew J. Denny*
Affiliation:
203 Pond Lab, Pennsylvania State University, University Park, PA 16802, USA. Email: mdenny@psu.edu
Arthur Spirling
Affiliation:
Office 405, 19 West 4th St., New York University, New York, NY 10012, USA. Email: arthur.spirling@nyu.edu
*
Rights & Permissions [Opens in a new window]

Abstract

Despite the popularity of unsupervised techniques for political science text-as-data research, the importance and implications of preprocessing decisions in this domain have received scant systematic attention. Yet, as we show, such decisions have profound effects on the results of real models for real data. We argue that substantive theory is typically too vague to be of use for feature selection, and that the supervised literature is not necessarily a helpful source of advice. To aid researchers working in unsupervised settings, we introduce a statistical procedure and software that examines the sensitivity of findings under alternate preprocessing regimes. This approach complements a researcher’s substantive understanding of a problem by providing a characterization of the variability changes in preprocessing choices may induce when analyzing a particular dataset. In making scholars aware of the degree to which their results are likely to be sensitive to their preprocessing decisions, it aids replication efforts.

Information

Type
Articles
Copyright
Copyright © The Author(s) 2018. Published by Cambridge University Press on behalf of the Society for Political Methodology. 
Figure 0

Table 1. Preprocessing steps taken/suggested in recent notable papers that deal with unsupervised learning methods. The cite total is taken from Google Scholar at the time of writing. In the case of Slapin and Proksch (2008), we consulted their Wordfish manual (version 1.3). In the case of Roberts et al. (2014), the authors suggest further steps might be appropriate for a given application.

Figure 1

Table 2. Corpus descriptive statistics for the five corpora used in our analyses. The number of word types, total tokens, and tokens per document were calculated using the no preprocessing specification.

Figure 2

Figure 1. Wordfish results for the 128 different preprocessing possibilities. Each row of the plot represents a different specification. A white bar implies that the manifesto for that year is in the correct place as regards our priors. A black bar implies it was misplaced.

Figure 3

Table 3. Some example specifications which differ in terms of the manifestos they place on the (far) left and (far) right under the Wordfish model.

Figure 4

Figure 2. Plot depicting the optimal number of topics (as selected via perplexity) for each of 64 preprocessing specifications not including trigrams. On the x-axis is the number of preprocessing steps, and the y-axis is the number of topics. Each point is labeled according to its specification.

Figure 5

Figure 3. Plots depicting the percentage of topic top-20 terms which contain the stem of each of five keywords, for each of 64 preprocessing steps (thus excluding those which include trigrams). The number of topics for specifications fit to each of the 64 DFMs were determined through tenfold cross-validation, minimizing the model perplexity.

Figure 6

Figure 4. Rank test average difference results for $k=100$ for the Indian Treaties corpus ($n=596$). The maximum possible rank difference for a given document pair, for this corpus, is 177,309.

Figure 7

Figure 5. Regression results depicting the effects of each of the seven preprocessing steps on the preText score for that preprocessing combination.

Figure 8

Figure 6. Wordfish scores for eight UK party manifestos generated using a theoretically selected preprocessing specification (P-N-L-S-W-I), and averaged across the eight possible DTMs generated using stemming (or not), stopping (or not) and removing punctuation (or not). These choices correspond to he choices with parameter estimates that were significantly different from zero in Figure 5.

Supplementary material: File

Denny and Spirling supplementary material 1

Online Appendix

Download Denny and Spirling supplementary material 1(File)
File 185 KB