Skip to main content

Design an ETA Prediction System

Design a system to predict estimated time of arrival for a maps/navigation application.

Requirements

Functional:

  • Predict travel time between two points
  • Support driving, walking, transit
  • Update ETA during trip
  • Handle different traffic conditions

Non-functional:

  • Prediction latency < 100ms
  • Handle millions of requests/minute
  • Accuracy within 10% of actual time

Metrics

MetricDescription
MAPEMean Absolute Percentage Error
MAEMean Absolute Error (minutes)
% within X%Predictions within X% of actual

Architecture

Loading diagram...

Features

CategoryFeatures
RouteDistance, number of turns, road types, traffic signals, intersections
TrafficCurrent speed on segments, historical speed by time, real-time incidents, events, weather
ContextTime of day, day of week, holidays, special events

Model

Segment-Level Prediction

Loading diagram...
ComponentInputOutput
Base TimeSegment distance, speed limitTime in ideal conditions
Traffic FactorSegment ID, current speed, time of dayMultiplier (0.5 to 3.0)
Final PredictionBase time, traffic factorAdjusted segment ETA

Graph Neural Network Approach

Model road network as graph, propagate traffic information:

Loading diagram...
LayerPurposeOutput
InputSegment featuresRoad characteristics
GCN Conv 1Aggregate neighbor info64-dim embeddings
GCN Conv 2Higher-order patterns32-dim embeddings
PredictorSpeed predictionPredicted speed per segment

Real-Time Updates

During trip, the system continuously refines predictions:

Loading diagram...
StepCalculationPurpose
1. Track progressCompare actual position to routeKnow completed segments
2. Calculate correctionActual time / Predicted timeLearn from real performance
3. Apply to remainingRemaining ETA x Correction factorAdjust future predictions
4. Incorporate new dataFresh traffic data for remaining routeAccount for changing conditions

Reference

TopicDescription
Sparse dataMost roads have no traffic sensors. Infer from GPS traces of drivers on those routes.
IncidentsAccidents change predictions significantly. Detect and incorporate quickly through real-time data.
EventsStadium emptying creates surge traffic. Model known events separately.
Route changesUser deviates from suggested route. Recalculate remaining ETA based on new path.