Improved Temperature Trend Forecasting in Major Pakistani Cities Using XGBoost and other Ensemble Machine Learning Models
DOI:
https://doi.org/10.71107/j2djza91Keywords:
XGBoost, Temperature, Forecasting, Environmental Data, AnalysisAbstract
This study employs advanced machine learning algorithms Random Forest, Gradient Boosting Machines (GBM), and XGBoost to predict normalized temperatures in major Pakistani cities, focusing on Lahore. Using a comprehensive dataset divided into training and testing subsets, model performance was evaluated using Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and R-squared (R²). Results show that XGBoost excelled with the lowest RMSE (0.0281), MAE (0.0219), and highest R² (0.9879), demonstrating superior predictive accuracy. Gradient Boosting and Random Forest also performed well, confirming the efficacy of ensemble methods for temperature forecasting. This study highlights the potential of machine learning in environmental analysis, offering a scalable framework for climate predictions and informed urban planning.
Downloads
References
[1] Ali, A., Rahut, D. B., Mottaleb, K. A., & Erenstein, O. (2017). Impacts of changing weather patterns on smallholder well-being: Evidence from the Himalayan region of northern Pakistan. International Journal of Climate Change Strategies and Management, 9(2), 225-240. DOI: https://doi.org/10.1108/IJCCSM-05-2016-0057
[2] Shahzad, L., Tahir, A., Sharif, F., Khan, W. U. D., Farooq, M. A., Abbas, A., & Saqib, Z. A. (2019a). Vulnerability, well-being, and livelihood adaptation under changing environmental conditions: A case from mountainous region of Pakistan. Environmental Science and Pollution Research, 26, 26748-26764.
[3] Shahzad, L., Tahir, A., Sharif, F., Khan, W. U. D., Farooq, M. A., Abbas, A., & Saqib, Z. A. (2019b). Vulnerability, well-being, and livelihood adaptation under changing environmental conditions: A case from mountainous region of Pakistan. Environmental Science and Pollution Research, 26, 26748-26764. DOI: https://doi.org/10.1007/s11356-019-05880-x
[4] Tariq, A., Mumtaz, F., Zeng, X., Baloch, M. Y. J., & Moazzam, M. F. U. (2022). Spatio-temporal variation of seasonal heat islands mapping of Pakistan during 2000–2019, using day-time and night-time land surface temperatures MODIS and meteorological stations data. Remote Sensing Applications: Society and Environment, 27, 100779. DOI: https://doi.org/10.1016/j.rsase.2022.100779
[5] Ali, G., Bao, Y., Ullah, W., Ullah, S., Guan, Q., Liu, X., ... & Ma, J. (2020). Spatiotemporal trends of aerosols over urban regions in Pakistan and their possible links to meteorological parameters. Atmosphere, 11(3), 306. DOI: https://doi.org/10.3390/atmos11030306
[6] Khan, N., & Shahid, S. (2024). Urban heat island effect and its drivers in large cities of Pakistan. Theoretical and Applied Climatology, 1-20. DOI: https://doi.org/10.1007/s00704-024-04959-x
[7] Farman, H., Islam, N., Ali, S. A., Khan, D., Khan, H. A., Ahmed, M., & Farman, A. (2024). Advancing Rainfall Prediction in Pakistan: A Fusion of Machine Learning and Time Series Forecasting Models. International Journal of Emerging Engineering and Technology, 3(1), 17-24.
[8] Khan, Z. J. (2024). A Machine Learning Analysis of Climate Change & Human Health Projections in Pakistan.
[9] Babu Nuthalapati, S., & Nuthalapati, A. (2024). Accurate weather forecasting with dominant gradient boosting using machine learning. International Journal of Scientific Research Archive, 12(2), 408–422. DOI: https://doi.org/10.30574/ijsra.2024.12.2.1246
[10] Cifuentes, J., Marulanda, G., Bello, A., & Reneses, J. (2020). Air temperature forecasting using machine learning techniques: A review. Energies, 13(16), 4215.
[11] Khan, M. R., Abubakar, M., Tahir, A., Dilawar, M. W., Hassan, H. M. A., Ahmad, S. R., ... & Chand, M. U. (2024). Escalating global threat of heatwaves and policy options for adaptation and mitigation. Journal of Asian Development Studies, 13(3), 980–995. DOI: https://doi.org/10.62345/jads.2024.13.3.80
[12] Kolambe, M., & Arora, S. (2024). Forecasting the future: A comprehensive review of time series prediction techniques. Journal of Electrical Systems, 20(2s), 575–586. DOI: https://doi.org/10.52783/jes.1478
[13] Rolnick, D., Donti, P. L., Kaack, L. H., Kochanski, K., Lacoste, A., Sankaran, K., ... & Bengio, Y. (2022). Tackling climate change with machine learning. ACM Computing Surveys (CSUR), 55(2), 1–96. DOI: https://doi.org/10.1145/3485128
[14] Anandan, P., & Sundaram, A. (2024). Unveiling agricultural soil runoff: Remote sensing and ensemble deep learning models to evaluate impact of climate on water quality and human health. Remote Sensing in Earth Systems Sciences, 1–16. DOI: https://doi.org/10.1007/s41976-024-00162-8
[15] Li, D., Yan, G., Li, F., Lin, H., Jiao, H., Han, H., & Liu, W. (2024). Optimized machine learning models for predicting core body temperature in dairy cows: Enhancing accuracy and interpretability for practical livestock management. Animals, 14(18), 2724. DOI: https://doi.org/10.3390/ani14182724
[16] Lai, Y., & Dzombak, D. A. (2020). Use of the autoregressive integrated moving average (ARIMA) model to forecast near-term regional temperature and precipitation. Weather and Forecasting, 35(3), 959-976. DOI: https://doi.org/10.1175/WAF-D-19-0158.1
[17] Salman, A. G., & Kanigoro, B. (2021). Visibility forecasting using autoregressive integrated moving average (ARIMA) models. Procedia Computer Science, 179, 252-259. DOI: https://doi.org/10.1016/j.procs.2021.01.004
[18] Cifuentes, J., Marulanda, G., Bello, A., & Reneses, J. (2020). Air temperature forecasting using machine learning techniques: a review. Energies, 13(16), 4215. DOI: https://doi.org/10.3390/en13164215
[19] Manoharan, A., Begam, K. M., Aparow, V. R., & Sooriamoorthy, D. (2022). Artificial Neural Networks, Gradient Boosting and Support Vector Machines for electric vehicle battery state estimation: A review. Journal of Energy Storage, 55, 105384. DOI: https://doi.org/10.1016/j.est.2022.105384
[20] Zennaro, F., Furlan, E., Simeoni, C., Torresan, S., Aslan, S., Critto, A., & Marcomini, A. (2021). Exploring machine learning potential for climate change risk assessment. Earth-Science Reviews, 220, 103752. DOI: https://doi.org/10.1016/j.earscirev.2021.103752
[21] Khan, N., Shahid, S., Ismail, T. B., & Behlil, F. (2021). Prediction of heat waves over Pakistan using support vector machine algorithm in the context of climate change. Stochastic Environmental Research and Risk Assessment, 35, 1335–1353. https://doi.org/10.1007/s00477-021-02001-9 DOI: https://doi.org/10.1007/s00477-020-01963-1
[22] Pachauri, N., & Ahn, C. W. (2022, November). Regression tree ensemble learning-based prediction of the heating and cooling loads of residential buildings. In Building Simulation (Vol. 15, No. 11, pp. 2003–2017). Beijing: Tsinghua University Press. https://doi.org/10.1007/s12273-022-0929-7 DOI: https://doi.org/10.1007/s12273-022-0908-x
[23] Zounemat-Kermani, M., Batelaan, O., Fadaee, M., & Hinkelmann, R. (2021). Ensemble machine learning paradigms in hydrology: A review. Journal of Hydrology, 598, 126266. https://doi.org/10.1016/j.jhydrol.2021.126266 DOI: https://doi.org/10.1016/j.jhydrol.2021.126266
[24] Cao, Y., Geddes, T. A., Yang, J. Y. H., & Yang, P. (2020). Ensemble deep learning in bioinformatics. Nature Machine Intelligence, 2(9), 500–508. https://doi.org/10.1038/s42256-020-00255-5 DOI: https://doi.org/10.1038/s42256-020-0217-y
[25] Ganaie, M. A., Hu, M., Malik, A. K., Tanveer, M., & Suganthan, P. N. (2022). Ensemble deep learning: A review. Engineering Applications of Artificial Intelligence, 115, 105151. DOI: https://doi.org/10.1016/j.engappai.2022.105151
[26] Heidari, A. A., Akhoondzadeh, M., & Chen, H. (2022). A wavelet PM2.5 prediction system using optimized kernel extreme learning with Boruta-XGBoost feature selection. Mathematics, 10(19), 3566. DOI: https://doi.org/10.3390/math10193566
[27] Mao, Y., Li, Y., Teng, F., Sabonchi, A. K., Azarafza, M., & Zhang, M. (2024). Utilizing hybrid machine learning and soft computing techniques for landslide susceptibility mapping in a Drainage Basin. Water, 16(3), 380. DOI: https://doi.org/10.3390/w16030380
[28] Dou, B., Zhu, Z., Merkurjev, E., Ke, L., Chen, L., Jiang, J., ... & Wei, G. W. (2023). Machine learning methods for small data challenges in molecular science. Chemical Reviews, 123(13), 8736-8780. DOI: https://doi.org/10.1021/acs.chemrev.3c00189
[29] Li, X., Li, Z., Huang, W., & Zhou, P. (2020). Performance of statistical and machine learning ensembles for daily temperature downscaling. Theoretical and Applied Climatology, 140(1), 571–588. DOI: https://doi.org/10.1007/s00704-020-03098-3
[30] Sibindi, R., Mwangi, R. W., & Waititu, A. G. (2023). A boosting ensemble learning-based hybrid light gradient boosting machine and extreme gradient boosting model for predicting house prices. Engineering Reports, 5(4), e12599. DOI: https://doi.org/10.1002/eng2.12599
[31] Wang, Q., Wang, X., Zhou, Y., Liu, D., & Wang, H. (2022). The dominant factors and influence of urban characteristics on land surface temperature using random forest algorithm. Sustainable Cities and Society, 79, 103722. DOI: https://doi.org/10.1016/j.scs.2022.103722
[32] Barrera-Animas, A. Y., Oyedele, L. O., Bilal, M., Akinosho, T. D., Delgado, J. M. D., & Akanbi, L. A. (2022). Rainfall prediction: A comparative analysis of modern machine learning algorithms for time-series forecasting. Machine Learning with Applications, 7, 100204. https://doi.org/10.1016/j.mlwa.2022.100204 DOI: https://doi.org/10.1016/j.mlwa.2021.100204
[33] Chen, L., Han, B., Wang, X., Zhao, J., Yang, W., & Yang, Z. (2023). Machine learning methods in weather and climate applications: A survey. Applied Sciences, 13(21), 12019. https://doi.org/10.3390/app132112019 DOI: https://doi.org/10.3390/app132112019
[34] Wang, R., He, Z., Chen, H., Guo, S., Zhang, S., Wang, K., ... & Ho, S. H. (2024). Enhancing biomass conversion to bioenergy with machine learning: Gains and problems. Science of The Total Environment, 172310. https://doi.org/10.1016/j.scitotenv.2024.172310 DOI: https://doi.org/10.1016/j.scitotenv.2024.172310
[35] Ding, F., Jiang, D., Chen, S., Hao, M., Wu, J., Wu, G., & Liang, H. (n.d.). Research on the impact of climate change on food security in Africa. Unpublished manuscript.
[36] Lv, X., Luo, J., Zhang, Y., Guo, H., Yang, M., Li, M., ... & Jing, R. (2025). Unveiling diagnostic information for type 2 diabetes through interpretable machine learning. Information Sciences, 690, 121582. https://doi.org/10.1016/j.ins.2025.121582 DOI: https://doi.org/10.1016/j.ins.2024.121582
Downloads
Published
Data Availability Statement
Data will be made available on request from the corresponding author
License
Copyright (c) 2025 Muhammad Bilal, Mubashir Mumtaz, Memoona Ashraf, Abdullah Nasir, Hanan Nasir, Engr. Musyab Raza (Author)

