Explore Library
Code QuizIntermediate

TF-IDF on Train and Test

Identify the vectorization mistake that gives train and test different feature spaces.

Codepython
from sklearn.feature_extraction.text import TfidfVectorizer

vec = TfidfVectorizer()
X_train = vec.fit_transform(train_texts)
X_test = vec.fit_transform(test_texts)

What is the bug in this code?