TF-IDF

TF-IDF weights each word by its frequency in the document (TF) and by the rarity of the word across the whole corpus (IDF). Words that are frequent everywhere, such as "the", weigh little; those that characterize a document weigh more. It improves on the bag of words for search and classification.

Example

TfidfVectorizer(min_df=2, ngram_range=(1, 2))

Related concepts

The whole glossary