fit_transform with the training data and transform with the testing
<p>As the title says, I am using <code>fit_transform</code> with the <code>CountVectorizer</code> on the training data .. and then I am using <code>tranform</code> only with the testing data ... will this gives me the same as using <code>fit</code> only on the training and <code>tranform</code> only on the testing data ?</p>

<p>The answer is <strong>YES</strong> :</p>

<p><code>fit_transform</code> is equivalent to <code>fit</code> followed by <code>transform</code>, but more efficiently implemented. <a href="http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html#sklearn.feature_extraction.text.CountVectorizer.fit" rel="nofollow">See documentation</a></p>

<p>Both <code>fit</code>and <code>fit_transform</code> fit your classifier to your dataset. You can then use the same classifier to transform any other dataset (in your case the test set).</p>

python scikit-learn