← Capital One Interview Insights
The leakage question at the end is what actually tripped me up.
Structure your answer around the pipeline architecture, the nested cross-validation strategy for unbiased threshold selection, and the evaluation metrics tailored to imbalance. Emphasize how GroupKFold prevents user leakage and how the inner fold calibration and threshold selection avoid optimistic bias. Conclude with the trade-off between precision and alert volume, showing business awareness.
Pro tip: Mention that PR-AUC is more informative than ROC-AUC for imbalanced data, and that threshold selection must be done on a separate validation set or via nested CV to avoid leakage. Also, highlight that calibration is crucial for threshold-based decisions, especially with class_weight='balanced' which distorts probabilities.
Build a scikit-learn Pipeline with ColumnTransformer: impute missing values (median for numeric, most frequent for categorical), one-hot encode categoricals, and standard scale numerics. Then append the classifier.
Use GroupKFold with 5 folds grouped by user_id to train and evaluate LogisticRegression (class_weight='balanced') and HistGradientBoostingClassifier. Compute cross-validated ROC-AUC and PR-AUC for each, and select the better model based on PR-AUC.
For the better model, perform nested cross-validation: within each outer training fold, use an inner GroupKFold to calibrate with CalibratedClassifierCV and select the smallest probability threshold achieving precision >= 0.50. Apply this threshold to the outer test fold to compute recall, F1, and alert volume per 100k users.
Ensure threshold selection is done only on inner folds, never on the outer test fold. This prevents optimistic bias and mimics real-world deployment where thresholds are set on historical data and applied to future data.
Report average cross-validated ROC-AUC and PR-AUC, and the threshold metrics from outer folds. Discuss the trade-off between precision and alert volume, and how the chosen threshold aligns with business capacity.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.