Skip to content

Latest commit

Β 

History

75 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš• TaxiIQ β€” Taxi Intelligence & Decision Support System

Stack: Python Β· FastAPI Β· React Β· Recharts Β· scikit-learn
Dataset: NYC Yellow Taxi Trip Data (2025–2026)


πŸ“Œ Overview

TaxiIQ is a full-stack Mobility Intelligence and Decision Support System built on top of NYC Yellow Taxi trip data. It goes far beyond a basic prediction notebook β€” it is an end-to-end operational platform that combines machine learning, spatial analytics, and real-time heuristics to help drivers, fleet managers, and operators make smarter decisions.

The system provides:

  • ETA prediction with uncertainty intervals and delay risk scoring
  • Transparent fare band estimation with explainable pricing drivers
  • A nearby price finder to identify cheaper pickup zones within a budget
  • Corridor reliability intelligence to detect delay-prone routes
  • Interactive spatial heatmaps for demand, speed, price, and volatility
  • Real-time ML model performance monitoring

πŸ—‚ Project Structure

taxi_project/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ full_pipeline.py          ← Run this first to download data, clean, and train models
β”‚   β”œβ”€β”€ train_clustering.py       ← Trains K-Means clustering for zone/corridor intelligence
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── app/
β”‚       β”œβ”€β”€ main.py
β”‚       └── routers/
β”‚           β”œβ”€β”€ predict.py        ← ETA + Price prediction APIs
β”‚           β”œβ”€β”€ analytics.py      ← Zone, Corridor, and Heatmap APIs
β”‚           └── nearby.py         ← Nearby Price Finder logic
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ plots/                    ← 17 auto-generated EDA plots
β”‚   β”œβ”€β”€ taxi_clean.parquet        ← Cleaned dataset
β”‚   β”œβ”€β”€ zone_metrics.parquet      ← Zone-level analytics
β”‚   β”œβ”€β”€ corridor_metrics.parquet  ← Corridor-level analytics
β”‚   └── zone_summary.parquet      ← Used by Nearby Price feature
β”œβ”€β”€ models_saved/
β”‚   β”œβ”€β”€ RandomForest.pkl
β”‚   β”œβ”€β”€ GradientBoosting.pkl
β”‚   β”œβ”€β”€ LinearRegression.pkl
β”‚   β”œβ”€β”€ metrics.json
β”‚   └── features.json
β”œβ”€β”€ frontend/
β”‚   └── src/
β”‚       β”œβ”€β”€ api/client.js
β”‚       └── pages/
β”‚           β”œβ”€β”€ Dashboard.jsx
β”‚           β”œβ”€β”€ ETASimulator.jsx
β”‚           β”œβ”€β”€ PriceSimulator.jsx
β”‚           β”œβ”€β”€ NearbyPrice.jsx
β”‚           β”œβ”€β”€ CorridorDashboard.jsx
β”‚           β”œβ”€β”€ ZoneHeatmap.jsx
β”‚           └── Admin.jsx
β”œβ”€β”€ start_windows.bat
β”œβ”€β”€ start_mac_linux.sh
└── render.yaml

⚑ Quick Start (3 Steps)

Step 1 β€” Backend Setup

cd backend
python -m venv .venv

# Windows
.venv\Scripts\activate

# Mac/Linux
source .venv/bin/activate

pip install -r requirements.txt

Step 2 β€” Download Data & Train Models

# Run from project root
python backend/full_pipeline.py
python backend/train_clustering.py

This will:

  • Download NYC Yellow Taxi 2025 & 2026 trip data
  • Clean and engineer features
  • Generate 17 EDA plots β†’ saved to data/plots/
  • Train three regression models: LinearRegression, RandomForest, GradientBoosting
  • Save trained models to models_saved/
  • Build zone-level and corridor-level analytics tables
  • Train K-Means clustering models for zone and corridor intelligence

⏳ Estimated time: 5–15 minutes depending on internet speed.

Step 3 β€” Run the Application

Terminal 1 β€” Backend:

cd backend
uvicorn app.main:app --reload
# Available at: http://localhost:8000
# Swagger docs: http://localhost:8000/docs

Terminal 2 β€” Frontend:

cd frontend
npm install
npm run dev
# Available at: http://localhost:5173

πŸ–₯ Dashboard Features

🏠 Home Dashboard (Dashboard.jsx)

