Skip to content
DraconiticResearch
Search Sources API
203,234 studies31 sourcesUpdated 21 min ago
Peer-reviewedCC BY 4.0Scientific Reports

An explainable swarm-optimized hybrid GRU–Transformer framework with wavelet-based spatial–temporal feature modeling and activation function analysis for rainfall classification across Pakistan’s climatic regimes

Abstract

Accurate rainfall occurrence prediction is essential for climate risk management, flood preparedness, and water resource planning, particularly in climatically diverse regions such as Pakistan. This paper develops and compares a multi-phase classification of rainfall based on daily IMERG precipitation data over six representative Pakistani cities spanning very low-, moderate-, and high-rainfall regimes, i.e., Gharo, Gilgit, Islamabad, Karachi, Swat, and Turbat. The research follows a four-stage modeling process: (i) a baseline set of ensemble-learning models; (ii) a hybrid GRU–RNN model on 30-day temporal sequences with 19 engineered features; (iii) a GRU–RNN optimized with Variational Mode Decomposition (VMD) and the Tiki-Taka Algorithm (TTA); and (iv) a swarm-optimized hybrid GRU–Transformer using wavelet-based spatio-temporal features (W-ST). Four ensemble methods, namely Bagging, Boosting, Voting, and Stacking, were used in the initial phase to classify next-day rainfall. Findings show ensemble models perform well in low-rainfall cities in terms of overall accuracy because of the effect of class imbalance, while predictive performance is more balanced in moderate- and high-rainfall areas. In the second stage, a hybrid GRU–RNN model on 30-day temporal sequences and 19 engineered features showed good discrimination ability across the climatic regimes, with better rainfall-event classification in Karachi and Gharo among the low-rainfall cities and balanced classification in Gilgit and Swat. The analysis of activation functions also showed that ReLU is more effective in highly imbalanced low-rainfall conditions, whereas Tanh is more stable and balanced in moderate and heavy rainfall conditions. The third stage involved optimization of the GRU–RNN using the proposed TTA framework to improve the stability of the classification process, achieved by adding VMD-based multi-scale signal decomposition and adaptive hyperparameter tuning. The optimized framework achieved strong performance across cities, including Karachi (ACC = 0.944, F1 = 0.624, ROC–AUC = 0.885), Gharo (ACC = 0.927, F1 = 0.596), Gilgit (ACC = 0.772, F1 = 0.589, ROC–AUC = 0.834), and Swat (ACC = 0.656, F1 = 0.556). In the fourth stage, to enhance predictive performance, a swarm-intelligence-based hybrid deep-learning system combining W-ST, STFM, HGRA, DTGAM, GRU, and Transformer modules was developed using Particle Swarm Optimization (PSO) and Glowworm Swarm Optimization (GSO). Empirical findings show that PSO offers greater performance stability in most cities, especially Gharo, Karachi, Islamabad, and Swat, whereas GSO can offer better localized performance in Gilgit and Turbat. The activation-wise assessment shows that Tanh-based networks consistently generate better F1-scores and ROC–AUC values, whereas ReLU provides slightly more accurate results in extreme class-imbalance situations. In general, the proposed PSO/GSO hybrid framework achieved high classification performance across a variety of climatic regimes. The highest overall performance was achieved with GSO–Turbat in the Tanh configuration (ACC = 0.9617, F1 = 0.754, ROC–AUC = 0.956), followed by PSO–Turbat (ACC = 0.9583). PSO-based configurations in Gharo and Karachi were highly stable, with accuracies of 0.9392 and 0.9351, respectively. In moderate-rainfall regions, Gilgit achieved optimal performance with GSO–ReLU (ACC = 0.9064, F1 = 0.806, ROC–AUC = 0.953), while Islamabad performed best with PSO–Tanh (ACC = 0.8838, F1 = 0.782, ROC–AUC = 0.927). In all cities, ROC–AUC values were high (≈ 0.90–0.95), indicating strong discrimination ability between rain and non-rain events. The explainability analysis conducted using SHAP revealed wavelet-derived components, lagged rainfall variables, persistence measures, and seasonal encodings as the top predictors, suggesting that the proposed framework captures physically significant rainfall dynamics rather than spurious ones.

Related

  1. From manual classification to transformer-based language models: assessing the quality and consistency of historical convective event records
    Franck Schätz, Rüdiger Glaser
    Climate of the PastPeer-reviewedCC BY 4.0Full textClimate scienceCrossref
  2. Explainable quantum inspired LSTM model for water quality classification in fishponds
    Peda Gopi Arepalli, Chin-Shiuh Shieh, Satyanarayana Sanakkayala +1
    Scientific ReportsPeer-reviewedCC BY 4.0Full textHydrology & soilsCrossref
  3. Explainable AI with dual-layer validation framework for ensuring noise resilience and physical consistency in low-cost sustainable water quality monitoring
    Wibowo Harry Sugiharto, Rizkysari Meimaharani, Ahmad Abdul Chamid +2
    Discover SustainabilityPeer-reviewedCC BYFull textHydrology & soilsDOAJ
  4. A Hybrid Framework for Air Pollution Forecasting using DSES, DLA, Self-Attention Transformer, and BiGRU with Bayesian Optimization
    Talabathula Jayanth, A. Manimaran, S. Srinivas
    Scientific ReportsPeer-reviewedCC BYFull textEnvironmental science & pollutionDOAJ
  5. Explainable and Uncertainty-Aware Computational Geodetic Inversion: A Review and Framework for Multi-Source Earth Observation
    MOHIT SHEODE, Kishan D.
    EarthArXivPreprintCC BY-NC 4.0Full textGeophysics & seismologyEarthArXiv
