Katkat

Handle imbalance, validate samples, and avoid overfitting

LinkedInData Scientist · Technical Screen

Last updated

This question tests your ability to design a robust machine learning pipeline for a highly imbalanced classification task, focusing on sampling strategies, metric selection, and regularization techniques to prevent overfitting.

Scenario

You are building a fraud detection model for a professional networking site where the positive class (fraudulent sign-up) makes up only 0.1% of the total dataset of 100 million users. You are using a Gradient Boosted Decision Tree (GBDT) model.

Task

  1. Describe your strategy for handling the severe class imbalance during training. How would you ensure the model doesn't simply predict the majority class?
  2. Your model currently shows a high F1-score on the training set but significantly lower performance on the hold-out test set. Propose three specific techniques to mitigate this overfitting.
  3. Explain how you would select an appropriate decision threshold for production. If the business requirement shifts to minimize "false positives" over "false negatives," how does that change your thresholding strategy?
  4. Suppose you decide to add an L1 regularization term to the model. How does this affect the model's bias-variance tradeoff compared to L2 regularization, particularly regarding the selection of features?

Hints

Hint 1

Consider techniques like oversampling the minority class, undersampling the majority class, or utilizing class-weighted loss functions.

Hint 2

Think about hyperparameter tuning (e.g., tree depth, learning rate) and structural constraints like early stopping or feature sub-sampling.

Hint 3

Visualize the performance using a Precision-Recall curve or an ROC curve to determine the trade-off point based on the cost of different types of errors.

Follow-up questions

  • How would you detect data drift if the patterns of fraudulent sign-ups change after your model is deployed?
  • If you were to use a deep learning model instead of a GBDT, how would the approach to imbalance and regularization differ?
  • What are the implications of using Accuracy versus Precision-Recall AUC as your primary optimization metric in this specific scenario?