liveBook · Manning

Document-term matrix

As explained in Math and Architectures of Deep Learning

A matrix with documents as rows and terms as columns, storing term-frequency values for retrieval or analysis.

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

How Math and Architectures of Deep Learning covers it

How deep it goes
Defines rows, columns, and frequencies, then connects correlations to principal-component topics without detailing matrix computation.
Examples
Uses a toy corpus containing violence, gun, America, and roses, including frequency rows d0 through d6.
What you can do after
Evaluate document similarity and identify correlated vocabulary topics from term-frequency vectors.
How it connects
Connects document vectors with latent semantic analysis, principal components, topics, and cosine similarity.

Also explained in

Compare how 2 books explain document-term matrix →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math and Architectures of Deep Learning. The section links point to the parts of the book it draws on.