Design cross-validation when each customer contributes repeated records.
Instruction: You need to predict outcomes for previously unseen customers. Each customer contributes multiple records. Explain the split unit, where to fit imputation/scaling/feature selection, how to tune hyperparameters and how to preserve a final evaluation. Discuss what changes if the goal is forecasting future records.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
For generalization to unseen customers, assign whole customers to folds so no customer's records appear in both a fold's training and validation portions. Randomly splitting rows can leak customer-specific patterns and estimate a different, easier problem. Check class coverage and group sizes; group separation alone does not guarantee representative folds.
Within each training fold, fit imputation values, scaling statistics, feature...