IDEAS home Printed from https://ideas.repec.org/a/gam/jsusta/v18y2026i9p4439-d1933589.html

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

Author

Listed:
  • Mehdi Attioui

    (Laboratory of Mathematics, Artificial Intelligence, and Digital Learning, Higher Normal School, Hassan II University, Casablanca 50069, Morocco)

  • Mohamed Lahby

    (Laboratory of Mathematics, Artificial Intelligence, and Digital Learning, Higher Normal School, Hassan II University, Casablanca 50069, Morocco)

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 R 2 = 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.

Suggested Citation

  • Mehdi Attioui & Mohamed Lahby, 2026. "Sustainable Traffic Congestion Forecasting Through Lightweight Explainable AI and TinyML Edge Deployment: A Casablanca Case Study," Sustainability, MDPI, vol. 18(9), pages 1-20, May.
  • Handle: RePEc:gam:jsusta:v:18:y:2026:i:9:p:4439-:d:1933589
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/2071-1050/18/9/4439/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/2071-1050/18/9/4439/
    Download Restriction: no
    ---><---

    More about this item

    Keywords

    ;
    ;
    ;
    ;
    ;

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:gam:jsusta:v:18:y:2026:i:9:p:4439-:d:1933589. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: MDPI Indexing Manager (email available below). General contact details of provider: https://www.mdpi.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.