Skip to main content
airTravelModel is a Python library that predicts transportation cost and travel time across U.S. domestic routes — air, drive, bus, and train — through a single unified API.

What it does

Given an origin and destination (airport codes, city names, or coordinates), TransportPredictor returns fare and time estimates for every transport mode, using ensemble ML models trained on real schedule and ticket data.
from air_travel_model import TransportPredictor

tp = TransportPredictor()
results = tp.predict_all("CHS", "ROA", quarter=2)
# {
#   "air_fare":   291.81,   # USD
#   "air_time":    59.0,    # minutes
#   "drive_time": 454.0,    # minutes
#   "drive_fare":  46.25,   # USD
# }

Models at a glance

ModeOutputTraining data
Air fareEconomy / business fare (USD)0.92BTS DB1B 2023–2025
Air timeBlock time (minutes)0.94BTS T-100 2023–2025
Drive timeDoor-to-door drive time (minutes)0.99OSRM / OpenStreetMap
Drive fareFuel cost estimate (USD)Formula-based
Bus fareIntercity fare (USD)Calibrated heuristic
Bus timeIntercity travel time (minutes)Calibrated heuristic
Train timeAmtrak travel time (minutes)0.99Amtrak GTFS
All models fall back gracefully to calibrated heuristics for routes outside the training distribution.

Design

  • Single entry point: TransportPredictor — no need to import individual predictors.
  • Ensemble architecture: each trained model is either HistGradientBoosting, RandomForest, or an average ensemble — whichever scored best on validation.
  • Graceful degradation: predict() uses ML with OSRM/heuristic fallbacks; estimate() always returns a value.
  • Mountainous terrain aware: drive time for routes not in training data queries OSRM live rather than using straight-line (haversine) distance, which would dramatically underestimate travel time on winding mountain roads.
  • Extensible: abstract BaseTrainer / BasePredictor make it straightforward to add new modes.