Skip to main content
AI & ML Output Prediction Easy +10 XP

Train-Test Split

What does test_size=0.2 mean?

AI & MLRead-only
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

What is the output?

Show answer and explanation

Answer: 20% for testing, 80% for training

test_size=0.2 reserves 20% of data for evaluation and uses the remaining 80% for training the model.

Hint: test_size is a fraction of the total data.

What this challenge tests

Output Prediction in AI & ML: sklearn, data-splitting.

Related challenges