ML Notes
Comprehensive collection of real-world machine learning case study questions asked in interviews at top tech companies like Google, Meta, Amazon, and Microsoft.
Case study questions are a critical part of machine learning interviews at top tech companies. These questions evaluate your ability to design ML systems end-to-end, from problem definition through deployment and monitoring. Unlike coding questions that focus on algorithms, case studies assess your practical understanding of real-world ML challenges.
What Are ML Case Studies?
A case study question in ML interviews typically presents a business problem and asks you to design a machine learning solution. You're expected to discuss data collection, feature engineering, model selection, evaluation metrics, deployment considerations, and how you'd monitor the system in production.
Key Objectives of Case Studies
The interviewer is assessing:
- Problem Understanding - Can you clarify ambiguous requirements?
- System Design - Can you architect an end-to-end ML pipeline?
- Trade-offs - Do you understand complexity vs. performance tradeoffs?
- Practical Knowledge - Have you dealt with real ML problems?
- Communication - Can you explain technical decisions clearly?
Popular Case Study Questions
Case Study 1: YouTube Video Recommendation System
Problem: Design a recommendation system that suggests videos to users on YouTube.
Solution Approach:
Data & Features:
- User features: age, country, subscription tier, watch time
- Video features: category, duration, upload date, view count
- Interaction features: watch history, likes/dislikes, comments
- Context: time of day, device type, network connection
Model Selection:
# Two-stage approach for efficiency
# Stage 1: Fast retrieval (collaborative filtering, LSH)
from sklearn.neighbors import LSHForest
lsh = LSHForest(n_candidates=1000)
# Stage 2: Ranking (gradient boosting)
import xgboost as xgb
ranker = xgb.XGBRanker()
# Expected performance:
# Candidate Generation: 100ms latency for 100-1000 videos
# Ranking: 50ms latency for final scoring
# Total: ~150ms to serve recommendationsMetrics & Evaluation:
- CTR (Click-Through Rate)
- Watch time
- Engagement rate
- User retention
- A/B testing for online evaluation
Challenges & Solutions:
| Challenge | Solution |
|---|---|
| Cold start (new users) | Content-based filtering, popularity baseline |
| Computational scale | Distributed training, model caching, batch serving |
| Bias in recommendations | Monitor diversity, enforce freshness, handle position bias |
| Data staleness | Real-time feature store, streaming updates |
| Long-tail videos | Multi-armed bandits, exploration strategies |
Case Study 2: Email Spam Detection
Problem: Design a spam detection system for Gmail that filters unwanted emails.
Solution Approach:
Data Handling:
# Dataset size and split
train_size = 1_000_000 # emails
test_size = 100_000
val_size = 50_000
# Class distribution
spam_ratio = 0.15 # 15% spam (imbalanced)
ham_ratio = 0.85 # 85% legitimate
# Handling class imbalance
from imblearn.over_sampling import SMOTE
smote = SMOTE(sampling_strategy=0.5)
X_balanced, y_balanced = smote.fit_resample(X_train, y_train)Key Features:
- Email metadata: from, to, date, IP address
- Content features: word frequencies, suspicious keywords
- Sender features: domain age, reputation, bounce rate
- Network features: IP location, reverse DNS, SPF/DKIM records
Model Approach:
import xgboost as xgb
from sklearn.ensemble import GradientBoostingClassifier
# XGBoost performs well for spam detection
model = xgb.XGBClassifier(
n_estimators=100,
max_depth=7,
learning_rate=0.1,
scale_pos_weight=5 # handle class imbalance
)
model.fit(X_train, y_train)
# Expected metrics:
# Precision: 99.5% (minimize false positives - legitimate emails marked spam)
# Recall: 95% (catch most spam)
# F1-Score: 0.972Production Considerations:
- Latency requirement: <100ms per email
- Must handle 1+ billion emails daily
- Real-time model updates for new spam patterns
- User feedback integration for continuous improvement
Case Study 3: House Price Prediction
Problem: Design a model to predict house prices for a real estate platform.
Solution Approach:
| ├── Numerical features | square feet, bedrooms, age |
| ├── Categorical | location, property type |
| └── Derived features | price per sqft, age groups |
| ├── Baseline | Linear Regression |
| ├── Advanced | Gradient Boosting, Neural Networks |
Feature Engineering Example:
Interview Tips for Case Studies
Structure Your Response
- Clarify Requirements (2-3 minutes)
- Ask about scale: how many users/items?
- Latency requirements?
- Accuracy targets?
- Are there budget constraints?
- High-Level Design (3-5 minutes)
- Draw system architecture
- Identify key components
- Discuss data flow
- Deep Dive into Components (10-15 minutes)
- Data collection & features
- Model selection reasoning
- Evaluation approach
- Handling edge cases
- Production & Monitoring (3-5 minutes)
- Deployment strategy
- Monitoring metrics
- How to handle model degradation
- Update strategy
Common Pitfalls to Avoid
| Mistake | How to Avoid |
|---|---|
| Jumping to code immediately | Start with problem understanding |
| Proposing overly complex solutions | Begin with simple baselines |
| Ignoring data collection challenges | Discuss data quality early |
| No discussion of trade-offs | Always mention why you chose approach X over Y |
| Forgetting about monitoring | Always include production monitoring plan |
| No consideration of ethics | Discuss bias, fairness in sensitive domains |
Real Numbers Matter
Always provide realistic estimates:
YouTube Recommendation
├── Daily active users: 2 billion
├── Videos to rank: 800+ million
├── Candidate pool size: 1000-5000
├── Prediction latency: <150ms
├── Model retraining: Every 1-2 days
└── A/B test duration: 2-4 weeks
Gmail Spam Detection
├── Emails processed/day: 1.8+ billion
├── Spam ratio: 15%
├── Required latency: <100ms
├── Model updates: Multiple times per day
└── False positive rate target: <0.5%
House Price Prediction
├── Properties in database: 100+ million
├── New listings/day: 500k
├── Retraining frequency: Weekly
├── Prediction latency: <500ms
└── Price range: $50k - $10M
End-to-End Case Study Example: Movie Recommendation
Business Problem: Netflix needs to recommend movies to its 200M+ subscribers.
Your Solution:
Expected Metrics:
- Click-through rate: 5-10%
- Completion rate (watched full movie): 20-30%
- User retention improvement: 3-5%
- Model serving latency: 50-100ms
Summary
Master ML case studies by:
- Starting with problem clarification
- Designing end-to-end systems thoughtfully
- Considering scale and real-world constraints
- Discussing evaluation and monitoring
- Being able to justify your design choices
Practice with realistic scenarios, understand the math behind algorithms, and always think about production implications. Great case study answers show both breadth (end-to-end thinking) and depth (technical understanding of components).
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for ML Case Study Questions for Interviews.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Machine Learning topic.
Search Terms
machine-learning, machine learning, machine, learning, interview, preparation, case, study
Related Machine Learning Topics