Handle Extreme Class Imbalance in an Outlook Phishing Classifier

Last updated: November 29, 2026

Quick Overview

You are training a model to flag phishing emails where only about 1 in 2,000 messages is phishing. Explain how you would train, evaluate, and pick an operating threshold so the classifier is useful in production.

Microsoft
Machine Learning
Machine Learning Engineer
Microsoft
November 29, 2026
Machine Learning Engineer
Technical Screen
Machine Learning
Medium

0

0

0 solved


You are training a model to flag phishing emails where only about 1 in 2,000 messages is phishing. Explain how you would train, evaluate, and pick an operating threshold so the classifier is useful in production.

Microsoft Defender for Office 365 protects Outlook and Exchange mailboxes, where false negatives let attacks through and false positives hide legitimate mail from executives. Interviewers check whether you know why accuracy and ROC AUC mislead under imbalance, how resampling and class weights change calibration, and how to turn a business cost into a threshold.

What the Interviewer Expects
  • Rejects accuracy and explains why ROC AUC can look great while precision is poor
  • Uses precision-recall curves, PR AUC, and recall at a fixed false positive rate
  • Applies class weights or downsampling and corrects calibration afterward
  • Chooses the threshold from explicit costs or a precision floor
  • Splits data by time to reflect adversarial drift
  • Discusses label noise from user reports
Key Topics to Cover
Class imbalance
Precision-recall
Calibration
Threshold selection
Concept drift
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • You downsampled negatives 100x for training: how do you fix the predicted probabilities?
  • Attackers adapt within days: how does that change your evaluation and retraining plan?
  • How would you use different thresholds for quarantine versus a warning banner?
  • User-reported phishing labels are noisy and biased: how do you handle that?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Base rate is about 0.05%. What happens on a positive prediction: quarantine, banner, or junk folder? What is the volume (say 1 billion messages a day)? Are labels from analysts, detonation sandboxes, ...

Approach

Train a gradient boosted model or transformer on header, URL, sender reputation, and body features. Handle imbalance with class weights or by downsampling negatives, since there is plenty of negative ...


Submit Your Answer
Markdown supported