Omar El-Dakhakhni, Zhong Li, Pengxiao Zhou, Spencer Snowling
Accurate prediction of wastewater influent quality is critical for optimizing treatment plant operations, minimizing environmental impact, and enabling proactive management under dynamic conditions. However, the complex, nonlinear, and temporally dependent nature of influent processes poses significant challenges to traditional modeling approaches. This study introduces a robust stacked ensemble learning framework that integrates Long Short-Term Memory (LSTM), Support Vector Regression (SVR), and Extreme Gradient Boosting (XGBoost) to forecast three key influent quality parameters: biochemical oxygen demand (BOD5), total phosphorus (TP), and total solids (TS) at a municipal wastewater treatment plant (WWTP) in Canada. Through sequential backward feature selection and SHapley Additive exPlanations (SHAP), the model achieves both high predictive accuracy and interpretability, providing insights into temporal, environmental, and process-based drivers of influent variability. The ensemble consistently outperforms individual models, delivering high generalization performance across all three influent quality targets. This work demonstrates that stacked ensemble models, when coupled with explainable AI techniques, can bridge the gap between black-box performance and operational transparency in wastewater forecasting. The proposed framework lays the groundwork for more resilient, data-driven decision-making in municipal WWTPs.