skip to content

Grab ETA Prediction

archived

Predicted ride ETA for Singapore car trips at the Microsoft Azure Virtual Hackathon — engineered congestion, distance, and time features, trained a model on Azure ML, and served predictions via a Flask API on Heroku.

writeup onlyhackathonmachine learningdata analyticspredictive modeling
built: 2020
  1. Built for the Microsoft Azure Virtual Hackathon, Grab Challenge — predicting ride ETA for Singapore car trips. Team Teh Cino, Phase II.

the challenge

Given an origin, a destination, a departure time, and a day of the week: predict how long the trip will take. The judging dataset was real Singapore Grab car rides from the Grab-Posisi GPS trajectory dataset.

the team

Team Teh Cino: Nicholas Tan (SUTD, Engineering Systems and Design — data science and analytics), Filbert Cia (SUTD, Information Systems Technology and Design — backend development and algorithm design), and me (NTU postgrad, end-to-end data science project implementation).

feature engineering

The raw inputs — lat/lon pairs, hour, day — aren't enough on their own. We engineered five features:

Euclidean distance (eud_dist) — unitless straight-line distance between origin and destination coordinates.

Haversine distance (haversine) — great-circle distance in km using the Python haversine module. More geographically accurate than Euclidean, though it turned out to matter less to the model.

Traffic congestion (congestion) — a lookup table of congestion indices keyed by day_of_week and hour_of_day, derived from TomTom's Historical Traffic Data 2019 for Singapore. Hand-crafted rather than learned — the idea being that Singapore's traffic patterns are stable enough to encode directly.

is_day — whether the trip started during daytime, defined using Singapore's Highway Code: 7pm–7am is legally night (drivers must use headlights). Night trips are slower.

is_weekend — whether the trip fell on Saturday or Sunday, based on Phase I EDA showing lower traffic on weekends.

experiments

We ran four experiments across Azure Pipeline ML and Azure AutoML:

ExperimentAlgorithmRMSE
Azure Pipeline ML (Linear Regression)Linear Regression279.31
Azure AutoML — all features, no optimisationStackEnsemble252.78
Azure AutoML — optimised, excludes lat/lon differencesStackEnsemble235.17
Azure AutoML — excludes lat/lon, is_day, is_weekendVotingEnsemble~228.21

The fourth experiment had the lowest raw RMSE, but we chose the third as our final model — removing is_day and is_weekend felt like overfitting since they're valid real-world features.

best model

Azure AutoML StackEnsemble — RMSE: 235.17

Registered as AutoML369f0744146:1, deployed as tehcino-grab-model.

feature importance

In order of decreasing importance for the best model:

  1. day_of_week
  2. euclidean_distance
  3. congestion
  4. haversine_distance
  5. start_hour
  6. dest_lat
  7. origin_lat
  8. origin_lon
  9. dest_lon
  10. is_day
  11. is_weekend

Notable: day_of_week dominated — each day has unique traffic characteristics. euclidean_distance ranked above haversine_distance, which was counterintuitive. The congestion score improved the model meaningfully. is_day and is_weekend ranked last but were kept as valid domain features.

architecture

Azure AutoML trained and registered the model → deployed via Azure AutoML Endpoint Service → Flask REST API on Heroku preprocessed incoming requests, assembled feature vectors, called the Azure scoring endpoint, and returned ETA predictions in seconds.

The API ran on Heroku's free tier, which has since been retired, so the endpoint is no longer live.

Source on GitHub.