Daily rainfall prediction in Lagos using logistic regression, random forest, and support vector machine with web development

Authors

  • Oladimeji Lukman Abiola
    Department of Statistics, Ladoke Akintola University of Technology, Ogbomoso, Nigeria
  • Oke Samuel Abayomi
    Department of Statistics, Ladoke Akintola University of Technology, Ogbomoso, Nigeria
  • Akinade Oludayo Olugbenga
    Department of Statistics, Ladoke Akintola University of Technology, Ogbomoso, Nigeria
  • Oguntola Toyin Omoyeni
    Department of Statistics, Ladoke Akintola University of Technology, Ogbomoso, Nigeria
  • Adebayo Azeez Ademola
    Department of Statistics, Ladoke Akintola University of Technology, Ogbomoso, Nigeria

Keywords:

Rainfall prediction, Machine learning, Random forest, Logistic regression, Support vector machine

Abstract

Accurate rainfall prediction is critical for agricultural planning, flood-risk management, and urban infrastructure resilience, particularly in tropical coastal cities such as Lagos, Nigeria, where unpredictable rainfall events cause significant socioeconomic disruption. This study evaluates three machine learning (ML) classification models---logistic regression (LR), random forest (RF), and support vector machine (SVM)---for daily binary rainfall prediction using a 22-year meteorological dataset of 8,314 observations sourced from Visual Crossing. Two features were engineered from the raw data: daily temperature range and a seasonal indicator. To address the asymmetric cost of false negatives in a tropical rainfall context, Youden's J statistic was applied to optimise the decision threshold of each model, prioritising sensitivity over the conventional 0.5 default. RF achieved the strongest overall performance, recording an accuracy of 76.28%, sensitivity of 79.27%, F1-score of 76.44%, and area under the receiver operating characteristic curve (AUC-ROC) of 0.8454, outperforming SVM (AUC-ROC: 0.8215) and LR (AUC-ROC: 0.8001). Humidity, cloud cover, dew point, and visibility emerged as the most consistent predictors across models, while moon phase and wind speed showed negligible importance in all three classifiers. All three trained models were deployed in an interactive R Shiny web application, enabling non-technical users, including farmers, planners, and policymakers, to obtain real-time rainfall predictions from meteorological inputs. This study provides an end-to-end rainfall prediction pipeline tailored to the Lagos environment and demonstrates the practical value of coupling ML with accessible deployment frameworks for climate decision-making in developing countries.

Dimensions

[1] S. Q. Dotse, I. Larbi, A. M. Limantol & L. C. De Silva, ``A review of the application of hybrid machine learning models to improve rainfall prediction'', Modeling Earth Systems and Environment 10 (2024) 19. https://doi.org/10.1007/s40808-023-01835-x.

[2] A. Parmar, K. Mistree & M. Sompura, ``Machine learning techniques for rainfall prediction: A review'', 2017 International Conference on Innovations in Information, Embedded and Communication Systems (ICIIECS), Coimbatore, India, 2017, pp. 425--430. Available online: https://www.researchgate.net/publication/319503839_Machine_Learning_Techniques_For_Rainfall_Prediction_A_Review.

[3] S. D. Latif, N. A. B. Hazrin, C. H. Koo, J. L. Ng, B. Chaplot, Y. F. Huang, A. El-Shafie & A. N. Ahmed, ``Assessing rainfall prediction models: Exploring the advantages of machine learning and remote sensing approaches'', Alexandria Engineering Journal 82 (2023) 16. https://doi.org/10.1016/j.aej.2023.09.060.

[4] U. C. Nkwunonwo, M. Whitworth & B. Baily, ``A review and critical analysis of the efforts towards urban flood risk management in the Lagos region of Nigeria'', Natural Hazards and Earth System Sciences 16 (2016) 349. https://doi.org/10.5194/nhess-16-349-2016.

[5] M. I. Jordan & T. M. Mitchell, ``Machine learning: Trends, perspectives, and prospects'', Science 349 (2015) 255. https://doi.org/10.1126/science.aaa8415.

[6] A. Patel, N. Keriwala, N. Soni, U. Goel, R. Bhoj, Y. Adhyaru & S. M. Yadav, ``Rainfall prediction using machine learning techniques for the Sabarmati River Basin, Gujarat, India'', Journal of Engineering Science and Technology Review 16 (2023) 101. https://doi.org/10.25103/jestr.161.13.

[7] U. Shah, S. Garg, N. Sisodiya, N. Dube & S. Sharma, ``Rainfall prediction: Accuracy enhancement using machine learning and forecasting techniques'', 2018 Fifth International Conference on Parallel, Distributed and Grid Computing (PDGC), Solan, India, 2018, pp. 776--782. https://doi.org/10.1109/PDGC.2018.8745763.

[8] M. El Hafyani, K. El Himdi & S.-E. El Adlouni, ``Improving monthly precipitation prediction accuracy using machine learning models: A multi-view stacking learning technique'', Frontiers in Water 6 (2024) 1378598. https://doi.org/10.3389/frwa.2024.1378598.

[9] O. Ejike, D. Ndị & M. Z. Shakir, ``Comparative study of machine learning-based rainfall prediction in tropical and temperate climates'', Climate 13 (2025) 167. https://doi.org/10.3390/cli13080167.

[10] S. Bahrom, ``SmartForecast: An interactive R Shiny dashboard for rainfall forecasting in Subang'', APS Proceedings 24 (2025) 8. https://doi.org/10.5281/zenodo.16788019.

[11] C. Cortes & V. Vapnik, ``Support-vector networks'', Machine Learning 20 (1995) 273. https://doi.org/10.1007/BF00994018.

[12] D. W. Hosmer, S. Lemeshow & R. X. Sturdivant, Applied Logistic Regression, 3rd ed., Wiley, Hoboken, USA, 2013. https://doi.org/10.1002/9781118548387.

[13] L. Breiman, ``Random forests'', Machine Learning 45 (2001) 5. https://doi.org/10.1023/A:1010933404324.

[14] W. J. Youden, ``Index for rating diagnostic tests'', Cancer 3 (1950) 32. https://doi.org/10.1002/1097-0142%281950%293%3A1%3C32%3A%3AAID-CNCR2820030106%3E3.0.CO%3B2-3

fig 8

Published

2026-08-28

How to Cite

Daily rainfall prediction in Lagos using logistic regression, random forest, and support vector machine with web development. (2026). African Scientific Reports, 5(3), 541. https://doi.org/10.46481/asr.2026.5.3.541

Issue

Section

MATHEMATICS AND STATISTICS SECTION

How to Cite

Daily rainfall prediction in Lagos using logistic regression, random forest, and support vector machine with web development. (2026). African Scientific Reports, 5(3), 541. https://doi.org/10.46481/asr.2026.5.3.541

Similar Articles

31-40 of 45

You may also start an advanced similarity search for this article.