The main overview page that displays live operational KPIs at a glance:

  • Average Trip Time β€” Median trip duration across recent trips
  • Average Speed β€” Traffic flow indicator in mph
  • Rush Hour Load β€” Percentage of trips occurring during peak hours
  • Trips Analyzed β€” Total cleaned trip records the models are trained on
  • Average Fare β€” Baseline fare across all zones
  • Price Spikes β€” Percentage of trips currently experiencing surge pricing
  • Traffic Status β€” Whether traffic is normal or elevated, with an estimated time to the next rush hour
  • Live Weather Widget β€” Current temperature, conditions, humidity, and wind speed for NYC
  • Quick Access Cards β€” One-click shortcuts to all major sections of the platform

⏱ ETA Simulator (ETASimulator.jsx)

An interactive form that predicts trip duration using a multi-model ensemble.

Inputs:

  • Trip distance (miles)
  • Pickup hour
  • Pickup and dropoff borough
  • Whether it is a weekend or rush hour

Outputs:

  • P50 ETA β€” The median (most likely) trip duration
  • P90 ETA β€” The worst-case duration estimate (90th percentile)
  • Confidence Score β€” A 0–1 score indicating how certain the model is
  • Delay Risk β€” Categorized as Low, Medium, or High based on corridor and time patterns
  • Intelligence Insights β€” Contextual notes explaining what is driving the prediction

This feature helps drivers plan shifts and gives passengers accurate arrival windows.


πŸ’΅ Price Simulator (PriceSimulator.jsx)

A tool for estimating the fare range for a given trip with full pricing transparency.

Inputs:

  • Pickup and dropoff zone
  • Trip distance
  • Hour of travel

Outputs:

  • Min–Max Fare Band β€” The expected price range for the trip
  • Pricing Drivers β€” Explainable factors such as zone demand, congestion, and airport surcharges
  • Surge Spike Indicator β€” Whether the current supply/demand ratio is causing a price spike

This feature supports dynamic pricing management and helps passengers understand why a fare is what it is.


πŸ“ Nearby Price Finder (NearbyPrice.jsx)

A key differentiating feature that helps users find cheaper pickup alternatives near their current location with real-time budget intelligence.

How to use:

  1. Type any NYC zone name β€” autocomplete is supported
  2. Optionally enter a maximum budget in USD
  3. Click Find Cheapest Nearby Zones

Key Logic & Smart Alerts:

  • Live System Integration β€” Passes current hour to backend for time-sensitive pricing
  • Budget Auto-Fix β€” If no zones match your budget, it automatically suggests the nearest available options
  • Price Threshold Alerts β€” Notifies users if prices are high (>$20) or "Too Much" (>$50)
  • Visual Mapping β€” See cheaper alternatives as interactive markers on the map
  • Live Status Badge β€” Pulse indicator showing real-time connectivity to the intelligence layer

πŸ—Ί Zone Heatmap (ZoneHeatmap.jsx)

An interactive spatial map that visualizes trip metrics across all 260+ NYC taxi zones.

Switchable metrics:

  • Activity β€” Trip volume and demand density by zone
  • Price β€” Average fare per zone
  • Speed β€” Average traffic speed indicating congestion levels
  • Volatility β€” Risk of price or duration variation within a zone

This feature helps operators identify "hot zones" where demand is high but vehicle availability is low, enabling strategic repositioning to maximize utilization.


πŸ›£ Corridor Intelligence (CorridorDashboard.jsx)

A detailed route-level analysis panel for understanding the reliability of specific Pickup β†’ Dropoff pairs.

Data provided per corridor:

  • Trip Volume β€” How frequently this route is taken
  • Delay Ratio β€” How much slower the route is compared to the theoretical fastest case
  • Status Labels β€” Automated classification as Reliable, Volatile, or Slow based on K-Means clustering

Charts and filters:

  • Sort corridors by volume, delay ratio, or volatility
  • View historical delay patterns over time
  • Identify bottleneck corridors that consistently underperform

This feature allows drivers to choose alternate routes and set appropriate time buffers for known unreliable corridors.


🚦 Live Route Tracker

Displays real-time route conditions for active corridors, combining historical analytics with live traffic heuristics to flag routes that are currently performing below expected baselines.


πŸ”₯ Busy Areas Map

A high-level spatial view highlighting zones with above-average demand at the current time of day, updated dynamically based on historical patterns for the current hour and day of week.


πŸ“Š Route Overview

A summary view of all major corridors in the system, ranked and filterable. Provides a comparative snapshot of route performance without diving into the full Corridor Intelligence detail panel.


βš™οΈ Admin Controls (Admin.jsx)

