Skip to main content
๐Ÿ› Bug HuntAI AI & ML Mediumโšก+20 XP

Data Leakage

This code has data leakage. Find the bug.

๐Ÿ› Find the bug
1scaler = StandardScaler()
2X_scaled = scaler.fit_transform(X)
3X_train, X_test = train_test_split(X_scaled, test_size=0.2)
๐Ÿ› The bug is on line 2

๐Ÿ”ง Select the correct fix: