Project 03

Traffic incident hotspot analyzer

Traffic incidents in Calgary cause delays, economic losses, and safety hazards. This project applies spatial clustering and temporal classification to 60K+ traffic incidents to identify high-risk hotspots and predict peak-incident periods.

DBSCAN Gradient Boosting Spatial clustering Calgary open data 60K incidents
80% Accuracy (Gradient Boosting)

Streamlit dashboard pages

Hotspot map

Interactive map of Calgary with DBSCAN-identified incident clusters and density overlays

Temporal analysis

Hourly, daily, and seasonal patterns with rush-hour flags and weekend indicators

03

Cluster profiles

Detailed breakdown of each spatial cluster by incident type, severity, and timing

04

Peak predictor

Predict whether a given time window will experience peak incident volume

Key results

80%
Accuracy
Gradient Boosting classifier
0.77
Cross-validated F1
5-fold stratified CV
60K+
Traffic incidents
Real-time Calgary data

Methodology

Fetched real-time traffic incident data from Calgary Open Data. Applied DBSCAN with haversine distance for spatial clustering alongside KMeans. Engineered cyclical time features, rush-hour flags, and weekend indicators. Trained Random Forest and Gradient Boosting classifiers for temporal peak prediction, evaluated with accuracy, precision, recall, F1, and 5-fold cross-validated F1.

01 Fetch 60K traffic incidents
02 DBSCAN spatial clustering
03 Engineer cyclical time features
04 Train temporal classifiers
05 5-fold cross-validation
06 Deploy Streamlit dashboard