A monitoring panel for technical oversight of the underlying ML models.

Metrics displayed:

  • MAE (Mean Absolute Error) β€” Average prediction error in minutes
  • RMSE (Root Mean Square Error) β€” Penalizes large prediction errors more heavily
  • RΒ² Score β€” Overall explanatory power of the model (closer to 1.0 is better)

These metrics are shown per model (Linear Regression, Random Forest, Gradient Boosting) so the team can identify when a model needs retraining.


🧠 Machine Learning Models

Model Description
Linear Regression Baseline model for interpretability
Random Forest Ensemble of 150 decision trees with max depth 12
Gradient Boosting 150 estimators with a learning rate of 0.1
K-Means Clustering Intelligence layer for zone, corridor, and time-based segmentation

Features used for prediction: trip_distance, pickup_hour, pickup_weekday, is_weekend, is_rush_hour, pickup_is_manhattan, dropoff_is_manhattan, pickup_is_airport, dropoff_is_airport, congestion_factor, corridor_volatility, pickup_month, speed

Prediction output fields:

  • eta_p50 β€” Median trip duration estimate
  • eta_p90 β€” Worst-case trip duration estimate
  • confidence β€” Model confidence score (0–1)
  • delay_risk β€” Low / Medium / High classification

πŸ“Š EDA Plots Generated (17 Total)

The pipeline auto-generates the following exploratory data analysis plots, saved to data/plots/:

  1. Trip Duration Distribution
  2. Speed Distribution
  3. Duration by Hour of Day
  4. Demand by Hour
  5. Weekend vs Weekday Duration
  6. Average Duration by Borough
  7. Top 10 Pickup Zones
  8. Top 10 Delay-Prone Zones
  9. Top 10 Slowest Corridors
  10. Most Unstable Corridors
  11. Price vs Distance
  12. Price / Expected Ratio
  13. Price by Traffic Level
  14. Delay vs Traffic Level
  15. Duration Variability by Hour
  16. Model Residuals
  17. Feature Importances

πŸ”Œ API Endpoints

Method Endpoint Description
POST /api/predict-eta Returns ETA P50, P90, confidence score, and delay risk for a given trip
POST /api/estimate-price Returns fare band, explainable pricing drivers, and spike indicator
GET /api/nearby-price?zone=Midtown&budget=30 Returns cheapest nearby zones ranked by savings
GET /api/zone-stats Returns analytics for all 260+ NYC taxi zones
GET /api/corridor-stats Returns route-level delay, volume, and reliability metrics
GET /api/heatmap-data?metric=avg_price Returns spatial metric data for the heatmap
GET /api/eda-summary Returns summary statistics from the cleaned dataset
GET /api/model-metrics Returns MAE, RMSE, and RΒ² for all trained models
GET /api/zone-list Returns all zone names for autocomplete fields

Full interactive documentation is available at http://localhost:8000/docs (Swagger UI) after starting the backend.


🎯 Key Benefits

  • Operational Efficiency β€” Reduce empty cruising time by moving vehicles toward demand zones
  • Revenue Optimization β€” Identify best-paying zones and time windows
  • Customer Satisfaction β€” Provide accurate ETAs and transparent fare breakdowns
  • Data-Driven Strategy β€” Replace intuition-based driving with intelligence-backed routing

πŸš€ Future Extensions

  • Real-time traffic feed integration for live corridor updates
  • Quantile regression for statistically improved prediction intervals
  • Automated model retraining pipeline triggered by performance degradation
  • User authentication with saved routes and personalized history
  • Live monitoring alerts for price spikes and corridor failures

πŸ›  Tech Stack

Layer Technology
Backend Python, FastAPI, uvicorn
ML / Data scikit-learn, pandas, NumPy, pyarrow
Frontend React, Vite, Recharts
Deployment Render (backend), Vercel (frontend)
Data Format Parquet (efficient columnar storage)

πŸ“ Additional Documentation


Dashboard

image

Demo video

https://drive.google.com/file/d/1E7VeSW8hYbZrXloq4_AOp9qm7nJGcvtO/view?usp=sharing

Built by Surbhi Agarwal & Triveni Reddy | NYC Taxi Intelligence Platform

About

A full-stack Mobility Intelligence and Decision Support System that predicts ETA (Estimated Time of Arrival) with uncertainty, estimates transparent price bands, explains pricing behavior, detects delay-prone corridors, and provides interactive spatial dashboards for monitoring mobility patterns.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages