Traffic prediction sounds like magic until you look at what it is actually built from: a very large number of small, boring measurements.
Every ping is a data point
Each participating vehicle reports its position, speed, heading and time. Individually, that tells you almost nothing — one matatu moving slowly could be stuck behind a broken-down truck, loading passengers, or simply idling at a stage. Aggregated across a corridor, though, those pings describe traffic as it actually is right now.
That distinction is the whole game. A single reading is anecdote. A distribution of readings is evidence.
From pings to corridors
The pipeline runs in four stages:
- Ingest. Vehicles and commuter devices submit location updates. Updates that are stale, physically impossible or obviously duplicated are discarded.
- Match. Each position is snapped to the corridor and direction of travel it belongs to, so a southbound jam is never confused with northbound free flow.
- Aggregate. Speed and density readings are combined per corridor to produce a live congestion level, smoothed so that one outlier does not spook the model.
- Estimate. Travel times are derived for the route you asked about, with a confidence band attached rather than a single confident-looking number.
Why stale data is worse than no data
Congestion in Nairobi can build and clear within twenty minutes. A reading that was accurate an hour ago is actively misleading — it will send you towards a corridor that has already cleared or, worse, towards one that has just failed. This is why freshness is tracked as carefully as accuracy, and why recent observations carry more weight than older ones.
A traffic model that cannot forget is a traffic model that lies.
Learning the city's rhythm
On top of live data, the system learns recurring patterns: which corridors slow down first on a rainy Tuesday, where the morning peak genuinely starts, how long a bottleneck usually takes to clear. Those patterns form a baseline. Live data then pushes the baseline up or down depending on what is actually happening.
The result is a forecast that is honest about its limits. When conditions match every previous Tuesday, confidence is high. When a new jam appears on a corridor that is normally clear, the system says so, and treats the estimate as provisional.
What it is not
It is not a promise that you will avoid traffic. It is not a claim to see the future. And it is not a substitute for local knowledge — a driver who knows that a stage loads for fifteen minutes at 6 PM is still the best sensor on the road.
What it is, is a way to stop making decisions blind. If you know a corridor is already failing, you can leave earlier, route differently, or choose a different stage. That is worth more than an elegant model that arrives at your stage after you do.
Discussion
Markdown supported. Be kind. 🤝