Source-linked AI summary

Scattertext: a Browser-Based Tool for Visualizing how Corpora Differ

Jason S. Kessler

arXiv:1703.00565v3cs.CLcs.IR

TL;DR

Visual comparisons of category-discriminating language can make term-frequency comparisons and labels difficult to read. Scattertext presents an interactive scatterplot with category-frequency coordinates and point placement designed for many legible labels. In the running example, 210 points were labeled without jitter, a 36% lift over the reported 154-point setting.

  • Problem

    Visualizations of category-discriminating language can make relative term-frequency comparisons and scatterplot labels difficult to read.

    Source: §1 · p. 1
  • Method

    Scattertext uses an interactive scatterplot whose term points show category frequencies and are placed to allow many unobstructed labels.

    Source: §1 · p. 1
  • Results

    210 points were labeled with no jitter, a 36% lift over 154 points with 10% jitter on each axis and no tie-breaking.

    Source: §4 · p. 5
  • Takeaways & Limitations

    Scattertext provides comprehensive visualizations of class-associated term frequencies, with rigorous human evaluation of their usefulness left for future work.

    Source: §6 · p. 6

    φD is useful when documents contain unique, characteristic, highly frequent terms, such as movie names that may receive higher scores than sentiment terms.

    Source: §4 · p. 4

Abstract

from arXiv · show

Scattertext is an open source tool for visualizing linguistic variation between document categories in a language-independent way. The tool presents a scatterplot, where each axis corresponds to the rank-frequency a term occurs in a category of documents. Through a tie-breaking strategy, the tool is able to display thousands of visible term-representing points and find space to legibly label hundreds of them. Scattertext also lends itself to a query-based visualization of how the use of terms with similar embeddings differs between document categories, as well as a visualization for comparing the importance scores of bag-of-words features to univariate metrics.

1 Introduction

Finding language that distinguishes document categories is a common NLP task, but existing visualizations can make frequency comparisons and labels difficult to read. Scattertext uses an interactive scatterplot and tie-aware point placement to show category frequencies, associations, and many legible labels.

1 Introduction

  • Finding category-discriminating words can support analyses of partisan framing, narrative archetypes, personality, and customer evaluations.Examples include political speeches, film characters, social media, and restaurant reviews.Source: §1 · p. 1
  • Existing visualizations can make it difficult to compare term frequencies or display scatterplot labels legibly.Source: §1 · p. 1
  • Scattertext positions term points by category frequencies and uses placement to indicate category association while allowing many unobstructed labels.The introduction describes its point placement and intelligent labeling as producing a low-whitespace, legible plot.Source: §1 · p. 1
  • Figure 1 displays 2,202 term points and labels 215 in a comparison of 123 Democratic and 66 Republican convention speeches.The corpus contains 76,864 words from Democratic speeches and 58,138 from Republican speeches.Source: Figure 1 · p. 2
  • Scattertext also supports query-based exploration of category-discriminating terms that are semantically similar to a query.Source: §1 · p. 2

2 On text visualization

Term scores capture different aspects of word association, so examining their component measures can provide information beyond a single ranking score. The section describes precision, recall, non-redundancy, and characteristicness as distinct measures.

2 On text visualization

  • Word scores can represent several measures of word association that are informative when viewed independently rather than only as one combined score.Source: §2 · p. 2
  • Precision measures a term’s discriminative power regardless of frequency; a term appearing once can have perfect precision, assuming balanced classes.Source: §2 · p. 2
  • Recall is the frequency of a word in a particular class, expressed as P(word|class); high-recall words tend toward stop words.Source: §2 · p. 2
  • Non-redundancy measures discriminative power given co-occurring words; penalized logistic regression has traditionally been used to measure it.In some Scattertext configurations, regression coefficients indicate non-redundancy.Source: §2 · p. 2
  • Characteristicness compares a word’s occurrence in the examined categories with its occurrence in background in-domain text.For reviews of one movie, reviews of other movies could serve as the background corpus; highly category-associated terms tend to be characteristic.Source: §2 · pp. 2–3

3 Past work and design motivation

Prior text visualizations encode discriminating terms in lists, clouds, bubbles, and scatterplots, each with trade-offs in comparison, labeling, or whitespace. The section contrasts these designs and explains why Scattertext uses a different approach to point ordering.

