Machine Learning & AI
Advanced

TF-IDF

Weights a word by its frequency in a document against its rarity across the corpus.

Formula

tfidf=tflogNdf\text{tfidf} = tf \cdot \log\dfrac{N}{df}

Variables

tfTerm frequency
NTotal documents
dfDocuments containing the term

Example

Common words get low weight, rare terms high

Did You Know?

TF-IDF was the backbone of search engines and text mining for decades before embeddings.

Share this formula