This work is licensed under a Creative Commons Attribution 4.0 International License.
Similar Articles
- Rabia Sattar, Faiza Rani, Muhammad Amin, Nazia Shahana Abbas, Kinetic Analysis of Thermal Degradation of Acrylonitrile Butadiene Styrene (ABS) for its Use in Electrical Appliances , Conclusions in Engineering: Articles in Press
- Jehanzaib Ahmed, Nazia Shahana Abbas, Muhammad Amin, Sara Hasan, Arooj Anwaar, Ahmad Shazad Saleemi, Nimra Adil, Amna Liaqat, Investigation of Thermal Stability of Bakelite by Isoconversional Thermal Analysis , Conclusions in Engineering: Articles in Press
- Irfan Haider, Imtiaz Ahmad Khan, Fatima Kainat, Hassan Ali Akhter, Hassaan Khalid, Nawishta Jabeen, Ahmad Hussain, Theoretical analysis of power-law nanofluid across extended sheet with thermal-concentration slip and Soret/Dufour effect , Conclusions in Engineering: Vol. 1 No. 1 (2025): Conclusions in Engineering
- Muhammad Bilal, Yasir Mehmood, Tabinda Shaheen, Numerical investigation of Maxwell Hybrid Nanofluid flow with polystyrene oil as base fluid , Conclusions in Engineering: Vol. 1 No. 1 (2025): Conclusions in Engineering
- Kamal Bashir, Mohamed Mosadag, A Novel Resampling Technique for Imbalanced Classification in Software Defect Prediction by a re-sampling method with filtering , Conclusions in Engineering: Vol. 1 No. 1 (2025): Conclusions in Engineering
- Nadia Khan, Qindeel Fatima, Amna Liaqat, Muhammad Amin, Extraction-Optimization of Hydrogel from Lallemantia Royleana Seeds Through Response Surface Methodology , Conclusions in Engineering: Articles in Press
- Omer Musa, Zonghan Yu, Ahmad Hussain , Nawishta Jabeen, Abdalazeem Adam, Bridging Knowledge and Action: The Vision of Conclusions in Engineering (Editorial) , Conclusions in Engineering: Vol. 1 No. 1 (2025): Conclusions in Engineering
- Qurat Ul Ain Yasin , Rabia Sattar, Muhammad Amin, Green Synthesis of Silver Oxide Nanoparticles using Zingiber officinale Extract: Catalytic and Antibacterial Potentials of 2-Phenyl Benzimidazole Derivatives , Conclusions in Engineering: Articles in Press
- Uzma Akhtar , Muhammad Tallal, Rabia Sattar, Tehmeena Ishaq, Green Synthesis of Tin Oxide Nanoparticles from Plant Extracts: Characterization and Assessment of Photocatalytic, Antibacterial, and Antimicrobial Activities , Conclusions in Engineering: Articles in Press
- Ayesha Ashfaq, Muhammad Tallal, Amna Liaqat, Nadia Khan, Nouman Waheed, Muhammad Amin, Carbon Nitride Nanosheet-based Titanium Dioxide Hybrid Photocatalyst for Organic Effluent Degradation , Conclusions in Engineering: Articles in Press
You may also start an advanced similarity search for this article.