Explore Library
Code QuizIntermediate

Scaling After Train-Test Split

Find the scaling mistake that leaks information and mis-transforms the test set.

Codepython
from sklearn.preprocessing import StandardScaler

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.fit_transform(X_test)

What is the bug in this code?