Abstract
When working with a new dataset, it is important to first explore and familiarize oneself with it before applying any advanced machine learning algorithms. However, to the best of our knowledge, no tools exist that quickly and reliably give insight into the contents of a selection of documents with respect to what distinguishes them from other documents belonging to different categories. In this paper, we propose to extract 'relevant words' from a collection of texts, which summarize the contents of documents belonging to a certain class (or discovered cluster in the case of unlabeled datasets), and visualize them in word clouds to allow for a survey of salient features at a glance. We compare three methods for extracting relevant words and demonstrate the usefulness of the resulting word clouds by providing an overview of the classes contained in a dataset of scientific publications as well as by discovering trending topics from recent New York Times article snippets.
Introduction
In the initial stages of data science projects, exploratory data analysis (EDA) is crucial for understanding the underlying structure of a dataset. While techniques like t-SNE or PCA are effective for visualizing document clusters, they often fail to convey the semantic meaning of those clusters. Manual inspection of samples is a bottleneck that does not scale. This research introduces a framework to bridge this gap by extracting and visualizing "relevant words"—terms that uniquely define a document category or cluster—providing a "survey at a glance."
Methodology
The proposed pipeline consists of three main stages: preprocessing, clustering, and relevancy scoring.
Preprocessing and Bigrams
To move beyond simple bag-of-words models, the authors employ a data-driven approach to identify meaningful bigrams (e.g., "lung cancer"). This is achieved by comparing co-occurrence frequencies in the original text against a randomly shuffled version of the same text, ensuring that only statistically significant word pairs are preserved.
Clustering
For unlabeled datasets, the framework uses DBSCAN applied to PCA-reduced tf-idf vectors. Cosine similarity is used to group related documents into clusters, which can then be analyzed for thematic content.
Relevancy Scoring Methods
The core of the framework is the comparison of three scoring methods to rank words for visualization:
- Salient tf-idf: This method sums the tf-idf scores for all documents within a specific class. While simple, it often highlights frequent but non-discriminative terms.
- SVM + Layerwise Relevance Propagation (LRP): A linear Support Vector Machine (SVM) is trained on the data. LRP is then used to decompose the classification score, identifying which specific words most strongly influenced the model's decision for a given class.
- Distinctive Words: This statistical approach compares a word's True Positive Rate (frequency in the target class) against its False Positive Rate (frequency in other classes). A "rate quotient" is used to highlight words that are significantly more prevalent in one group than others.
Experimental Evaluation
The methods were tested on two datasets: a collection of ~50,000 scientific paragraphs from PubMed covering 10 cancer types, and a set of unlabeled New York Times article snippets from the period surrounding the 2017 U.S. Presidential Inauguration.
Comparison of Scoring Methods
The researchers found that while tf-idf is easy to implement, it often fails to filter out common terms like "patients" in medical texts. In contrast, the "Distinctive Words" and "SVM+LRP" methods successfully identified highly specific terms, such as "smoking" or "nsclc" for lung cancer.
Visual Innovation: Letter-Shaped Word Clouds
To enhance the interpretability of the visualizations, the authors introduced a dual-layer visual information system where word clouds are shaped into letters representing their category. For example, paragraphs from the "Methods" section of a paper are visualized within an "M" shape, while "Discussion" sections use a "D" shape. This allows users to identify the category of the word cloud even before reading the individual terms.
Key Results and Discussion
The linear SVM achieved high classification accuracy (95% for cancer types), ensuring that the LRP weights were grounded in meaningful patterns. In the unlabeled NYT dataset, the "Distinctive Words" method proved most robust for identifying specific trending topics within small clusters, such as political hearings or international news events.
Limitations
The effectiveness of LRP is strictly tied to the accuracy of the underlying classifier; a poorly performing model will yield irrelevant word clouds. Additionally, statistical methods like "Distinctive Words" can be sensitive to temporal biases or accidental frequency spikes in small datasets.
Conclusion
Visualizing relevant words through word clouds provides a powerful, intuitive tool for exploratory text analysis. By utilizing advanced scoring methods like LRP and Distinctive Words, researchers can quickly identify the unique characteristics of document clusters, debug classification models, and discover emerging trends in large-scale text corpora.
Summary updated