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
- M. A. Aliu, A. M. Junaid, A. Ibraheem, A. Ishaq, A. Lawal, K. E. Ayeni, A. R. Lawal, L. B. Abdulrauf, Dispersive liquid-liquid microextraction/HPLC techniques for determination of oxytetracycline and doxycycline residues in beef samples: method developments and statistical analysis , African Scientific Reports: Volume 2, Issue 1, April 2023
- Ayomide Oluwaseyi Agunloye, A Low-cost Optocoupler-Based Isolator System for IoT-Based Voltage Measurement in Low and High voltage DC Applications , African Scientific Reports: Volume 2, Issue 1, April 2023
- Hassan Ibrahim, Deborah Abolape Akwu, Reza Sharafdini, On topological indices and QSPR analysis of some drugs used for treating Coronavirus patients , African Scientific Reports: Volume 3, Issue 2, August 2024
- Ifeanyi Edozie Otuokere, Onyinye Uloma Akoh, Felix Chigozie Nwadire, Chinedum Ifeanyi Nwankwo, Joy Nwachukwu Egbucha, Chiemela Wisdom, Ogbonna Augustine Okwudiri, GC-MS Profiling and In Silico Studies to Identify Potential SARS-CoV-2 Nonstructural Protein Inhibitors from Psidium guajava , African Scientific Reports: Volume 1, Issue 3, December 2022
- Wato Nathan Fundji, Kitenge Marie Ngoie, Kabamba Arthur Makenda, John Kabuba, Bioelectrochemical transformation of synthetic waste from the Vaal region: effects of acetic acid, sugar, and salt on biogas production and electricity generation using a microbial fuel cell , African Scientific Reports: Volume 5, Issue 2, August 2026
- J. E. Moyegbone, P. Onyema, O. C. Madubuattah, E. O. Emurotu, E. E. Oronsaye, P. T. Osunu, J. A. Ebeigbe, E. U. Nwose, Prevalence and driving-related factors influencing prediabetes and diabetes among commercial drivers in Benin City metropolis, Edo State, Nigeria , African Scientific Reports: Volume 5, Issue 1, April 2026
You may also start an advanced similarity search for this article.