An XGBoost-SHAP Framework for Predicting Traffic Speed Based on Road Geometry
DOI:
https://doi.org/10.63746/njtd.v22i3.3514Keywords:
Highway Geometric, Traffic Operating Speed, Speed Prediction, XGBoost Model, SHAPAbstract
In Intelligent Transportation System (ITS), Road Traffic Speed Prediction (RTSP) is essential for effective road operation and safety. This study investigates the impact of highway geometric features on traffic operating speed of Idiroko Road, a critical transportation link in Nigeria with the border. Geometric features including radius of curvature, road gradient, pavement width, shoulder width, median width and the presence of intersections were determined on site, as well as the spot speed of different vehicle types using a stopwatch approach. The Extreme Gradient Boosting (XGBoost) model was used to predict traffic operating speed, and Shapley additive explanations (SHAP) were employed to interpret the correlation between variables. The findings reveal that the radius of curvature, road gradient, pavement width, shoulder widths and the presence of intersections along the road have a significant effect on traffic operating speeds. The XGBoost model demonstrated high accuracy and efficiency with 98.5% and 97.9% coefficient of determination (R2) in both testing and training datasets. This study emphasizes the effectiveness of XGBoost in predicting traffic operating speed. The findings can be implemented in urban road design, infrastructural planning and traffic management ultimately contributing to safer and more efficient road networks.
References
REFERENCES
AASHTO. (2012). American Association of State Highway and Transportation Officials. In A policy on geometric design of highways and streets. Washington, DC.
AASHTO. (2014). Highway Safety Manual. In A. A. (AASHTO). Washington DC.
Abdelraouf, A., Abdel-Aty, M., & Yuan, J. (2022). Utilizing attention-based multi-encoder–decoder neural networks for freeway traffic speed prediction. IEEE Transactions on Intelligent Transportation Systems, 23(8), 11960-11969.
Ahmed, S., Hossain, A., Ray, S. K., Bhuiyan, M. I., & Sabuj, S. R. (2023). A study on road accident prediction and contributing factors using explainable machine learning models: analysis and performance. Transportation Research Interdisciplinary Perspectives, 1-16.
Amiri, A. M., Sadri, A., Nadimi, N., & Shams, M. (2020). A comparison between artificial neural network and hybrid intelligent genetic algorithm in predicting the severity of fixed object crashes among elderly drivers. Accident Analysis and Prevention 138, 105468.
Bayode, O, Aderinola, O.S., & Oluyemi-Ayibiowu, B. D. (2025). Application of Machine Learning for Road Safety Modeling of Selected South-West Highway in Nigeria. European Journal of Applied Science, Engineering and Technology, 3(3), 202-213
Bayode, O., Aderinola, O. S., Oluyemi-Ayibiowu, B. D., Okungade, O., & Opeyemi, D. (2024). Impact of Geometric Properties of Two Lane Highway on Traffic operation and Safety. UI Journal of Civil Engineering and Technology, 6(1), 15-25.
Berhanu, Y., Schroder, D., Wodajo, B. T., & Aliimayehu, E. (2024). Machine learning for predictions of road traffic accidents and spatial network analysis for safe routing on accident and congestion-prone road networks. Result in Engineering, 23(102737), 1-22.
Bouktif, S., Fiaz, A., Ouni, A., Alnaqbi, B., Alsereidi, F. S., & Alsereidi, F. A. (2020). Bayesian optimized XGBoost model for traffic speed prediction incorporating weather effects. Fourth International Conference On Intelligent Computing in Data Sciences (ICDS),, 1-7.
Chen, M. M., & Chen, M. C. (2020). Modeling road accident severity with comparisons of logistic regression, decision tree and random forest. Information, 11(5), 270.
Chen, T., & Guestrin, C. (2016). XGBoost: A Scalable Tree Boosting System. (pp. 1-8). San Francisco, CA, USA,: Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining.
Dong, N., Huang, H., & Zheng, I. (2015). Support vector machine in crash prediction at the level of traffic analysis zones: Assessing the spatial proximity effects. Accident Analysis & Prevention 82, 192-198.
Ganan-Cardenas, E., Pemberthy-R, J. I., Suarez-Gomez, M. L., Ballesteros, J. R., & Branch-Bedoya, J. W. (2025). Machine learning framework for predicting urban road speed profiles and uncertainty. International Journal of Transportation Science and Technology, 30-41.
Imoh, U. U., & Rad, M. M. (2025). Analysis and Prediction of Traffic Conditions Using Machine Learning Models on Ikorodu Road in Lagos State, Nigeria. Infrastrutures: MDPI, 10, 1-24. Retrieved from https://doi.org/10.3390/infrastructures10050122
Khanum, H., Garg, A., & Faheem, M. I. (2023). Accident severity prediction modeling for road safety using random forest algorithm: an analysis of Indian highways [version 2; peer review: 2 approved, 1 approved with reservations]. F1000Reasearch, 1-20.
Khosbayar, A., Valluru, J., & Huang, B. (2021). Multi-rate Gaussian Bayesian network soft sensor development with noisy input and missing data. Journal of Process Control, 105, 48-61.
Lee, E. H. (2023). Traffic Speed Prediction of Urban Road Network based on High Importance Links using XGBoost and Shapley Additive Explanation. IEEE Access, 1-10. doi:DOI 10.1109/ACCESS.2023.3324035
Lee, E. H., Kho, S. Y., Kim, D. K., & Cho, S. H. (2021). Travel time prediction using gated recurrent unit and spatio-temporal algorithm. Proceedings of the Institution of Civil Engineers: Municipal Engineer, 174(2), 88-96.
Ma, D., Zhu, J., Song, X. B., & Wang, X. (2023). Traffic flow and speed forecasting through a Bayesian deep multi-linear relationship network,’’. Experts system with Application, 213, 119161.
Ma, Z., Mei, G., & Cuomo, S. (2021). An analytic framework using deep learning for prediction of traffic accident injury severity based on contributing factors. Accident Analysis and Prevention, 120, 106322.
Min, J. H., Ham, S. W., Kim, D. K., & Lee, E. H. (2023). Deep multimodal learning for traffic speed estimation combining dedicated short-range communication and vehicle detection system data. Journal of the Transportation Research Board, 2677(5), 247-259.
Montella, A., Ona, R. D., Manuriello, F., & Riccardi, M. R. (2020). A data mining approach to investigate patterns of powered two-wheeler crashes in Spain. Accident Analysis and Prevention 134, 105251, 1-15.
Mystakidis, A., Koukaras, P., & Tjortjis, C. (2025). Advances in Traffic Congestion Prediction; An Overview of Emerging Techniques and Methods. Smart Cities (MDPI), 8(25), 1-37.
Naallah, A. B., Ibitoye, A. B., & Subair, S. O. (2024). Development of a Predictive Model for Road Traffic Accident Involvement in Southwest Nigeria: A Case Study of Ekiti, Osun, and Oyo State. Journal of Applied Science and Environmental Management, 3385-3390.
Olugbemiro, A. (2019). Road Traffic Accidents and Safety Challenges in Nigeria. Journal of Transportaton Safety., 337-342.
Parsa, A. B., Movahedi, A., Taghipour, H., Derrible, S., & Mohammadian, A. K. (2020). Toward safer highways, application of XGboost and SHAP for real-time accident detection and feature analysis. Accidient Analysis Prevention, 105405, 136.
Roess, R. P., Prassas, E. S., & McShame, W. R. (2011). Traffic Engineering (4th ed.). New York: Pearson Education.
Semeida, A. M. (2013). Impact of highway geometry and posted speed on operating speed at multi-lane highways in Egypt. Journal of Advanced Research, 4(1), 515-523. doi:http://dx.doi.org/10.1016/j.jare.2012.08.014
Shiran, G., Imaninasab, R., & Khayamim, R. (2021). Crash severity analysis of highways based on multinomial logistic regression model, decision tree techniques, and artificial neural network: A modeling comparison. Sustainability, 13(10), 5670.
Sun, B., Sun, T., & Jiao, P. (2021). Spatio-Temporal Segmented Traffic Flow Prediction with ANPRS Data Based on Improved XGBoost. Journal of Advance Transportation, 1-12.
Tayebikhorami, S., & Sacchi, E. (2022). Validation of Machine Learning Algorithms as Predictive Tool in the Road Safety Management Process: Case of Network Screening. Journal of Transportation Engineering, 1-30.
Yang, Y., Wang, k., Yuan, Z., & Liu, D. (2022). Predicting Freeway Traffic Crash Severity Using XGBoost-Bayesian Network Model with Consideration of Features Interaction. Journal of Advanced Transportation, 1-16.
Yin, X., Fallah-Shorshani, M., McConnell, R., Fruin, S., Chiang, Y. Y., & Franklin, M. (2023). Quantile extreme gradient boosting for uncertainty quantification. 20-32. Retrieved from http://arxiv.org/abs/2304.11732.
Yusuf, I. T., Adeleke, O. O., Salami, A. W., & Ayanshola, A. M. (2016). The Factors That Affect the Free Flow Speed on An Arterial In Ilorin, Nigeria. Nigerian Journal of Technology, 35(3), 473-480. Retrieved from http://dx.doi.org/10.4314/njt.v35i3.2.

Published
Issue
Section
License
Copyright (c) 2025 Nigerian Journal of Technological Development

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
In accordance with the Copyright Act of 1976, which became effective January 1, 1978, the following statement signed by each author must accompany the manuscript submitted: "I, the undersigned author, transfer all copyright ownership of the manuscript referenced above to the Nigerian Journal of Technological Development, in the event the work is published. I warrant that the article is original, does not infringe upon any copyright or other proprietary right of any third party, is not under consideration by another journal, and has not been published previously. I have reviewed and approve the submitted version of the manuscript and agree to its publication in the Nigerian Journal of Technological Development." A copyright transfer form should be downloaded from the NJTD Website ( http://njtd.com.ng/index.php/njtd). Author(s) will be consulted, whenever possible, regarding republication of material. All authors must have access to the data presented and the authors and sponsor (if applicable) must agree to share original data with the editor if requested.