Term frequency–inverse document frequency (TF-IDF) weights terms by combining their frequency within a document with the inverse frequency of documents containing them. It adjusts the term-document matrix so words common across a corpus contribute less and discriminative words contribute more. section 9.1
For a corpus of D documents, let nt denote the number of documents containing term t. The inverse-document-frequency factor is log(D/nt), which approaches zero as a term appears in more documents; applying it to word counts produces smoothed weights for downstream topic modeling. section 9.1 section 9.8
TF-IDF fits into document representation as follows:
- Represent documents with a bag-of-words term-document matrix whose columns or rows encode vocabulary-term counts. section 9.1
- Apply inverse-document-frequency weighting to emphasize terms that distinguish documents. section 9.1
- Extend the representation from unigrams to n-grams when larger structural units are useful. section 9.1









