A classifier is being trained on an imbalanced medical dataset. The team wants each validation fold to preserve roughly the same class proportions as the full dataset so performance estimates remain stable during tuning. Which approach best supports that goal?
Answer & explanation
Correct answer: D
WHY D: StratifiedKFold is designed to preserve class proportions across folds for classification tasks, which is especially useful with imbalance.
WHY NOT A: Ordinary KFold ignores labels and can produce unstable class ratios from fold to fold.
WHY NOT B: LeaveOneOut is expensive and does not preserve class balance per fold; each validation fold is one example.
WHY NOT C: One split provides less stable estimates and leaves the class ratio to chance.
WHY NOT E: PCA transforms features; it does not rebalance labels.