Predicting Traffic in the City of Buffalo Using a Neural Network

Published: (March 2, 2026 at 11:18 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Predicting Traffic in the City of Buffalo Using a Neural Network

Overview

Every year, transportation departments spend significant resources physically surveying roads to measure traffic. Many roads go unmeasured. We built a Neural Network that predicts whether any road in the Buffalo‑Niagara region is Low, Medium, or High traffic — no survey needed.

What it does

Given a road’s location, type, direction, and region, the model instantly classifies its traffic level with 75 % accuracy (WIP). City planners can use this to prioritize road repairs and signal upgrades. Businesses can use it to evaluate street‑level traffic before opening a new location.

How we built it

We trained a feedforward Neural Network in PyTorch on 28,567 real road measurements from Open Data Buffalo. Key steps included log‑transforming AADT to handle skew, rule‑based feature engineering to reduce high‑cardinality columns like road names and municipalities, and adding a custom distance‑from‑Buffalo feature to capture spatial traffic patterns.

Challenges

The biggest challenge was handling high‑cardinality categorical columns with 80 + unique values. We solved this using domain‑driven binning — grouping road names into types (highway, avenue, street) and municipalities into geographic regions, which reduced noise and improved model convergence significantly.

Accomplishments

Crossed the 75 % accuracy threshold on unseen test data with a lean 4,515‑parameter model — proving that simple, well‑engineered features outperform complex architectures on structured tabular data.

What we learned

Feature engineering matters more than model complexity. Spending time cleaning and transforming the data — log transforms, geographic groupings, distance features — had a bigger impact on accuracy than changing the network architecture.

Built with

  • Python
  • PyTorch
  • Scikit‑learn
  • Pandas
  • NumPy
  • Matplotlib
  • Seaborn
  • Open Data Buffalo
0 views
Back to Blog

Related posts

Read more »