Spatial Analysis and Classification of Traffic Congestion Levels Using a Hybrid Machine Learning Approach in Badung Regency, Bali
Article Sidebar
Abstract:
Background: Traffic congestion in Badung Regency, Bali, presents complex challenges for transportation management in a strategic tourism area, necessitating intelligent monitoring methods that surpass conventional surveys.
Aim: This study develops a Hybrid Machine Learning framework that integrates unsupervised and supervised learning techniques to map spatial patterns and precisely predict congestion anomalies.
Methods: Initially, the K-Means Clustering algorithm validated the segmentation of traffic data into five optimal clusters (k=5) based on Elbow and Silhouette Score tests, which subsequently served as the ground truth for data labeling. Furthermore, a comparative evaluation of Random Forest, XGBoost, and Gradient Boosting models was conducted to determine the best predictive performance.
Result: Experimental results identified Random Forest with strict pruning parameters (max_depth=3) as the optimal model, balancing accuracy and generalization stability while effectively avoiding overfitting through learning curve analysis. This model achieved a testing accuracy of 92.00% and a cross-validation score of 89.69%, with the Travel Time Index (TTI) and average speed identified as the primary determinants.
Conclusion: Spatial visualization demonstrated high consistency between the model's prediction maps and actual field conditions, confirming that this approach is effective as a foundation for an Early Warning System to support data-driven traffic management policies in Bali.
Keywords: Machine Learning, Traffic Congestion, K-Means, Random Forest, Spatial Analysis, Smart City
Downloads
Copyright (c) 2026 Rizal Wahyu Pratama, Mikhael Setia Budi, Eka Sahputra, Khulika Malkan, Wisnu Aji Sanjaya, Yoka Romadani

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
References
Abdolmaleki, M., Masoud, N., & Yin, Y. (2020). Transit timetable synchronization for transfer time minimization. Transportation Research Part B: Methodological, 131, 143–159. https://doi.org/10.1016/j.trb.2019.12.002
Azizah Amelia, S. (2025). Utilization Of Google Maps Data And Machine Learning For Traffic Congestion Prediction In Medium-Sized Urban Areas. Innovative Research in Civil and Environmental Engineering.
Bazarnovi, S., & Mohammadian, A. (kouros). (2024). Addressing imbalanced data in predicting injury severity after traffic crashes: A comparative analysis of machine learning models. Procedia Computer Science, 238, 24–31. https://doi.org/10.1016/j.procs.2024.05.192
Bührs, M., Rienow, A., & Zepp, H. (2026). Integrating species distribution models (SDM) in spatially explicit GIS-tools to support nature-sensitive urban planning. Basic and Applied Ecology, 91, 61–73. https://doi.org/10.1016/j.baae.2026.01.005
Cai, S., Liu, G., He, J., Du, Y., Si, Z., & Jiang, Y. (2025). Temporal-Spatial Traffic Flow Prediction Model Based on Prompt Learning. ISPRS International Journal of Geo-Information, 14(1). https://doi.org/10.3390/ijgi14010011
Cebolla-Alemany, J., Macarulla Martí, M., Viana, M., Moreno-Martín, V., San Félix, V., & Bou, D. (2024). Optimizing indoor air models through k-means clustering of nanoparticle size distribution data. Building and Environment, 266. https://doi.org/10.1016/j.buildenv.2024.112091
Chen, H., Liu, N. Y., Yang, Y., Wang, Y., Li, Q., & Shan, Y. (2026). Impact Effects of Transport Structure Changes on Urban Traffic Congestion: A Case Study of Core Cities in China. Transportation Research Part E: Logistics and Transportation Review, 208. https://doi.org/10.1016/j.tre.2026.104676
Erdelić, T., Carić, T., Erdelić, M., Tišljarić, L., Turković, A., & Jelušić, N. (2021). Estimating congestion zones and travel time indexes based on the floating car data. Computers, Environment and Urban Systems, 87. https://doi.org/10.1016/j.compenvurbsys.2021.101604
Imoh, U. U., & Rad, M. M. (2025). Analysis and Prediction of Traffic Conditions Using Machine Learning Models on Ikorodu Road in Lagos State, Nigeria. Infrastructures, 10(5). https://doi.org/10.3390/infrastructures10050122
Joelianto, E., Fathurrahman, M. F., Sutarto, H. Y., Semanjski, I., Putri, A., & Gautama, S. (2022). Analysis of Spatiotemporal Data Imputation Methods for Traffic Flow Data in Urban Networks. ISPRS International Journal of Geo-Information, 11(5). https://doi.org/10.3390/ijgi11050310
Khorshidi, N., Rezashoar, S., Amini, P., Zargari, S. A., & Mirzahossein, H. (2025). Metaheuristic-optimized neural networks for travel time index prediction: A comparative study of wild horse and coot optimization algorithms: Optimized MLP for Travel Time Prediction: Comparing WHO and COA. Transportation Engineering, 22. https://doi.org/10.1016/j.treng.2025.100395
Li, J., Wang, L., Fu, S., Fu, W., & Pan, X. (2025). Self-labeled framework with semi-supervised ball K-means clustering-based synthetic example generation for semi-supervised classification in industrial applications. Engineering Applications of Artificial Intelligence, 150. https://doi.org/10.1016/j.engappai.2025.110528
Mehavilla, L., García, J., & Alesanco, Á. (2026). Unveiling user activities on instant messaging platforms: A study of activity fingerprinting through traffic analysis and machine learning techniques. Knowledge-Based Systems, 342. https://doi.org/10.1016/j.knosys.2026.115893
Mirzahossein, H., Nobakht, P., Waller, T., & Lin, D. Y. (2025). Revealing crash hotspots concerning google traffic maps historical data by supervised and ensemble machine learning techniques. Transportation Engineering, 20. https://doi.org/10.1016/j.treng.2025.100326
Ni Made Prisca Rahmayanti, Dewa Ayu Nyoman Sriastuti, & Putu Aryastana. (2024). Kajian Kebutuhan dan Pendapatan Parkir pada Kawasan Objek Wisata Pantai Kelan Kabupaten Badung Bali. Jurnal Ilmiah Mitsu. https://doi.org/10.24929/ft.v12i1.2744
Obaidat, M. T., & Alomari, L. D. (2026). Real-time multi-source AI, computer vision, and GIS fusion for data-driven urban traffic management. Transportation Research Interdisciplinary Perspectives, 36. https://doi.org/10.1016/j.trip.2026.101895
Ranjan, S., Kim, Y. C., Ranjan, N., Bhandari, S., & Kim, H. (2023). Large-Scale Road Network Traffic Congestion Prediction Based on Recurrent High-Resolution Network. Applied Sciences (Switzerland), 13(9). https://doi.org/10.3390/app13095512
Rozy, F., Setia Brata, A., Lestari, W., & Rahmawati, S. (2025). Cluster of Foreign Tourists Using the K-Means Method Based on Arrival Data at I Gusti Ngurah Rai Airport (2018-2024). International Journal of Management Science and Information Technology, 5(2), 362–370. https://doi.org/10.35870/ijmsit.v5i2.5208
Shah, S. M. T., & Piantanakulchai, M. (2026). Ensemble machine learning for travel time prediction: An Active learning-assisted approach. Results in Engineering, 29. https://doi.org/10.1016/j.rineng.2025.108712
Shang, Q., Tang, Y., & Yin, L. (2024). A hybrid model for missing traffic flow data imputation based on clustering and attention mechanism optimizing LSTM and AdaBoost. Scientific Reports, 14(1). https://doi.org/10.1038/s41598-024-77748-1
Shang, Q., Yu, Y., & Xie, T. (2022). A Hybrid Method for Traffic State Classification Using K-Medoids Clustering and Self-Tuning Spectral Clustering. Sustainability (Switzerland), 14(17). https://doi.org/10.3390/su141711068
Soimun, A., Sadri, P. D. A., Navianti, D. R., & Fitri, S. N. (2025). The impact of traffic congestion on freight transport efficiency in a tourism corridor: A case study of the Denpasar–Gilimanuk road. Journal of Applied Sciences in Travel and Hospitality, 8(2), 177–198. https://doi.org/10.31940/jasth.v8i2.177-198
Solís-Martín, D., Galán-Páez, J., & Borrego-Díaz, J. (2025). A Model for Learning-Curve Estimation in Efficient Neural Architecture Search and Its Application in Predictive Health Maintenance. Mathematics, 13(4). https://doi.org/10.3390/math13040555
Winfrey, C., Meleby, P., & Miao, L. (2023). Using big data and machine learning to rank traffic signals in Tennessee. Journal of Traffic and Transportation Engineering (English Edition), 10(5), 918–933. https://doi.org/10.1016/j.jtte.2023.04.005
Xu, S. J., Kong, K. C., Jin, X. B., & Geng, G. G. (2025). Unveiling traffic paths: Explainable path signature feature-based encrypted traffic classification. Computers and Security, 150. https://doi.org/10.1016/j.cose.2024.104283
Yu, T., Huang, W., Tang, X., & Zheng, D. (2025). A hybrid unsupervised machine learning model with spectral clustering and semi-supervised support vector machine for credit risk assessment. PLOS ONE, 20(1). https://doi.org/10.1371/journal.pone.0316557
Zhang, J., Zhang, A., Liu, X., & Luo, P. (2026). Integrating deep learning and big data analytics for enhanced smart city infrastructure and human resource management systems. Ain Shams Engineering Journal, 17(3). https://doi.org/10.1016/j.asej.2025.103962
Zhang, X., Wang, L., Yang, Y., Han, H., Shen, G., Schroepfer, T., & He, J. (2025). Analyzing the typology and livability of 15-minute travel at metro stations in high-density cities: A case study of Singapore. Cities, 158. https://doi.org/10.1016/j.cities.2025.105727
Zheng, Y., Luo, J., & Hu, M. (2026). Spatial-temporal incident-aware dynamic graph convolution networks for traffic flow prediction. Expert Systems with Applications, 305, 130689. https://doi.org/10.1016/j.eswa.2025.130689
Zhu, Y., & Goverde, R. M. P. (2021). Dynamic railway timetable rescheduling for multiple connected disruptions. Transportation Research Part C: Emerging Technologies, 125. https://doi.org/10.1016/j.trc.2021.103080