Reliable short-term traffic forecasting is a core requirement for smart-city mobility management because congestion affects travel time reliability, signal control, routing, safety, and local air quality. This study develops a multi-location, multi-step forecasting framework for hourly urban traffic prediction in Trondheim, Norway, using data from six fixed traffic sensors combined with synchronized weather observations. The empirical design uses hourly passenger-car counts collected from December 2018 through January 2020, merged with meteorological variables and calendar-derived seasonality indicators. After data fusion, missing-value treatment, feature selection, and time-lag restructuring through a 24 h sliding window, a direct forecasting strategy is implemented for a 24-step horizon. The modeling framework compares a broad set of machine-learning and deep-learning regressors, beginning with 17 one-step-ahead candidates and then retaining the seven best-performing ensemble tree-based models for full multi-step forecasting, while recurrent neural networks are trained in parallel for comparison.
The results show that interpretable ensemble tree-based methods dominate across the Trondheim case study. For the first forecasting step, Extra Trees achieves the highest accuracy in all six locations, with R2 values of 98.16%, 97.64%, 94.76%, 95.12%, 97.31%, and 96.22%, respectively. Across the full 24 h horizon, model accuracy declines gradually with increasing lead time, but ensemble tree-based models remain consistently stronger than the tested recurrent neural networks. Extra Trees and Random Forest perform especially well at longer horizons, whereas Histogram-Based Gradient Boosting Regressor and Light Gradient Boosting Machine emerge as the most reliable models overall across locations and forecast steps. The resulting framework is well aligned with the aims of urban development and smart-city research because it demonstrates how city-scale sensing infrastructure and interpretable predictive analytics can support proactive congestion management and operational transport planning under limited historical data.