DS-GA 3001 - Fall 2026 - Seven Months of NYC Taxi Passengers
NYU Center for Data Science
2026-11-17
| Minutes | |
|---|---|
| Open the notebook, load the data | 3 |
| Part 1: see the series (Experiments 1-2) | 14 |
| Part 2: evaluate a forecaster (Experiments 3-4) | 13 |
| Part 3: find anomalies (Experiments 5-6) | 13 |
| Debrief and project check-in | 7 |
Experiment 4 is optional if we run short.
Notebook: time_series.ipynb on Colab
Experiments 1 and 2 · about 14 minutes
The same 10,320 numbers as a line, as daily totals, and as a heat map.
Predict: the first chart draws all 10,320 half-hour values as one line. What will you be able to read from it?
START in the one-week chart. What does a normal week look like?Connect to lecture: aggregation is a design decision. Each bin size shows some things and hides others.
Predict: one row per day, one column per half hour, color for passengers. What will a weekend look like? What will a snowstorm look like?
Connect to lecture: heat maps put time on both axes here, so the cyclic structure (hour of day) and the sequential structure (date) are visible together.

Experiments 3 and 4 · about 13 minutes
Train on July to September. How good will the model be in October?
Predict: the model gets hour of day, weekday and a time index (days since July 1). Which estimate will be closest to its real error in October: random 5-fold or time-ordered 5-fold? Will the random estimate be too high or too low?
USE_TIME_INDEX = True. Compare the three barsUSE_TIME_INDEX = False and run again. What happened to the gap?Connect to lecture: a random split asks the model to interpolate between neighbors. Forecasting is extrapolation.
Mean absolute error, in passengers per 30 minutes:
| Features | Random | Time-ordered | Real October |
|---|---|---|---|
| hour, weekday, time index | 553 | 1,419 | 837 |
| hour, weekday | 1,127 | 1,248 | 1,239 |

Time-ordered 5-fold prefers the wrong model: 1,248 beats 1,419, but in October 837 beats 1,239.
Time-ordered 5-fold, model with the time index:
| Fold | Trained on | Tested on | MAE |
|---|---|---|---|
| 1 | 15 days | Jul 16 to Jul 31 | 1,457 |
| 2 | 31 days | Jul 31 to Aug 15 | 708 |
| 3 | 46 days | Aug 16 to Aug 31 | 834 |
| 4 | 61 days | Aug 31 to Sep 15 | 3,039 |
| 5 | 77 days | Sep 15 to Sep 30 | 1,058 |
| Deployed | 92 days | Oct 1 to Oct 31 | 837 |
Respecting time makes an evaluation plausible. It does not guarantee an accurate estimate, or the right ranking of two models.
Make the rehearsal look like the deployment: enough training history, the same horizon, and the error per fold.
Predict: a model that only knows the hour of day. What will its October residuals look like by weekday?
Connect to lecture: plot residuals against the cyclic structure. Structure in the residuals is something the model missed.
Too low on weekend nights, too high on weekend mornings: the model does not know what day it is.
Experiments 5 and 6 · about 13 minutes
Expected value, a band around it, and a threshold you have to choose.
Predict: expected passengers = the median for that weekday (learned from July to October). Flag a day when it is more than K robust standard deviations away. With K = 3, how many of the 215 days get flagged?
K = 3. Are your two dates from Experiment 1 in the list?K = 2, 4 and 5. How many days would you want to be alerted for?Connect to lecture: the threshold is a trade-off, and neighboring alarms are often one event.
All five benchmark windows contain a flagged day at K = 3. January 1 itself, at −2.1σ, is not flagged; January 2 is.
Predict: New Year’s Day has a nearly normal daily total. What does it look like half hour by half hour?
DAY = "2015-01-01""2014-11-02". The largest value in the whole series is on that night. What do you think happened at 2 am on November 2, 2014, and what evidence would confirm it?"2015-01-27"Connect to lecture: a contextual anomaly. Every value is in range; it is the time of day that is wrong.
A busy night and a quiet day nearly cancel in the daily total.
Project check-in: final presentations are Dec 1 and Dec 8. Use the remaining time for questions about your project.
TimeSeriesSplit