ayanjawed commited on
Commit
abf8393
·
verified ·
1 Parent(s): 6e2581a

Add TransitPulse planning model and model card

Browse files
Files changed (2) hide show
  1. README.md +66 -0
  2. planning_model.joblib +3 -0
README.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: sklearn
3
+ tags:
4
+ - tabular-regression
5
+ - time-series
6
+ - transportation
7
+ license: other
8
+ ---
9
+
10
+ # TransitPulse planning model
11
+
12
+ Predicts **hourly bus ridership for one route** (riders per route-hour) from information known in advance:
13
+ route, date, hour, schedule and weather. Built for transport planners as a CT-378 Machine Learning course project.
14
+
15
+ - Live demo (Hugging Face Space): https://huggingface.co/spaces/ayanjawed/TransitPulse
16
+ - Code, data builder and notebooks: https://github.com/ayanmirza99/ML-Project
17
+
18
+ ## Intended use
19
+ - What-if planning for the 24 MTA bus routes it was trained on, for dates from 2025-01-06 to 2025-09-28.
20
+ - **Not** for other routes, other cities or dates outside that period (see Limitations).
21
+
22
+ ## Model
23
+ `sklearn.pipeline.Pipeline`: one-hot encoding of `bus_route` and `borough`, then `HistGradientBoostingRegressor`
24
+ (learning_rate 0.05, max_iter 500, max_leaf_nodes 63). Selected by validation MAE among models whose saved file is under 50 MB;
25
+ a Random Forest was about as accurate but about 110 MB.
26
+ Input columns: bus_route, borough, gtfs_n_stops, gtfs_max_stops_per_trip, sched_trips_hr, sched_headway_min, sched_trips_day,
27
+ temperature_2m, precipitation, snowfall, wind_speed_10m, hour, day_of_week, is_weekend, hour_sin, hour_cos, is_am_peak, is_pm_peak,
28
+ is_holiday, is_school_day.
29
+
30
+ ## Data (three sources plus calendar)
31
+ 1. **MTA Bus Hourly Ridership: Beginning 2025**, NY Open Data (dataset id `gxb3-akrn`), summed to one row per route per hour.
32
+ Licence: the dataset page gives no licence information; it is covered by NY Open Data's terms of use.
33
+ 2. **MTA GTFS static bus schedules** (mta.info/developers). A 2026 snapshot, not the 2025 service that produced the ridership.
34
+ 3. **Open-Meteo historical weather** (New York City coordinates, one value per hour for the whole city).
35
+ 4. US federal holidays (Python `holidays` package) and a hand-typed, approximate NYC school calendar.
36
+
37
+ Eight two-week windows between January and September 2025, 24 routes, 64,512 route-hour rows. Missing hours are filled with 0 riders.
38
+ Data are from New York because Karachi has no public passenger-count data.
39
+
40
+ ## Evaluation
41
+ Time-ordered split by whole days: train 2025-01-13 to 07-14, validation 07-15 to 09-04, test 09-05 to 09-28 (17 days, scored once).
42
+ The final model is refit on train plus validation before testing.
43
+
44
+ | | MAE (riders) | RMSE | R2 |
45
+ |---|---|---|---|
46
+ | Planning model (this model) | 65.4 | 113.3 | 0.92 |
47
+ | Baseline: training average for the route, hour and weekday/weekend | 78.0 | 129.4 | 0.89 |
48
+
49
+ The average route-hour in the test period has 450 riders, so the error is about 14.5%.
50
+ A separate history model (uses recent ridership) reaches MAE 39.0 but needs recent data, so it is not deployed.
51
+ Other checks: leave-one-window-out MAE 53.0 vs baseline 68.9; unseen routes MAE 111 vs baseline 132.
52
+
53
+ ## Limitations
54
+ - Only 24 routes and eight 2-week windows in one year; the test set is only 17 days, so small differences are not meaningful.
55
+ - Some routes changed level during the year (Q58, Q10, Q65 about 35% lower; Q25 about 32% higher from summer). The model does not know about service changes; its error on these routes is about three times larger.
56
+ - Weather helps a little, but partly because it hints at the season. It is not evidence that weather causes ridership changes.
57
+ - Weather was one city-wide value, and the test used recorded (not forecast) weather, so real use will have higher error.
58
+ - Schedule data is a 2026 snapshot; the school calendar is approximate; licence wording was not independently checked.
59
+ - New York data only; no claim is made about Karachi.
60
+
61
+ ## How to load
62
+ ```python
63
+ import joblib
64
+ model = joblib.load("planning_model.joblib") # needs scikit-learn 1.9.1
65
+ ```
66
+ The input row must contain the columns listed above (see `features.py` in the project repository).
planning_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:829a2f16c03588bc1709920885e7a0d61bf1e159a166fe0b917350be109f1e0d
3
+ size 1533426