KatInterview

Arrival-Time Prediction for a Ride-Share App: End-to-End ML Design

Machine LearningModel answer
MediumModel answerMachine Learningeta-predictionspatiotemporalmodel-design

Last updated

Design a machine learning system that predicts driver pickup time and trip duration, covering labels, features, models, metrics, bias, noise, serving, monitoring, and post-launch experiments.

You are a data scientist at a ride-sharing marketplace. The rider and driver apps both need to show time estimates, and you have been asked to design the prediction system behind them. There are two separate estimates:

  • Pickup time: how long until the assigned driver reaches the rider.
  • Trip time: how long the ride takes from pickup to drop-off.

Walk through how you would build this system from start to finish. Your answer should cover:

  1. Targets and labels: what exactly you predict, how you build ground truth, and how you clean it.
  2. Features: what is available at prediction time, including time, location, route, and live-traffic signals.
  3. Model choices: a baseline, a first production model, and a more advanced follow-up.
  4. Loss and metrics: the trade-offs between MAE, RMSE, MAPE, and quantile loss, and which you would pick for which use.
  5. Calibration: how you check and correct both average error and uncertainty ranges.
  6. Data problems:
    • bias from cancelled rides,
    • sudden traffic disruptions,
    • noisy GPS and map-matching errors,
    • sparse data in new or rarely visited areas.
  7. Serving: latency limits, fallbacks, retraining cadence, and monitoring.
  8. Experimentation: how you would test the system after launch and which guardrails you would watch.

State any assumptions you make about scale and product behavior.

Hints

Hint 1

Treat pickup and trip estimates as separate products with different consumers and different costs of being wrong. Then ask whether the model should predict raw duration or a correction on top of a routing engine's estimate.

Hint 2

A ride that was cancelled still tells you something: the true wait was at least as long as the time the rider waited. Think about censoring, and about the fact that dispatch only observes drivers who were chosen.

Hint 3

For metrics, ask which error each one punishes or hides (short trips for MAPE, bad labels for RMSE, asymmetry for quantile loss). For calibration, remember that a good global average can hide large errors in specific places such as airports.