← Google Interview Insights

Google·Data Scientist·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Brutal technical screen for a DS role at Google. The whole thing was one massive ML system design question about fraud detection, and they wanted a real end-to-end answer, not hand-waving.

Questions Asked (1)

Q1

You have a fraud classification problem with a 0.2% positive rate, 10 million rows, and 500 features. Walk through your complete end-to-end plan: data splitting, handling class imbalance, metric selection, threshold tuning, algorithm choices, and validation strategy. Include pseudocode for the training loop.

System DesignTechnical Trade-offsData Modeling
Author's notes

This was essentially seven questions rolled into one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer as a coherent narrative that starts with data splitting and imbalance handling, then moves through metric selection, threshold tuning, algorithm choices, and validation, ending with pseudocode. Emphasize that with such a low positive rate, careful validation and metric choice are critical to avoid misleading results.

Pro tip: Mention that you would use stratified splitting and consider grouping by time or entity to prevent leakage, and that you'd evaluate using precision-recall AUC and cost-sensitive metrics rather than accuracy or ROC AUC.

1. Data Splitting and Leakage Prevention

Split data into train/validation/test using stratification to preserve the 0.2% positive rate, and consider time-based splits if temporal patterns exist. Ensure no leakage by grouping related rows (e.g., same user) into the same split.

2. Handling Class Imbalance

Address imbalance via techniques like class weighting, oversampling (e.g., SMOTE), or undersampling, but be cautious with synthetic data. Evaluate the impact on validation metrics and consider using anomaly detection if positives are extremely rare.

3. Metric Selection and Threshold Tuning

Choose metrics robust to imbalance: precision-recall AUC, F1, or cost-based metrics. Tune the decision threshold on validation data to optimize the business objective (e.g., minimize expected cost).

4. Algorithm Choices and Training Loop

Start with a simple baseline (logistic regression) and move to tree-based ensembles (XGBoost, LightGBM) that handle imbalance well. Use early stopping and cross-validation. Provide pseudocode for the training loop with class weights and threshold tuning.

5. Validation Strategy

Use stratified k-fold cross-validation on training data, and a held-out test set for final evaluation. Monitor for overfitting and ensure the model generalizes to the minority class.

Key Points to Mention

  • Stratified splitting to maintain class distribution
  • Precision-recall AUC as a key metric for imbalanced data
  • Threshold tuning based on business costs (false positives vs. false negatives)
  • Use of class weights or resampling techniques
  • Choice of tree-based models like XGBoost with scale_pos_weight
  • Cross-validation with stratification and early stopping

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.