NEXT-DAY RAINFALL CATEGORY PREDICTION USING ENSEMBLE MACHINE LEARNING AND SHAP
Keywords:
rainfall prediction; BMKG; ensemble learning; feature engineering; SHAPAbstract
Rainfall intensity varies substantially over time and is difficult to classify using simple linear approaches because meteorological variables interact nonlinearly. This study develops a day-ahead rainfall-category classification framework using meteorological observations from BMKG for 2025. The dataset contains 366 daily observations of rainfall, temperature, humidity, wind speed, and wind direction. Temporal feature engineering was applied through three-, five-, and seven-day rainfall accumulation as well as rolling humidity and wind-speed features. Random Forest, XGBoost, and LightGBM were trained and compared using accuracy, weighted precision, weighted recall, and weighted F1-score. Hyperparameter tuning was performed using cross-validation, and SHAP was employed to interpret the selected model. XGBoost produced the best balance between precision and recall, with accuracy of 0.8356, weighted precision of 0.7710, weighted recall of 0.8356, and weighted F1-score of 0.8010. The five-fold cross-validation score was 0.8528. SHAP analysis identified humidity as the most influential feature, followed by seven-day rainfall accumulation and five-day rainfall accumulation. These findings indicate that short-term meteorological history and atmospheric humidity are important signals for day-ahead rainfall-category classification.
References
L. Breiman, “Random forests,” Machine Learning, vol. 45, no. 1, pp. 5–32, 2001, doi: 10.1023/A:1010933404324.
T. Chen and C. Guestrin, “XGBoost: A scalable tree boosting system,” in Proc. 22nd ACM SIGKDD Int. Conf. Knowledge Discovery and Data Mining, 2016, pp. 785–794, doi: 10.1145/2939672.2939785.
G. Ke et al., “LightGBM: A highly efficient gradient boosting decision tree,” in Advances in Neural Information Processing Systems, vol. 30, 2017.
S. M. Lundberg and S.-I. Lee, “A unified approach to interpreting model predictions,” in Advances in Neural Information Processing Systems, vol. 30, 2017.
F. Pedregosa et al., “Scikit-learn: Machine learning in Python,” Journal of Machine Learning Research, vol. 12, pp. 2825–2830, 2011.
A. Y. Barrera-Animas, L. O. Oyedele, M. Bilal, T. D. Akinosho, J. M. Davila Delgado, and L. A. Akanbi, “Rainfall prediction: A comparative analysis of modern machine learning algorithms for time-series forecasting,” Machine Learning with Applications, vol. 7, p. 100204, 2022, doi: 10.1016/j.mlwa.2021.100204.
C. G. L. Pringandana and K. Kusnawi, “A comparative analysis of hyperparameter-tuned XGBoost and LightGBM for multiclass rainfall classification in Jakarta,” Jurnal Teknik Informatika (JUTIF), vol. 6, no. 4, pp. 2467–2483, 2025, doi: 10.52436/1.jutif.2025.6.4.4965.
H. Gani, “An explainable machine learning model to explain the influential climate parameters based on rainfall prediction,” Jurnal IT: Media Informasi STMIK Handayani Makassar, vol. 15, no. 2, 2024/2025, doi: 10.37639/jti.v15i2.378.
S. M. Malakouti, “Leveraging SHapley Additive exPlanations (SHAP) and fuzzy logic for efficient rainfall forecasts,” Scientific Reports, vol. 15, art. no. 36499, 2025, doi: 10.1038/s41598-025-22081-4.
F. Chollet, Deep Learning with Python, 2nd ed. Shelter Island, NY, USA: Manning, 2021.



