Comparison of Machine Learning Methods for Monthly Rainfall Forecasting Using k-Nearest Neighbors, Random Forest, and Artificial Neural Networks

Abstract Rainfall is an important meteorological parameter across various sectors and exhibits complex nonlinear characteristics, requiring reliable forecasting methods. This study aims to compare the performance of three machine learning algorithms—k-Nearest Neighbors (kNN), Random Forest (RF), and Artificial Neural Networks (ANN)—for monthly rainfall forecasting at the Depati Amir Meteorological Station, Pangkalpinang, using data from 2015 to 2024. The predictor variables included rainfall, mean air temperature, relative humidity, sunshine duration, and rainfall lag features. The modeling process consisted of data preprocessing, feature engineering, hyperparameter optimization using Time Series Cross-Validation, and model evaluation based on Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and the coefficient of determination (R²). The results indicate that the Random Forest model achieved the best predictive performance (MAE = 75.73 mm, RMSE = 89.50 mm, R² = 0.605), followed by kNN (R² = 0.492) and ANN (R² = 0.303). These findings demonstrate that Random Forest is more effective than the other two algorithms for monthly rainfall forecasting in the study area.

Authors

Institutions

Publication Details

Journal
Research Square
Published
2026-10-29
DOI
https://doi.org/10.21203/rs.3.rs-11531449/v1
Primary Topic
Hydrological Forecasting Using AI
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Comparison of Machine Learning Methods for Monthly Rainfall Forecasting Using k-Nearest Neighbors, Random Forest, and Artificial Neural Networks

Mico Maulana, Giarno
3 links
Research Square
Hydrological Forecasting Using AI
preprint

Comparison of Machine Learning Methods for Monthly Rainfall Forecasting Using k-Nearest Neighbors, Random Forest, and Artificial Neural Networks

Mico Maulana, Giarno
preprint en

Abstract

Abstract Rainfall is an important meteorological parameter across various sectors and exhibits complex nonlinear characteristics, requiring reliable forecasting methods. This study aims to compare the performance of three machine learning algorithms—k-Nearest Neighbors (kNN), Random Forest (RF), and Artificial Neural Networks (ANN)—for monthly rainfall forecasting at the Depati Amir Meteorological Station, Pangkalpinang, using data from 2015 to 2024. The predictor variables included rainfall, mean air temperature, relative humidity, sunshine duration, and rainfall lag features. The modeling process consisted of data preprocessing, feature engineering, hyperparameter optimization using Time Series Cross-Validation, and model evaluation based on Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and the coefficient of determination (R²). The results indicate that the Random Forest model achieved the best predictive performance (MAE = 75.73 mm, RMSE = 89.50 mm, R² = 0.605), followed by kNN (R² = 0.492) and ANN (R² = 0.303). These findings demonstrate that Random Forest is more effective than the other two algorithms for monthly rainfall forecasting in the study area.

Research Square
Meteorological, Climatological, And Geophysical Agency (ID)
Climate action
Hydrological Forecasting Using AI
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon