TF - term frequency. IDF - inverse document frequency ![[Pasted image 20260719155922.png]] ![[Pasted image 20260719155956.png]] ```python from sklearn.feature_extraction.text import TfidfVectorizer ``` Usage - keywords extraction - text clustering (kmeans on tf-idf matrix) Initially - modification of bag of word, used to filter out useless (less important for meaning words) Sources: https://habr.com/ru/companies/otus/articles/755772/ https://www.geeksforgeeks.org/machine-learning/understanding-tf-idf-term-frequency-inverse-document-frequency/