What is the main purpose of train_test_split in scikit-learn?
Correct answer
D. To hold out data for an unbiased estimate of generalisation
14 views
D. To hold out data for an unbiased estimate of generalisation
14 views
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.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is D? Ask here and get an explanation.