Term Frequency › Visualizing Term Frequency Distributions
Language AI HandbookAll chapters Term Frequency › Visualizing Term Frequency DistributionsOne section · Sections in this chapter12 / 17 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Understanding what term frequency distributions look like in practice is as important as understanding the weighting formulas. Let's visualize the distribution of raw term frequencies in a real corpus.


The raw TF distribution is extremely right-skewed: roughly half of all non-zero entries are 1 (a word appears exactly once in a document), and counts above 10 are relatively rare outside stopwords. This means log scaling does most of its work on the minority of high-count entries, while boolean and raw TF give similar results for the majority of term-document pairs where the count is 1.
We can also visualize how the different weighting schemes change the appearance of the full document-term matrix for our small corpus. A heatmap makes the differences between schemes immediately visible.


The side-by-side heatmaps make the effect of normalization concrete. In the raw count matrix, "the" dominates both Doc A and Doc B with values of 3 and 4, while content words like "cat," "dog," and "patterns" are barely visible. After log scaling and L2 normalization, the weights spread more evenly across terms: "the" no longer overwhelms everything else, and the distinctive content of each document becomes more apparent in the representation. Doc A becomes characterized by roughly equal weights for "cat," "sat," and "the"; Doc C shows "patterns" as a distinctively high-weight term relative to the other terms.