Rainfall Classification Using Temperature and Precipitation Metrics: A MATLAB Implementation

Authors

  • Adil Khursheed Source Code Private Limited Karachi, Pakistan
  • Irteza Hasham Department of Robotics and Artifical Intelligence, SZABIST University, Karachi, Pakistan
  • Muhammad Waqar Khan Department of Robotics and Artificial Intelligence, SZABIST University Karachi, Pakistan
  • Syed Umarullah Hussaini Department of Robotics and Artificial Intelligence, SZABIST University Karachi, Pakistan

Keywords:

Logistic Regression, KNearest Neighbors, LIME, data-driven prediction

Abstract

This study explores a data-driven prediction of rainfall through binary classification models trained by historical weather data in Seattle, Washington. Using a dataset covering the period 1948 to 2017, this study employs three meteorological values namely precipitation (PRCP), maximum temperature (TMAX), and minimum temperature (TMIN) to formulate and assess predictive models in MATLAB. Four algorithms of machine learning are evaluated as follows: Decision Tree, Logistic Regression, K Nearest Neighbors (KNN), and Linear Discriminant Analysis. These well generalized models are the Decision Tree model and Logistic Regression model that had perfect classification accuracy when tested and zero misclassification cost. The study also uses LIME (Local Interpretable Model-Agnostic Explanations) to visualize feature contributions, further verifying that precipitation was the most important predictor. The findings indicate that viable rainfall forecasting can be effected with little input, as is the case with the models, which can also be used to provide predictive solutions in resource constrained implementations like civic development or smart farming practices. Although such a finding is promising, the article does not overlook these limitations including the limitation to collect other weather variables and the exclusion of external validation.

References

X. Xiang, Q. Li, S. Khan, and O. I. Khalaf, “Urban water resource management for sustainable environment planning using artificial intelligence techniques,” Environmental Impact Assessment Review, vol. 86, Art. no. 106515, 2021.

P. Umamaheswari and V. Ramaswamy, “Enhancing rainfall prediction accuracy through fog computing: Integration of advanced algorithms and edge analytics,” in Advanced Applications in Osmotic Computing, pp. 53–72, 2024.

NOAA Climate.gov, “2024: An active year of U.S. billion-dollar weather and climate disasters,” Jan. 10, 2025. [Online]. Available: https://www.climate.gov/news-features/blogs/beyond-data/2024-active-year-us-billion-dollar-weather-and-climate-disasters. [Accessed: Jun. 2026].

M. M. Jaber, M. H. Ali, S. K. Abd, M. M. Jassim, A. Alkhayyat, H. W. Aziz, and A. R. Alkhuwaylidee, “Predicting climate factors based on big data analytics based agricultural disaster management,” Physics and Chemistry of the Earth, Parts A/B/C, vol. 128, Art. no. 103243, 2022.

D. Yang, W. Wang, and T. Hong, “A historical weather forecast dataset from the European Centre for Medium-Range Weather Forecasts (ECMWF) for energy forecasting,” Solar Energy, vol. 232, pp. 263–274, 2022.

A. Elbeltagi, C. B. Pande, M. Kumar, A. D. Tolche, S. K. Singh, A. Kumar, and D. K. Vishwakarma, “Prediction of meteorological drought and standardized precipitation index based on the random forest (RF), random tree (RT), and Gaussian process regression (GPR) models,” Environmental Science and Pollution Research, vol. 30, no. 15, pp. 43183–43202, 2023.

J. Liu, J. Wang, J. Xiong, W. Cheng, Y. Li, Y. Cao, et al., “Assessment of flood susceptibility mapping using support vector machine, logistic regression and their ensemble techniques in the Belt and Road region,” Geocarto International, vol. 37, no. 25, pp. 9817–9846, 2022.

N. A. F. Sulaiman, S. M. Shaharudin, S. Ismail, N. H. Zainuddin, M. L. Tan, and Y. Abd Jalil, “Predictive modelling of statistical downscaling based on hybrid machine learning model for daily rainfall in east-coast Peninsular Malaysia,” Symmetry, vol. 14, no. 5, Art. no. 927, 2022.

C. C. Crossett, A. K. Betts, L. A. L. Dupigny-Giroux, and A. Bomblies, “Evaluation of daily precipitation from the ERA5 global reanalysis against GHCN observations in the northeastern United States,” Climate, vol. 8, no. 12, Art. no. 148, 2020.

S. Niazai, A. A. Rahimzai, and H. Atifnigar, “Applications of MATLAB in natural sciences: A comprehensive review,” European Journal of Theoretical and Applied Sciences, vol. 1, pp. 1006–1015, 2023.

M. A. A. Mehedi, M. Khosravi, M. M. S. Yazdan, and H. Shabanian, “Exploring temporal dynamics of river discharge using univariate long short-term memory (LSTM) recurrent neural network at East Branch of Delaware River,” Hydrology, vol. 9, no. 11, Art. no. 202, 2022.

S. A. R. A. H. Benziane and U. M. B., “Survey: Rainfall prediction precipitation, review of statistical methods,” WSEAS Transactions on Systems, vol. 23, pp. 47–59, 2024.

H. K. Mohajan, “Quantitative research: A successful investigation in natural and social sciences,” Journal of Economic Development, Environment and People, vol. 9, no. 4, pp. 50–79, 2020.

Downloads

Published

2026-06-04