Sustainable Traffic Congestion Forecasting Through Lightweight Explainable AI and TinyML Edge Deployment: A Casablanca Case Study

Read full text
Authors: Mehdi Attioui, Mohamed Lahby
Cited by: 1
References: 18

Abstract

Traffic congestion in urban areas poses substantial challenges to transportation management, urban planning, and environmental sustainability. This study introduces an explainable artificial intelligence (XAI) framework for predicting traffic congestion in Casablanca, Morocco, by integrating gradient boosting models with lightweight XAI techniques that are suitable for edge deployment. Employing SUMO-simulated traffic data comprising 30,000 data points across 30 scenarios, we implemented a GradientBoostingRegressor (scikit-learn) enhanced with native feature importance analysis, permutation importance, and partial dependence plots, achieving R2=0.9939, MAE = 0.015, and RMSE = 0.019. The XAI analysis reveals that lag features (32.0%), temporal patterns (35.0%), and infrastructure features (15.0%) are the primary contributors to congestion prediction, with culturally relevant factors, such as Friday prayers, accounting for 8.7% of the total feature importance. The model was deployed through a knowledge-distillation TinyML pipeline, achieving 31× compression (2.4 MB → 76 KB) on ESP32 microcontrollers with 2.1 ms inference latency and a 667× reduction in per-inference energy consumption compared to cloud-based deployment. This lightweight XAI approach directly addresses the gap between interpretability requirements and edge deployment constraints, facilitating sustainable intelligent transportation systems in developing countries with limited infrastructure and energy resources. The proposed framework is transferable to other rapidly urbanizing cities in the Global South, offering a replicable template for data-driven interpretable traffic management that can directly inform infrastructure investment prioritization, adaptive signal-control policy design, and culturally aware urban mobility planning strategies.

Fields of Study & Subjects

Traffic Prediction and Management Techniques Traffic control and management Transportation Planning and Optimization

Publication details

Journal / source
Sustainability
Publisher
MDPI AG
Volume
18
Issue
9
Pages
4439–4439
Publication date
1 May 2026
Language
EN