Explore Library
Code QuizIntermediate

Applying SMOTE to Imbalanced Data

Spot the resampling order mistake that contaminates the test set with synthetic rows.

Codepython
from imblearn.over_sampling import SMOTE

sm = SMOTE()
X_res, y_res = sm.fit_resample(X, y)
X_train, X_test, y_train, y_test = train_test_split(X_res, y_res, test_size=0.2)

What is the bug in this code?