machine-learningscikit-learntfidfvectorizercountvectorizer

What is the difference between CountVectorizer+TfidfTransformer and TfidfVectorizer


To apply ML algorithm on text, it has to be represented numerically. Some ways to do this using sklearn are:

  1. CountVectorizer

  2. CountVectorizer + TfidfTransformer

  3. TfidfVectorizer

What is the difference between CountVectorizer+TfidfTransformer and TfidfVectorizer?


Solution

  • None, see the top of the documentation page:

    sklearn.feature_extraction.text.TfidfVectorizer
    ...
    Equivalent to CountVectorizer followed by TfidfTransformer.