A document-term matrix represents a corpus as a rectangular array: documents occupy rows, vocabulary terms occupy columns, and each cell records a term frequency. Each row is a document vector in the original document feature space. section 4.6.2
This representation turns text retrieval into linear algebra. Correlated columns can reveal topics through principal components, allowing documents with few exact words in common to remain similar when their words co-occur across the corpus. section 4.6.2
Toy corpus
In the example matrix, the gun and violence columns often contain matching counts: d2, d3, and d4 contain 2/2, 3/3, and 5/5. Their correlation forms a gun-violence topic, while d5 and d6 can show nonzero similarity after topic-based representation. section 4.6.2
Table 4.1 Document matrix for the toy example dataset
|
|
Violence |
Gun |
America |
⋯ |
Roses |
|---|---|---|---|---|---|
| d0 |
0 |
0 |
0 |
⋯ |
2 |
| d1 |
1 |
1 |
1 |
⋯ |
0 |
| d2 |
2 |
2 |
0 |
⋯ |
0 |
| d3 |
3 |
3 |
0 |
⋯ |
0 |
| d4 |
5 |
5 |
0 |
⋯ |
0 |
| d5 |
0 |
1 |
0 |
⋯ |
0 |
| d6 |
1 |
0 |
0 |
⋯ |
0 |
Inspect the toy document matrix to connect rows, term columns, and frequency values with the topic-extraction example. section 4.6.2

