← AI Terminology
TF-IDF - Term Frequency–Inverse Document Frequency
TF-IDF weights terms by how often they appear in a document (TF) discounted by how common they are across the corpus (IDF) — a classic sparse text representation.
Still strong for keyword retrieval and linear baselines.
Still strong for keyword retrieval and linear baselines.
Why It Matters in AI
Before dense embeddings dominated, TF-IDF vectors powered search and text classification. It remains a robust baseline and a building block of hybrid retrieval with BM25-related ideas.
Key Points
| Aspect | Description |
|---|---|
| TF | Term frequency in a document |
| IDF | Log-scaled rarity across documents |
| Use | Search features, linear SVM/logreg text models |
| Tools | sklearn TfidfVectorizer |
| Limits | No true semantics/synonyms |
| Related | BM25, bag-of-words, embeddings |
Simple Analogy
Highlighting words that show up a lot in this article but rarely in the rest of the library — distinctive keywords glow.
Common Usage Examples
TfidfVectorizer+ logistic regression baseline- Keyword features for ranking
- Compare to embedding classifiers
- Sparse vectors for interpretable models
Summary
In short: TF-IDF scores distinctive keywords in documents — the classic sparse text feature that still baselines many NLP systems.