Choose Ranking Functions, Customer Value Metrics, and Predictive Models
Company: Bytedance
Role: Data Scientist
Category: Machine Learning
Difficulty: medium
Interview Round: Technical Screen
# Choose Ranking Functions, Customer Value Metrics, and Predictive Models
A global e-commerce team asks three connected fundamentals: distinguish SQL ranking functions, define a high-value customer for a business decision, and compare linear regression, logistic regression, random forests, and gradient-boosted trees.
### Constraints & Assumptions
- Ranking examples can contain ties and require deterministic output.
- A high-value definition must specify horizon, margin or revenue, retention, and refunds.
- Model choice depends on whether the target is continuous or binary.
- Historical customer behavior can leak future information if features use the outcome window.
### Clarifying Questions to Ask
- Should tied rows share a rank, and may ranks contain gaps?
- What action will the high-value segment trigger?
- Is interpretability, probability calibration, or raw predictive accuracy the main model requirement?
### Part 1 — Ranking functions
Explain ROW_NUMBER, RANK, and DENSE_RANK with a tied example and state the extra ordering needed for deterministic ROW_NUMBER.
#### What This Part Should Cover
- Tie behavior and rank gaps
- Partition and order definitions
- A unique tie-break for deterministic selection
### Part 2 — High-value customers
Define a label or score that reflects durable economic value rather than recent order count alone.
#### What This Part Should Cover
- Contribution margin, horizon, and refund treatment
- New-versus-existing customer comparability
- A validation plan tied to the downstream action
### Part 3 — Model families
Compare linear and logistic regression with random forests and gradient boosting, then propose a leakage-safe evaluation.
#### What This Part Should Cover
- Target and loss compatibility
- Linearity, interactions, calibration, and regularization
- Temporal split and actionable metrics
### What a Strong Answer Covers
- Definitions with examples
- Economic and statistical alignment
- Leakage and calibration controls
```hint Start from the downstream decision
Ranking semantics, customer value, and model evaluation all change when the output is used for one winner, a tiered list, a budget-limited campaign, or an estimated probability.
```
### Follow-up Questions
- How would you evaluate value among customers too new for a long horizon?
- When is DENSE_RANK preferable to RANK?
Quick Answer: A machine-learning and analytics fundamentals interview covering SQL ranking functions, defensible high-value-customer definitions, and model selection across linear, logistic, random-forest, and gradient-boosted approaches.