Labs

Guided Python practice with real traffic data, run right in your browser, with nothing to install.

New to notebooks? Start with How to do a lab: five minutes, with pictures.

Each lab is a guided notebook that runs right here in your browser. Labs are practice: not graded, nothing to submit. Labs 1–2 are open to everyone; the rest are shared with enrolled students during the semester. Every task has a level: 🌶 Core, done together in class; 🌶🌶 Extend, optional, at home; 🌶🌶🌶 Challenge, optional, for the curious.

For more trajectory data to explore on your own, see Traffic Data.

Each lab stands on its own. Labs use trafficlab, the course’s own Python package, which grows over the semester into a complete traffic simulator.

TipComing up in the labs
  • Lab 5 · The Fundamental Diagram, and the Wave It Predicts. Fit the diagram to real detector data by least squares and with a small neural network, test both beyond the data, then check the wave it predicts against a wave measured on real trajectories. (with Lecture 5)
  • Lab 6 · Shock Waves and the Slow Truck. Code a solver for shock waves, check it against your hand calculations, then build the slow truck and reproduce what a detector downstream sees. (with Lecture 6)
  • Lab 7 · Build Your Own Freeway (and Debug an AI-Written One). A cell transmission model with a lane drop, checked against hand solutions and conservation. Then find the bugs in a model written by an AI assistant. (with Lecture 7)
  • Lab 8 · Teach a Car to Drive: IDM and MOBIL. Write a driver and a lane-change rule, plug them into a small simulator, and check them against theory. (with Lecture 8)
  • Lab 9 · Phantom Jams for Real, and an AI Driver. Measure a real phantom jam on a ring road with 22 cars, reproduce it with your driver model, then train an AI driver on the real drivers and put it through three exams. (with Lecture 9)
  • Lab 10 · How Sure Are We? Put error bars on a fundamental diagram fitted to detector data and a driver model fitted to real ring-road drivers, and find the parameter the data cannot see. (with Lecture 10)
  • Lab 11 · Beat the “No Change” Forecast. Forecast freeway speeds 5 to 60 minutes ahead from real detector data, and try to beat the simplest forecast of all: traffic stays as it is. Where does machine learning really help? (with Lecture 11)
  • Lab 12 · One Smart Car. Mix one reinforcement-learning car with rule-following cars on a jammed ring road: can it smooth the jam? Catch it gaming its reward, fix the reward, and test it on traffic it has never seen. (with Lecture 12)
Lab What you'll do
Lab 1 · Phantom Jams on Your Laptop Practice · reproduce the 1959 GM experiment · local and string stability · when a platoon collides
Lab 2 · Real Traffic from Above Practice · NGSIM trajectories · time-space diagrams · Edie’s definitions · a virtual loop detector
Lab 3 · From Video to Trajectories Practice · clean real AI tracker output · physics checks · joining fragments · what cleaning changes
Lab 4 · Fix the Data Practice · is this sensor real? · does the bridge keep its cars? · spot the detector that lies · catch planted faults · travel times from the future
No matching items