Daily rainfall prediction in Lagos using logistic regression, random forest, and support vector machine with web development
Keywords:
Rainfall prediction, Machine learning, Random forest, Logistic regression, Support vector machineAbstract
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.
Published
How to Cite
Issue
Section
Copyright (c) 2026 Oladimeji Lukman Abiola, Oke Samuel Abayomi, Akinade Oludayo Olugbenga, Oguntola Toyin Omoyeni, Adebayo Azeez Ademola

This work is licensed under a Creative Commons Attribution 4.0 International License.
How to Cite
Similar Articles
- Tertsea Igbawua, Aondongu Alexander Tyovenda, Terver Sombo, Idugba Mathias Echi, Fanan Ujoh, Investigating factors influencing PM2.5 threshold exceedance in Nigeria using multivariate logistic regression analysis , African Scientific Reports: Volume 3, Issue 3, December 2024
- M. M. Tanko, M. S. Liman, W. L. Lumbi, U. S. Aliyu, Spatial and Seasonal Estimation of Tropospheric Radio Refractivity in Nigeria , African Scientific Reports: Volume 1, Issue 1, April 2022
- T. J. Adejumo, A. I. Okegbade, J. I. Idowu, O. J. Oladapo, O. O. Oladejo, Time Series Analysis of Nigeria External (Foreign) Reserves , African Scientific Reports: Volume 2, Issue 1, April 2023
- Justine Utsu Undiandeye, Moses Adah Agana, Towards strengthening edge computing security through stack protection mechanisms , African Scientific Reports: Volume 5, Issue 2, August 2026
- Jangfa Timothy Zhimwang, Rain fade impairment analysis for Earth-to-space radio links using site diversity techniques in Delta State, Nigeria , African Scientific Reports: Volume 5, Issue 2, August 2026
- Samuel O. Obi, Imam Akeyede, Forcasting Natural Gas Consumption in Nigeria using the Modified Grey Model (MGM(1,1,⊗b)) , African Scientific Reports: Volume 1, Issue 2, August 2022
- S. M. Shiada, S. D. Igba, O. Shiekar, E. A. Damian, Simulation of the influence of cloud density on the removal of particulate matter and gaseous pollutants at the Dangote cement factory by rain , African Scientific Reports: Volume 4, Issue 2, August 2025
- Janet Iyabo Idowu, Olasunkanmi James Oladapo, Abiola Timothy Owolabi, Kayode Ayinde, On the biased Two-Parameter Estimator to Combat Multicollinearity in Linear Regression Model , African Scientific Reports: Volume 1, Issue 3, December 2022
- Taiwo Stephen Fayose, Kayode Ayinde, Olatayo Olusegun Alabi, Abimbola Hamidu Bello, Robust weighted ridge regression based on S – estimator , African Scientific Reports: Volume 2, Issue 3, December 2023
- Abiola T. Owolabi, Kayode Ayinde, Olusegun O. Alabi, A Modified Two Parameter Estimator with Different Forms of Biasing Parameters in the Linear Regression Model , African Scientific Reports: Volume 1, Issue 3, December 2022
You may also start an advanced similarity search for this article.