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.
Models at a glance
| Mode | Output | R² | Training data |
|---|---|---|---|
| Air fare | Economy / business fare (USD) | 0.92 | BTS DB1B 2023–2025 |
| Air time | Block time (minutes) | 0.94 | BTS T-100 2023–2025 |
| Drive time | Door-to-door drive time (minutes) | 0.99 | OSRM / OpenStreetMap |
| Drive fare | Fuel cost estimate (USD) | — | Formula-based |
| Bus fare | Intercity fare (USD) | — | Calibrated heuristic |
| Bus time | Intercity travel time (minutes) | — | Calibrated heuristic |
| Train time | Amtrak travel time (minutes) | 0.99 | Amtrak GTFS |
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/BasePredictormake it straightforward to add new modes.