Predict Tip Percentage
Company: Capital One
Role: Software Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Online Assessment
# Predict Tip Percentage
Create a derived target for tip as a percentage of total fare, then design and evaluate a predictive model for that target using green-taxi trip records. Explain feature timing, data cleaning, validation, performance metrics, and limitations.
### Constraints & Assumptions
- Define behavior when total fare is zero, negative, missing, or internally inconsistent.
- Do not use information unavailable at the intended prediction time.
- Tip recording may depend on payment type, so missing or zero tips may not mean the same thing for every trip.
### Clarifying Questions to Ask
- Is prediction made before pickup, during the trip, or after fare calculation?
- Does total fare include the tip, and should the denominator instead be pre-tip charges?
- Is the goal point prediction, ranking, or identifying likely high-tip trips?
```hint Audit the target before modeling
The denominator and payment mechanism can create extreme values, censoring, or leakage before any model is trained.
```
### What a Strong Answer Covers
- A precise target and invalid-denominator policy.
- Leakage-safe features and temporal or grouped validation.
- Simple baselines, suitable losses and metrics, and calibration or residual analysis.
- Segment performance, interpretability, and responsible use.
### Follow-up Questions
- How would you model the large mass at zero?
- What drift would you expect if payment behavior changes?
Overview: Derive tip as a percentage of total fare, build a predictive model for that target, estimate performance on an appropriate sample, and explain the methodology and results.