Term Frequency and Document Frequency
Term frequency counts occurrences in one document. Document frequency counts documents where the term occurs at least once.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a collection
If “array” appears twice in document 1 and once in document 3, its term counts are two and one. Its document frequency is two. Frequency maps can represent the per-document observations.
Use each feature for its purpose
A term can be rare across documents and repeated within a matching article. Relevance scores can use those separately. See inverted indexes.[1]
Count appearances and documents in separate columns
Term map occurs three times in A and once in B, while C contains none. Collection frequency is four occurrences. Document frequency is two because repeated uses in one document still represent one document with the term. See inverse document frequency.
A: term frequency 3
B: term frequency 1
C: term frequency 0
Collection frequency 4, document frequency 2
Apply the right unit to ranking statistics
Within-document frequency can express how often a theme occurs in one record. Document frequency helps measure commonness across records. Test a repeated token and a corpus with only one matching document.