← All work

03 / 08 · Big data · Nov 2024

NYC Taxi

Big Data Analytics

I cleaned 10 years of New York taxi data and built a model that predicts trip fares.

At a glance
~1B
trip records processed
0.873
R² on fare prediction (1.0 is perfect)
$7.63
RMSE (baseline $23.05)
91%
fares within $8

Built with

PySpark · Databricks · Spark SQL · Python · MLlib

Test RMSE in $ · lower is better

  • Linear Regression 47.82
  • Dummy baseline 23.05
  • XGBoost 7.64
  • CatBoost 7.63

Fares within $8 → XGBoost 91.28% · CatBoost 90.56% · R² 0.87

Case study

Cleaned and modelled ~1 billion NYC taxi trips (2014–2024) on Databricks, then predicted fares within $8 for 91% of trips.

The problem

Ten years of New York yellow and green taxi data is several terabytes of Parquet files. The schemas change between years, the data is full of errors, and it’s far too large for a laptop. The questions were simple: when, where and how much? Getting reliable answers at that scale was the hard part.

The data

About 1 billion trip records from 2014 to 2024, covering both yellow and green taxis, with schemas that changed over the decade.

The approach

  • Unified the schemas across a decade of files and processed them with distributed PySpark on Databricks.
  • Built multi-check data validation and found 70–80 million invalid records (7–8% of the data): negative fares, impossible distances and broken timestamps.
  • Engineered 20+ features and trained fare-prediction models with a time-aware train/test split.
  • Ran Spark SQL analytics on peak hours, top revenue routes and tipping behaviour.

The result

  • RMSE of $7.63, against a $23.05 baseline: a 66% improvement.
  • R² of 0.873, with 91% of predictions within $8 of the real fare.
  • Insights: trip volume peaks between 6 and 8 PM, about 65% of trips include a tip, and I ranked the top 10 routes by revenue share for 2024.

What I’d do next

Stream the newest monthly drops automatically and serve the fare model behind an API.