title: Computing TF-IDF on the whole dataset or only on training data?
body: <p>In the chapter seven of this book "TensorFlow Machine Learning Cookbook" the author in pre-processing data uses <code>fit_transform</code> function of scikit-learn to get the <code>tfidf</code> features of text for training. The author gives all text data to the function before separating it into train and test. Is it a true action or we must separate data first and then perform <code>fit_transform</code> on train and <code>transform</code> on test?</p>