Skip to main content
AI & ML Code Reorder Medium +20 XP

Data Preprocessing

Arrange the correct data preprocessing order.

Click lines in the correct order

Available lines4 left

Your order

Click lines above to build your solution.

Show answer and explanation

Answer: X_train, X_test, y_train, y_test = train_test_split(X, y) scaler = StandardScaler() X_train_scaled = scaler.fit_transform(X_train) model.fit(X_train_scaled, y_train)

Split first, then create scaler, then fit_transform on train data, then train the model.

Hint: Split before scaling to avoid data leakage.

What this challenge tests

Code Reorder in AI & ML: preprocessing, workflow.

Related challenges