Sobes.tech
Middle

What do the TF and IDF components mean?

sobes.tech AI

Answer from AI

TF and IDF are key components of the TF-IDF method used to evaluate the importance of words in documents.

  • TF (Term Frequency) — the frequency of a term in a specific document. It shows how often a word appears in the text.

  • IDF (Inverse Document Frequency) — the inverse frequency of a document, measuring how rare or common a word is across the entire collection of documents.

The idea is that words that frequently appear in a particular document (high TF) but are rare across other documents (high IDF) are more significant for that document.

Formula:

[ \text{TF-IDF}(t, d) = \text{TF}(t, d) \times \log\left(\frac{N}{DF(t)}\right) ]

where:

  • (t) — term,
  • (d) — document,
  • (N) — total number of documents,
  • (DF(t)) — number of documents containing the term (t).

TF-IDF is widely used in information retrieval, text analysis, and machine learning to highlight keywords.