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
- Ebenezer O. Oladipe, Sunday E. Adewumi, Taiwo Kolajo, Joshua B. Agbogun, Crop recommendation in precision agriculture: a systematic literature review of methods, trends, and challenges , African Scientific Reports: Volume 5, Issue 3, December 2026 (In progress)
- Gabriel James, Anietie Ekong, Aloysius Akpanobong, Enefiok Etuk, Saviour Inyang, Samuel Oyong, Ifeoma Ohaeri, Chikodili Orazulume, Peace Okafor, Enhanced machine learning model for classification of the impact of technostress in the COVID and post-COVID era , African Scientific Reports: Volume 4, Issue 1, April 2025
- O. B. Ayoade, M. O. Raji, A. A. Akindele, K. J. Yusuf-Mashopa, M. F. Abdulrauf, I. A. Raji, F. B. Musah, Hyperparameter optimisation for support vector machine-based disease detection in maize leaf variants , African Scientific Reports: Volume 4, Issue 3, December 2025
- Adebayo Abdulganiyu Keji, Oluwafemi Fakeye, Nneka N. Onochie, Olumide Sangotoki, Predicting long-term deposit customers using convolutional neural network and data conversion technique , African Scientific Reports: Volume 3, Issue 3, December 2024
- Gabriel James, Anietie Ekong, Etimbuk Abraham, Enobong Oduobuk, Nseobong Michael, Victor Ufford, Oscar Ebong, An enhanced control solutions for efficient urban waste management using deep learning algorithms , African Scientific Reports: Volume 3, Issue 3, December 2024
- A. I. Bassey, M. A. Agana, E. A. Edim, O. Njama-Abang, Intrusion detection in a controlled computer network environment using hybridized random forest and long short-term memory algorithms , African Scientific Reports: Volume 4, Issue 3, December 2025
- Denis U. Ashishie, Endurance O. Obi, Osowomuabe Njama-Abang, Ahena I. Bassey, Transformative approach in Lassa fever diagnostics: an innovative integrative strategy for early detection and outcome prediction , African Scientific Reports: Volume 4, Issue 3, December 2025
- Mutiat A. Ogunrinde, Yusuf B. Yusuf, A culturally aware NLP approach for fake-news detection in Nigerian online media using BERT , African Scientific Reports: Volume 5, Issue 2, August 2026
- Osowomuabe Njama-Abang, Denis U. Ashishie, Emmanuel A. Edim, Moses A. Agana, Development of a visual analogy model using transfer learning techniques , African Scientific Reports: Volume 4, Issue 3, December 2025
- Adenike Adegoke-Elijah, Theresa Omolayo Ojewumi, Kudirat Oyewumi Jimoh, ECG anomaly detection: a deep learning perspective with LSTM encoders , African Scientific Reports: Volume 4, Issue 3, December 2025
You may also start an advanced similarity search for this article.