3 Past work and design motivation

  • Schwartz et al. (2013) size words by regression coefficients and color them by frequency, showing terms meeting document-frequency and corrected-significance thresholds.The passage treats frequency as likely to proxy recall for words highly correlated with their class.Source: §3 · p. 3
  • Coppersmith and Kelly (2014) use a middle word cloud to show terms characteristic of categories that are small subsets of a larger corpus.Source: §3 · p. 3
  • Word clouds can obscure comparisons between nonadjacent word sizes and color intensities, while long words may appear more important and size can be confused with frequency.Source: §3 · p. 3
  • Bostock et al. (2012) use manually selected bubbles sized by frequency and colored by Democrats’ relative use to explore convention speech terms.Source: §3 · p. 3

3.1 Scatterplot visualizations

  • MCQ plots log10 recall against differences in word-score z-scores, but its limited number of labels constrains in-depth corpus analysis.Labels may overlap and are also repeated at the chart’s side.Source: §3.1 · p. 3
  • Schofield and Mehr (2016) show over 100 n-grams beside an unlabeled frequency/z-score plot, but most points cannot be aligned with their labels.Source: §3.1 · pp. 3–4
  • Tidytext plots category frequencies with jitter and an odds-ratio diagonal, using less whitespace than MCQ’s chart.Without jitter, equal-frequency words stack, which provides more interior labeling space; Figure 3 shows such stacks.Source: §3.1 · p. 4, Figure 3 · p. 4
  • Embedding-based word maps group similar representations in 2D, but class association does not determine their positions and global position is essentially irrelevant.The section says Scattertext’s point ordering addresses the problems discussed in these scatterplots.Source: §3.1 · p. 4

4 Scattertext

Scattertext selects terms and plots their category-specific frequency ranks, using alphabetical tie-breaking to make labels and points easier to navigate.

4 Scattertext

  • Term selection requires a minimum occurrence threshold and filters bigrams by phrase-likeness and PMI.The PMI filter keeps bigrams that occur far more frequently than expected.Source: §4 · p. 4
  • Category coordinates use ascending frequency ranks with alphabetical ties, and x values are scaled to [0, 1] so the axes remain identical.Source: §4 · pp. 4–5
  • φD is useful with unique, characteristic, frequent terms, but movie names may outrank sentiment terms in review comparisons.Source: §4 · p. 4
  • Alphabetical ties open point-free central tracts for interior labels and make points easier to hover over and click for term excerpts.Source: §4 · p. 5
  • 210 points were labeled without jitter, a 36% lift over 154 with 10% axis jitter, versus 140 with no tie-breaking.Source: §4 · p. 5
  • Terms receive category-specific scores based on associated-corner proximity; colors distinguish stronger B (blue), stronger A (red), and similar scores (yellow).Source: §4 · p. 5
  • A heuristic labels points iteratively from highest score downward, placing labels only where space is available.Source: §4 · p. 5
  • Scattertext can color points by ℓ1 logistic-regression coefficients while chart position still indicates univariate predictive power.Source: Figure 4 · p. 5, §4 · p. 5

5 Topical category discriminators

Figure 5 uses a “jobs” query to show how related terms differ by political category. It ranks category-associated terms by similarity to the query and colors terms by cosine similarity.

5 Topical category discriminators

  • The running example asks how Republicans and Democrats used language about “jobs,” “healthcare,” or “military” differently in 2012.Source: §5 · p. 5
  • Terms are colored by cosine similarity to the query, using spaCy-provided GloVe vectors and mean vectors for phrases.Figure 5’s darker gray-to-purple colors indicate greater semantic similarity to “jobs.”Source: §5 · p. 6, Figure 5 · p. 6
  • The heuristic first selects terms associated with a category, then ranks them by query similarity for display beside the plot.A term counts as associated at p-value <0.05, determined using MCQ’s difference in weighted log-odds-ratio with an uninformative Dirichlet prior.Source: §5 · p. 6
  • For “jobs,” “job creators” is the top Republican term and “workers” the top Democratic term.The displayed related-term lists also include terms such as “unemployment,” “insurance,” and “Medicare.”Source: §5 · p. 6

6 Conclusion and future work

Scattertext is introduced as a tool for legible, comprehensive visualizations of class-associated term frequencies; rigorous human evaluation of its visualization strategies is future work.

6 Conclusion and future work

  • The paper introduces Scattertext as a tool for visualizing class-associated term frequencies.Source: §6 · p. 6
  • The tool’s stated aim is to make these visualizations legible and comprehensive.Source: §6 · p. 6
  • Rigorous human evaluation of the visualization strategies is identified as future work.Source: §6 · p. 6
Loading 1703.00565v3…