Detect Anomalous Trip Behavior
Company: Capital One
Role: Software Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Online Assessment
# Detect Anomalous Trip Behavior
Develop a process to identify days, times, or locations where green-taxi traffic or behavior deviates from its normal pattern. You may use time-series methods, clustering, or another justified approach. Explain how you validate anomalies and investigate possible causes without treating correlation as proof.
### Constraints & Assumptions
- Normal traffic has strong hour-of-day and day-of-week seasonality.
- Data outages, schema changes, and invalid records can look like real-world anomalies.
- The process should rank findings for review rather than guarantee a causal explanation.
### Clarifying Questions to Ask
- Which metric matters: trip count, fare, distance, speed, location mix, or several?
- What spatial and temporal resolution is actionable?
- Are known holidays, weather, or service incidents available for validation?
```hint Model expected behavior before residuals
A busy hour is not anomalous if that hour is normally busy; compare it with an appropriate seasonal baseline.
```
### What a Strong Answer Covers
- Metric, grain, data-quality checks, and seasonal baseline.
- Anomaly score and threshold tied to review capacity or impact.
- Backtesting, false-positive analysis, and robustness across methods.
- A disciplined path from detection to external evidence and explanation.
### Follow-up Questions
- How would you detect a gradual regime shift rather than a one-time spike?
- How would you prevent one data outage from triggering thousands of alerts?
Overview: Develop a time-series, clustering, or related methodology to identify anomalous trip behavior by day, time, or location and propose explanations for detected deviations.