BibTeX
@article{farman2026explainable,
  title = {{An explainable swarm-optimized hybrid GRU–Transformer framework with wavelet-based spatial–temporal feature modeling and activation function analysis for rainfall classification across Pakistan’s climatic regimes}},
  author = {Hira Farman and Muhammad Arif Hussain and Umme Laila and Muhammad Mansoor Alam and Mazliham M. Su’ud and Nurashikin Saaludin and Talha Ahmed Khan},
  journal = {Scientific Reports},
  year = {2026},
  month = oct,
  doi = {10.1038/s41598-026-73512-9},
  url = {https://www.nature.com/articles/s41598-026-73512-9},
  note = {CC BY 4.0},
}
RIS
TY  - JOUR
TI  - An explainable swarm-optimized hybrid GRU–Transformer framework with wavelet-based spatial–temporal feature modeling and activation function analysis for rainfall classification across Pakistan’s climatic regimes
AU  - Hira Farman
AU  - Muhammad Arif Hussain
AU  - Umme Laila
AU  - Muhammad Mansoor Alam
AU  - Mazliham M. Su’ud
AU  - Nurashikin Saaludin
AU  - Talha Ahmed Khan
PY  - 2026
DA  - 2026/10/23
JO  - Scientific Reports
DO  - 10.1038/s41598-026-73512-9
UR  - https://www.nature.com/articles/s41598-026-73512-9
AB  - Accurate rainfall occurrence prediction is essential for climate risk management, flood preparedness, and water resource planning, particularly in climatically diverse regions such as Pakistan. This paper develops and compares a multi-phase classification of rainfall based on daily IMERG precipitation data over six representative Pakistani cities spanning very low-, moderate-, and high-rainfall regimes, i.e., Gharo, Gilgit, Islamabad, Karachi, Swat, and Turbat. The research follows a four-stage modeling process: (i) a baseline set of ensemble-learning models; (ii) a hybrid GRU–RNN model on 30-day temporal sequences with 19 engineered features; (iii) a GRU–RNN optimized with Variational Mode Decomposition (VMD) and the Tiki-Taka Algorithm (TTA); and (iv) a swarm-optimized hybrid GRU–Transformer using wavelet-based spatio-temporal features (W-ST). Four ensemble methods, namely Bagging, Boosting, Voting, and Stacking, were used in the initial phase to classify next-day rainfall. Findings show ensemble models perform well in low-rainfall cities in terms of overall accuracy because of the effect of class imbalance, while predictive performance is more balanced in moderate- and high-rainfall areas. In the second stage, a hybrid GRU–RNN model on 30-day temporal sequences and 19 engineered features showed good discrimination ability across the climatic regimes, with better rainfall-event classification in Karachi and Gharo among the low-rainfall cities and balanced classification in Gilgit and Swat. The analysis of activation functions also showed that ReLU is more effective in highly imbalanced low-rainfall conditions, whereas Tanh is more stable and balanced in moderate and heavy rainfall conditions. The third stage involved optimization of the GRU–RNN using the proposed TTA framework to improve the stability of the classification process, achieved by adding VMD-based multi-scale signal decomposition and adaptive hyperparameter tuning. The optimized framework achieved strong performance across cities, including Karachi (ACC = 0.944, F1 = 0.624, ROC–AUC = 0.885), Gharo (ACC = 0.927, F1 = 0.596), Gilgit (ACC = 0.772, F1 = 0.589, ROC–AUC = 0.834), and Swat (ACC = 0.656, F1 = 0.556). In the fourth stage, to enhance predictive performance, a swarm-intelligence-based hybrid deep-learning system combining W-ST, STFM, HGRA, DTGAM, GRU, and Transformer modules was developed using Particle Swarm Optimization (PSO) and Glowworm Swarm Optimization (GSO). Empirical findings show that PSO offers greater performance stability in most cities, especially Gharo, Karachi, Islamabad, and Swat, whereas GSO can offer better localized performance in Gilgit and Turbat. The activation-wise assessment shows that Tanh-based networks consistently generate better F1-scores and ROC–AUC values, whereas ReLU provides slightly more accurate results in extreme class-imbalance situations. In general, the proposed PSO/GSO hybrid framework achieved high classification performance across a variety of climatic regimes. The highest overall performance was achieved with GSO–Turbat in the Tanh configuration (ACC = 0.9617, F1 = 0.754, ROC–AUC = 0.956), followed by PSO–Turbat (ACC = 0.9583). PSO-based configurations in Gharo and Karachi were highly stable, with accuracies of 0.9392 and 0.9351, respectively. In moderate-rainfall regions, Gilgit achieved optimal performance with GSO–ReLU (ACC = 0.9064, F1 = 0.806, ROC–AUC = 0.953), while Islamabad performed best with PSO–Tanh (ACC = 0.8838, F1 = 0.782, ROC–AUC = 0.927). In all cities, ROC–AUC values were high (≈ 0.90–0.95), indicating strong discrimination ability between rain and non-rain events. The explainability analysis conducted using SHAP revealed wavelet-derived components, lagged rainfall variables, persistence measures, and seasonal encodings as the top predictors, suggesting that the proposed framework captures physically significant rainfall dynamics rather than spurious ones.
SN  - 2045-2322
ER  -