Explainable Machine Learning for Long-Term Monthly Hydroclimatic Forecasting and Extreme-Event Detection
Abstract
Long-term hydroclimatic prediction in arid urban environments remains methodologically demanding because monthly records are often intermittent, highly seasonal, zero-inflated, and dominated by rare but consequential extreme events. Using a 121-year monthly hydroclimatic record for Makkah, Saudi Arabia, spanning January 1901 to December 2021, this study develops an explainable hybrid machine-learning framework for monthly forecasting, seasonal diagnostics, and extreme-event detection. The dataset contains 1,452 monthly observations with a mean value of 6.19, median of 3.00, standard deviation of 8.05, and maximum of 52.00, indicating a strongly skewed distribution. Exploratory analysis reveals pronounced seasonality: November, December, and January exhibit the highest hydroclimatic values, whereas June is consistently dry across the full record. A temporal feature set was constructed using lag variables, rolling statistics, annual seasonal memory, cyclical month encodings, and trend indicators. Several predictive models were evaluated, including Random Forest, Extra Trees, Histogram Gradient Boosting, XGBoost, and a hybrid SARIMA–Random Forest residual-correction model. Extra Trees achieved the best forecasting performance on the holdout period, with MAE = 2.997, RMSE = 5.603, sMAPE = 57.669%, and R² = 0.518. Extreme-event detection was performed using a 90th-percentile threshold of 17.68, identifying 146 extreme months over the full record. The best classification trade-off was obtained by Histogram Gradient Boosting, while Random Forest produced the highest ROC-AUC. SHAP-based interpretation demonstrates that seasonal phase variables and annual memory features dominate model behaviour, especially month_cos, month_sin, same_month_last_year, and lag_12. The findings show that interpretable ensemble learning can provide a more transparent and operationally relevant framework than accuracy-only forecasting for arid-region hydroclimatic risk assessment.
References
Almazroui, M. (2011). Calibration of TRMM rainfall climatology over Saudi Arabia during 1998–2009. Atmospheric Research, 99(3–4), 400–414. doi:10.1016/j.atmosres.2010.11.006
Almazroui, M., Nazrul Islam, M., Athar, H., Jones, P. D., & Rahman, M. A. (2012). Recent climate change in the Arabian Peninsula: Annual rainfall and temperature analysis of Saudi Arabia for 1978–2009. International Journal of Climatology, 32(6), 953–966. doi:10.1002/joc.3446
Alexander, L. V., Zhang, X., Peterson, T. C., Caesar, J., Gleason, B., Klein Tank, A. M. G., et al. (2006). Global observed changes in daily climate extremes of temperature and precipitation. Journal of Geophysical Research: Atmospheres, 111, D05109. doi:10.1029/2005JD006290
Adadi, A., & Berrada, M. (2018). Peeking inside the black-box: A survey on explainable artificial intelligence. IEEE Access, 6, 52138–52160. doi:10.1109/ACCESS.2018.2870052
Arrieta, A. B., Díaz-Rodríguez, N., Del Ser, J., Bennetot, A., Tabik, S., Barbado, A., et al. (2020). Explainable Artificial Intelligence: Concepts, taxonomies, opportunities and challenges toward responsible AI. Information Fusion, 58, 82–115. doi:10.1016/j.inffus.2019.12.012
Bergmeir, C., Hyndman, R. J., & Koo, B. (2018). A note on the validity of cross-validation for evaluating autoregressive time series prediction. Computational Statistics & Data Analysis, 120, 70–83. doi:10.1016/j.csda.2017.11.003
Bi, K., Xie, L., Zhang, H., Chen, X., Gu, X., & Tian, Q. (2023). Accurate medium-range global weather forecasting with 3D neural networks. Nature, 619, 533–538. doi:10.1038/s41586-023-06185-3
Breiman, L. (2001). Random forests. Machine Learning, 45, 5–32. doi:10.1023/A:1010933404324
Chandola, V., Banerjee, A., & Kumar, V. (2009). Anomaly detection: A survey. ACM Computing Surveys, 41(3), Article 15. doi:10.1145/1541880.1541882
De Livera, A. M., Hyndman, R. J., & Snyder, R. D. (2011). Forecasting time series with complex seasonal patterns using exponential smoothing. Journal of the American Statistical Association, 106(496), 1513–1527. doi:10.1198/jasa.2011.tm09771
Donat, M. G., Lowry, A. L., Alexander, L. V., O’Gorman, P. A., & Maher, N. (2016). More extreme precipitation in the world’s dry and wet regions. Nature Climate Change, 6, 508–513. doi:10.1038/nclimate2941
Dueben, P. D., & Bauer, P. (2018). Challenges and design choices for global weather and climate models based on machine learning. Geoscientific Model Development, 11, 3999–4009. doi:10.5194/gmd-11-3999-2018
Fischer, E. M., & Knutti, R. (2016). Observed heavy precipitation increase confirms theory and early models. Nature Climate Change, 6, 986–991. doi:10.1038/nclimate3110
Friedman, J. H. (2001). Greedy function approximation: A gradient boosting machine. The Annals of Statistics, 29(5), 1189–1232. doi:10.1214/aos/1013203451
Gauch, M., Kratzert, F., Klotz, D., Nearing, G., Lin, J., & Hochreiter, S. (2021). Rainfall–runoff prediction at multiple timescales with a single Long Short-Term Memory network. Hydrology and Earth System Sciences, 25, 2045–2062. doi:10.5194/hess-25-2045-2021
Geurts, P., Ernst, D., & Wehenkel, L. (2006). Extremely randomized trees. Machine Learning, 63, 3–42. doi:10.1007/s10994-006-6226-1
Goldstein, M., & Uchida, S. (2016). A comparative evaluation of unsupervised anomaly detection algorithms for multivariate data. PLOS ONE, 11(4), e0152173. doi:10.1371/journal.pone.0152173
Ham, Y.-G., Kim, J.-H., & Luo, J.-J. (2019). Deep learning for multi-year ENSO forecasts. Nature, 573, 568–572. doi:10.1038/s41586-019-1559-7
Hewamalage, H., Bergmeir, C., & Bandara, K. (2021). Recurrent neural networks for time series forecasting: Current status and future directions. International Journal of Forecasting, 37(1), 388–427. doi:10.1016/j.ijforecast.2020.06.008
Hyndman, R. J., & Khandakar, Y. (2008). Automatic time series forecasting: The forecast package for R. Journal of Statistical Software, 27(3), 1–22. doi:10.18637/jss.v027.i03
Hyndman, R. J., & Koehler, A. B. (2006). Another look at measures of forecast accuracy. International Journal of Forecasting, 22(4), 679–688. doi:10.1016/j.ijforecast.2006.03.001
Klotz, D., Kratzert, F., Gauch, M., Keefe Sampson, A., Brandstetter, J., Klambauer, G., Hochreiter, S., & Nearing, G. (2022). Uncertainty estimation with deep learning for rainfall–runoff modeling. Hydrology and Earth System Sciences, 26, 1673–1693. doi:10.5194/hess-26-1673-2022
Kratzert, F., Klotz, D., Brenner, C., Schulz, K., & Herrnegger, M. (2018). Rainfall–runoff modelling using Long Short-Term Memory networks. Hydrology and Earth System Sciences, 22, 6005–6022. doi:10.5194/hess-22-6005-2018
Kratzert, F., Klotz, D., Herrnegger, M., Sampson, A. K., Hochreiter, S., & Nearing, G. S. (2019). Toward improved predictions in ungauged basins: Exploiting the power of machine learning. Water Resources Research, 55(12), 11344–11354. doi:10.1029/2019WR026065
Lam, R., Sanchez-Gonzalez, A., Willson, M., Wirnsberger, P., Fortunato, M., Alet, F., et al. (2023). Learning skillful medium-range global weather forecasting. Science, 382, 1416–1421. doi:10.1126/science.adi2336
Lim, B., Arık, S. Ö., Loeff, N., & Pfister, T. (2021). Temporal Fusion Transformers for interpretable multi-horizon time series forecasting. International Journal of Forecasting, 37(4), 1748–1764. doi:10.1016/j.ijforecast.2021.03.012
Lundberg, S. M., Erion, G., Chen, H., DeGrave, A., Prutkin, J. M., Nair, B., et al. (2020). From local explanations to global understanding with explainable AI for trees. Nature Machine Intelligence, 2, 56–67. doi:10.1038/s42256-019-0138-9
Makridakis, S., Spiliotis, E., & Assimakopoulos, V. (2020). The M4 Competition: 100,000 time series and 61 forecasting methods. International Journal of Forecasting, 36(1), 54–74. doi:10.1016/j.ijforecast.2019.04.014
Min, S.-K., Zhang, X., Zwiers, F. W., & Hegerl, G. C. (2011). Human contribution to more-intense precipitation extremes. Nature, 470, 378–381. doi:10.1038/nature09763
Montero-Manso, P., Athanasopoulos, G., Hyndman, R. J., & Talagala, T. S. (2020). FFORMA: Feature-based forecast model averaging. International Journal of Forecasting, 36(1), 86–92. doi:10.1016/j.ijforecast.2019.02.011
Nearing, G. S., Kratzert, F., Sampson, A. K., Pelissier, C. S., Klotz, D., Frame, J. M., Prieto, C., & Gupta, H. V. (2021). What role does hydrological science play in the age of machine learning? Water Resources Research, 57(3), e2020WR028091. doi:10.1029/2020WR028091
Pham, L. T., Luo, L., & Finley, A. (2021). Evaluation of random forests for short-term daily streamflow forecasting in rainfall- and snowmelt-driven watersheds. Hydrology and Earth System Sciences, 25, 2997–3015. doi:10.5194/hess-25-2997-2021
Rasp, S., Dueben, P. D., Scher, S., Weyn, J. A., Mouatadid, S., & Thuerey, N. (2020). WeatherBench: A benchmark dataset for data-driven weather forecasting. Journal of Advances in Modeling Earth Systems, 12, e2020MS002203. doi:10.1029/2020MS002203
Ravuri, S., Lenc, K., Willson, M., Kangin, D., Lam, R., Mirowski, P., et al. (2021). Skilful precipitation nowcasting using deep generative models of radar. Nature, 597, 672–677. doi:10.1038/s41586-021-03854-z
Reichstein, M., Camps-Valls, G., Stevens, B., Jung, M., Denzler, J., Carvalhais, N., & Prabhat. (2019). Deep learning and process understanding for data-driven Earth system science. Nature, 566, 195–204. doi:10.1038/s41586-019-0912-1
Rolnick, D., Donti, P. L., Kaack, L. H., Kochanski, K., Lacoste, A., Sankaran, K., et al. (2022). Tackling climate change with machine learning. ACM Computing Surveys, 55(2), Article 42. doi:10.1145/3485128
Salinas, D., Flunkert, V., Gasthaus, J., & Januschowski, T. (2020). DeepAR: Probabilistic forecasting with autoregressive recurrent networks. International Journal of Forecasting, 36(3), 1181–1191. doi:10.1016/j.ijforecast.2019.07.001
Shen, C. (2018). A transdisciplinary review of deep learning research and its relevance for water resources scientists. Water Resources Research, 54(11), 8558–8593. doi:10.1029/2018WR022643
Slater, L. J., Arnal, L., Boucher, M.-A., Chang, A. Y.-Y., Moulds, S., Murphy, C., Nearing, G., et al. (2023). Hybrid forecasting: Blending climate predictions with AI models. Hydrology and Earth System Sciences, 27, 1865–1889. doi:10.5194/hess-27-1865-2023
Smyl, S. (2020). A hybrid method of exponential smoothing and recurrent neural networks for time series forecasting. International Journal of Forecasting, 36(1), 75–85. doi:10.1016/j.ijforecast.2019.03.017
Tjoa, E., & Guan, C. (2021). A survey on explainable artificial intelligence: Toward medical XAI. IEEE Transactions on Neural Networks and Learning Systems, 32(11), 4793–4813. doi:10.1109/TNNLS.2020.3027314
Tripathy, K. P., & Mishra, A. K. (2024). Deep learning in hydrology and water resources disciplines: Concepts, methods, applications, and research directions. Journal of Hydrology, 628, 130458. doi:10.1016/j.jhydrol.2023.130458
Wang, X., Alharbi, R. S., Baez-Villanueva, O. M., Green, A., McCabe, M. F., Wada, Y., Van Dijk, A. I. J. M., Abid, M. A., & Beck, H. E. (2025). Saudi Rainfall (SaRa): Hourly 0.1° gridded rainfall for Saudi Arabia via machine learning fusion of satellite and model data. Hydrology and Earth System Sciences, 29, 4983–5003. doi:10.5194/hess-29-4983-2025
Westra, S., Fowler, H. J., Evans, J. P., Alexander, L. V., Berg, P., Johnson, F., et al. (2014). Future changes to the intensity and frequency of short-duration extreme rainfall. Reviews of Geophysics, 52, 522–555. doi:10.1002/2014RG000464
Willard, J., Jia, X., Xu, S., Steinbach, M., & Kumar, V. (2022). Integrating scientific knowledge with machine learning for engineering and environmental systems. ACM Computing Surveys, 55(4), Article 66. doi:10.1145/3514228
Zhang, G. P. (2003). Time series forecasting using a hybrid ARIMA and neural network model. Neurocomputing, 50, 159–175. doi:10.1016/S0925-2312(01)00702-0
Zittis, G., Almazroui, M., Alpert, P., Ciais, P., Cramer, W., Dahdal, Y., et al. (2022). Climate change and weather extremes in the Eastern Mediterranean and Middle East. Reviews of Geophysics, 60(3), e2021RG000762. doi:10.1029/2021RG000762





