Study Vault Search notes, aliases and full text
Graph
ConceptDBISAI-written · not yet proofread

Term Frequency

Also Term Frequencies · tf

The term frequency tf(w, D) is the number of times word w occurs in document D; it is the first, naive score of the posting of D in the inverted list of w.

Know these firstInverted Index

Formula#

With tf scores, the score of document DD for a keyword query q=w1…wmq = w_1 \dots w_m is the sum of the posting scores, computed while merging the inverted lists:

score(D)=∑j=1mtf(wj,D).\mathrm{score}(D) = \sum_{j=1}^{m} \mathrm{tf}(w_j, D).

In the Vector Space Model with the tf term-document matrix AA (Aij=tf(ti,Dj)A_{ij} = \mathrm{tf}(t_i, D_j)) and the 0/1 query vector qq, this is qTAq^T A for all documents at once.

Properties#

  • tf(w,D)=0  ⟺  w∉D\mathrm{tf}(w, D) = 0 \iff w \notin D; only non-zero tf values are stored (one posting each).
  • Construction: appending the document ID once per occurrence of ww (as in the Lecture 1 code) already encodes tf implicitly: tf\mathrm{tf} is the number of times the ID appears in the list. Counting them gives the (D,tf)(D, \mathrm{tf}) postings in the same linear pass (DBIS_VL02 > Implementation advice).
  • Summing tf(w,D)\mathrm{tf}(w, D) over all documents gives the total frequency of ww in the collection, the FnF_n of Zipf’s Law.
  • Problems of tf as a score (DBIS_VL02 > Scores: tf, df, idf):
    • Words that are frequent in many documents regardless of content (of, the) dominate the score sum. Fix: weight by idf, giving tf.idf.
    • Longer documents have larger tf without being more relevant, and relevance does not grow linearly with tf. Fix: the saturating, length-normalized tf∗\mathrm{tf}^* of BM25.

Example#

Sources#

Search

Type In
↑ ↓ move ↵ open ⇥ next section Ctrl↵ results page Prefix # to search text only