Challenge - 5 Problems
Train-Test Split Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why do we use a train-test split in machine learning?
Choose the best reason why splitting data into training and testing sets is important.
Attempts:
2 left
❓ Predict Output
intermediate2:00remaining
Output of train-test split sizes
What will be the output sizes of training and testing sets after this code runs?
ML Python
from sklearn.model_selection import train_test_split X = list(range(100)) y = [x * 2 for x in X] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42) print(len(X_train), len(X_test))
Attempts:
2 left
❓ Hyperparameter
advanced2:00remaining
Choosing the test_size parameter
Which test_size value is best if you want to maximize training data but still have a reliable test set?
Attempts:
2 left
🔧 Debug
advanced2:00remaining
Identify the error in this train-test split code
What error will this code raise?
ML Python
from sklearn.model_selection import train_test_split X = [1, 2, 3] y = [4, 5] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33)
Attempts:
2 left
❓ Model Choice
expert3:00remaining
Best practice for train-test split with imbalanced classes
You have a classification dataset with very imbalanced classes. Which train-test split approach is best to keep class proportions consistent?
Attempts:
2 left