This API provides predictive arrival times for MTA buses with uncertainty estimates. The predictions are made using XGBoost quantile regression models.
Fetches real-time MTA bus data and returns predicted arrival times with uncertainty intervals.
GET /api/predict?stop_id=308214
{
"stop_id": "308214",
"timestamp": "2025-04-27T14:30:45.123456",
"buses": [
{
"bus_id": "5462",
"route_id": "B48",
"trip_id": "trip_123456",
"distance": 450.5,
"stops_away": 2,
"predictions": {
"expected_arrival": 4.5,
"quantiles": {
"alphas": [0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95],
"values": [2.1, 2.8, 3.2, 3.5, 3.9, 4.3, 4.8, 5.3, 6.1, 7.4]
},
"prediction_intervals": {
"50%": [3.2, 5.3],
"80%": [2.8, 6.1],
"95%": [2.1, 7.4]
}
}
}
]
}