← Quiz: Classification: all 10 questions
Quiz: Classification · Question 5 of 10
What does stratify=y do in traintestsplit?
What does stratify=y do in train_test_split?
- A.Sorts the data by y
- B.Keeps the same class proportions in the train and test sets
- C.Removes the minority class
- D.Scales the features
Answer & explanation
Correct answer: Keeps the same class proportions in the train and test sets
Important for small or imbalanced datasets.
Can you get the rest right without peeking?
Take the timed Quiz: Classification quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →