Abstract
Continuous water quality monitoring is critical for ensuring water safety and reliability. Detecting abnormal events remains challenging because anomalies represent only a small fraction of observations. This extreme class imbalance often degrades the performance of conventional machine learning and deep learning models. To address this challenge, this paper introduces Transformer-LoRAMoE, an explainable and parameter-efficient Transformer framework that integrates sparse Mixture-of-Experts (MoE) learning with Low-Rank Adaptation (LoRA) for water quality event detection. The architecture combines long-range temporal modeling with expert specialization and low-rank adaptation, enabling effective learning under highly imbalanced conditions. In addition, different imbalance-handling strategies and cost-sensitive loss functions are systematically investigated. The framework is evaluated on the publicly available GECCO2018 and GECCO2019 water quality monitoring datasets through a benchmark comprising 168 experimental configurations. Results show that Transformer-based architectures consistently outperform conventional machine learning approaches under extreme class imbalance. Statistical validation further confirms the superiority of Transformer-LoRAMoE over several Transformer baselines. SHAP-based explainability analysis identifies water temperature, chlorine concentration, pH, and conductivity as the most influential variables, accounting for approximately 86\% of the total feature importance. A computational-efficiency study also demonstrates that the LoRA-based design substantially reduces model complexity while maintaining strong predictive performance. Overall, Transformer-LoRAMoE provides an effective, interpretable, and computationally efficient framework for water quality assessment under extreme class imbalance.
Keywords
Water quality monitoring
Rare event detection
Transformer-LoRAMoE
Class imbalance learning
Time-series classification