1. Home
  2. Data Science
  3. Scikit-learn
  4. What is the main purpose of train_test_split in…

Added 30 Nov -0001

What is the main purpose of train_test_split in scikit-learn?

  1. To scale features so they share a common range
  2. To select the most important features from the data automatically
  3. To merge several datasets into one training set
  4. To hold out data for an unbiased estimate of generalisation Correct answer

Correct answer

D. To hold out data for an unbiased estimate of generalisation

14 views

MCQSEXAM

Explanation

train_test_split divides arrays into training and test subsets so the model is judged on data it never saw during fitting. Without a hold-out, training accuracy is optimistic and cannot reveal overfitting. Setting random_state makes the split reproducible, and stratify=y preserves the class proportions of the original data in both parts.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Scikit-learn MCQs

Practise all Scikit-learn MCQs

Similar MCQs