Statistical performance analysis
Table 3 summarizes the statistical comparative performance across all evaluated algorithms during the test phase.
The results demonstrate that the proposed hybrid (RF-MLP) model consistently outperforms all other architectures, achieving near-perfect metrics with a Test RMSE of 0.00012966 and an \(\:{R}^{2}\) of 0.9999999692. This high level of precision is indicative of the model’s ability to not only learn the primary structural patterns of the data via the RF base but also to refine these predictions by capturing the residual errors through an MLP corrector. While standalone ensemble models achieve high accuracy, the Hybrid model, by adding the MLP corrector, further reduces the error, representing a consistent refinement in predictive precision. This suggests that the residual term contains significant deterministic patterns—likely non-linear spatial dependencies that the tree-based splits of the RF could not fully resolve—which the MLP is adept at identifying. This dual-stage modeling respects the structural strengths of both algorithms: the RF provides a stable, low-variance baseline, while the MLP provides a high-capacity non-linear refinement. Deep learning algorithms like LSTM and GRU are frequently proposed as solutions for datasets with complex dependencies. Indeed, the results show that LSTM and GRU perform exceptionally well (\(\:{R}^{2}\approx\:0.999\)). However, they do not surpass the hybrid RF-MLP in this specific dataset spanning the expanded spatial domain [0, 4.0]. The progression of error increases as the analysis moves toward these deep learning architectures (Test RMSE = 0.003114 for GRU, and 0.003025 for LSTM), suggesting that while these models are adept at capturing dependencies, they may require more extensive hyperparameter tuning or larger datasets to match the precision of refined ensemble hybrids in this specific context. A possible explanation is that the hybrid model leverages the strengths of ensemble learning, which is often more data-efficient than the deep recurrent structures of LSTMs when the dataset size is finite. Furthermore, the residual correction strategy allows the model to explicitly target the ‘hardest’ part of the prediction task—the errors—rather than attempting to learn the entire signal at once. In contrast to the hybrid framework, linear models—specifically Linear Regression and Linear SVM—demonstrate significantly higher error rates and lower variance explanation, underscoring the inadequacy of linear approximations for environmental spatial snapshots that are inherently governed by non-linear physical interactions. A CC and \(\:{R}^{2}\) of nearly 1.0, as seen in the top-performing models, indicate that these architectures have achieved near-perfect mapping of the input-output relationships. Because the training, validation, and testing partitions are synthetically generated from a deterministic, noise-free physical model (specifically, the coupled advection-dispersion-aeration equations), the machine learning algorithms are emulating a mathematically closed, continuous system rather than fitting stochastic, observationally noisy real-world field measurements. Consequently, the near-unity values of \(\:{R}^{2}\) and CC reflect the high-capacity estimators’ absolute precision in emulating the idealized, noise-free physics of mass transport, rather than an expectation of identical statistical performance under unmodeled real-world environmental turbulence and sensor-level measurement errors. While CC and \(\:{R}^{2}\) are high for most of the compared models, the \(\:{R}^{2}\) degrades for the linear models. The Willmott Index (WI), or Index of Agreement, provides additional validation of model skill. For the top models—including Hybrid, RF, GRU, MLP, LSTM, BiLSTM, and GB—the WI is nearly 1.0, reflecting ‘exceptional accuracy’ and ‘strong agreement’ with spatially distributed pollution patterns (e.g., Hybrid WI = 0.9999999986). Even for the poorly performing linear algorithms, the agreement is noticeably lower, suggesting that they fail significantly in both absolute precision and capturing general directional trends. The compared models’ performance was evaluated based on the Scatter Index (SI) criteria, where an SI below 0.1 signifies ‘excellent’ model performance. Applying these thresholds, the Proposed Hybrid (RF-MLP), RF, GRU, LSTM, MLP, BiLSTM, and GB consistently achieved ‘excellent’ ratings with SI values significantly below the 0.1 threshold (e.g., Hybrid SI = 0.00007326). In stark contrast, the linear models yielded significantly higher SI values, placing them in lower performance categories. This disparity validates that for river pollution forecasting, the non-linear mapping capabilities of hybrid algorithms are an operational necessity for achieving reliable, high-fidelity concentration profiles.
Computational complexity and trade-off analysis
In the context of real-time monitoring and autonomous early-warning systems, predictive fidelity must be strategically balanced against computational overhead. The deployment of pollution models in IoT-integrated sensor networks necessitates architectures that can be trained and executed within strict temporal windows, particularly as the sampling frequency of river data increases. The training and inference latencies recorded for the evaluated models reveal critical trade-offs in algorithmic efficiency as shown in Table 4.
Training latency and computational bottlenecks
The training duration serves as a proxy for the offline computational cost of model development. The deep recurrent architectures (LSTM, GRU, BiLSTM) exhibited the highest computational burden. Specifically, the GRU and BiLSTM required 453.19 s and 552.21 s, respectively, to reach convergence—representing an approximately 94.7-fold increase in training time for the BiLSTM compared to the standalone Random Forest model (5.83 s). This latency is a structural hallmark of recurrent networks, where the sequential processing of steps and the optimization of multi-gated weight matrices (input, forget, and output gates) impose a high cost on backpropagation through time (BPTT). While these models are highly effective at capturing dependencies, their training complexity poses a significant bottleneck for systems requiring frequent online retraining or deployment on edge devices with limited memory and processing power. The Proposed Hybrid RF-MLP algorithm occupies a computational “sweet spot,” with a total training time of 22.6 s. Given that this model achieved an order-of-magnitude reduction in RMSE compared to its deep learning peers (e.g., GRU at 0.003114 vs. Hybrid at 0.00012966), this represents an exceptionally high performance-per-second ratio. The marginal 16.75 s increase in training time over the standalone RF (5.83 s) is a justifiable engineering trade-off. It indicates that the MLP residual corrector, while significantly enhancing precision, remains a lightweight architectural addition compared to the massive parameter space of the deep BiLSTM.
Inference feasibility in real-time warning systems
For operational water quality management, inference latency (prediction time) can be more critical than training time. Once deployed, a model must ingest real-time spatial data and generate forecasts near-instantaneously to facilitate rapid emergency intervention. The MLP model demonstrated the highest inference efficiency with a prediction time of 0.1493 s for the entire test set. This speed is attributed to the feed-forward nature of the network, which, post-training, simplifies to a series of optimized matrix multiplications. In contrast, the Hybrid RF-MLP and standard RF models showed higher latencies (2.1275 s and 2.1182 s, respectively). This is due to the computational requirement of traversing a high-density forest of decision trees during the ensemble aggregation phase. However, even at approximately two to three seconds, these inference speeds are more than sufficient for sub-hourly or even minute-by-minute river monitoring. The most notable delays in this updated analysis occurred with the deep recurrent architectures, specifically the BiLSTM (2.9192 s) and LSTM (2.7704 s). For these models, the sequential processing logic and multi-gated weight matrices impose higher computational overhead compared to the proposed hybrid framework.
Statistical stability and reliability of predictions
Table 5 summarizes the statistical comparative performance across all evaluated algorithms during validation phase.
A deeper examination of the validation vs. testing metrics provides critical insights into model generalization and the potential for overfitting. In this study, the performance of the Hybrid, RF, and deep learning models is remarkably consistent between the two phases. For example, the Hybrid RF-MLP algorithm maintains a near-identical error profile across both partitions, with a Validation RMSE of 0.00012442 and a Test RMSE of 0.00012966. Consistently low error rates across both datasets indicate a highly stable architecture with high generalization skills. This stability is often attributed to the ensemble nature of the Random Forest base, which uses bagging to reduce variance. By averaging the results of many uncorrelated decision trees, the model effectively filters out the random fluctuations present in individual sampling points. Similarly, the standalone RF model displays high stability with a Validation RMSE of 0.00013114 and a Test RMSE of 0.00013649, confirming that the high predictive precision is not a result of overfitting to the training or validation data, but rather a reflection of the models’ ability to capture the underlying physical dynamics of the coupled pollution-aeration equations.
Physical based interpretation against AI prediction results
AI prediction results
The hybrid algorithm accurately captured the distinct spatial regimes of the plume, including the near-source peak, the dispersion zone, and the downstream depletion and sag phase. By refining the RF residuals, the MLP successfully eliminated step-like artifacts, resulting in smooth pollutant concentration curves and dissolved oxygen concentration curves that are fully consistent with the numerical results obtained using the explicit finite difference method as illustrated in Fig. 5 for the spatial domain\(\:\:0\:\le\:x\:\le\:4\:\). The spatial distributions of pollutant concentration \(\:P\left(x,t\right)\) and dissolved oxygen concentration \(\:X\left(x,t\right)\) were evaluated at flow velocities \(\:u\:=\:1,\:6\:\) and \(\:11\:\) along the river.

Predicted hybrid AI algorithm for the coupled water pollution and aeration concentrations vs. analytical solver actual data.
Beyond this specific case, the results highlight the broader potential of artificial intelligence to address coupled transport problems of increasing complexity. In realistic environmental systems, pollutant dynamics are often influenced by nonlinear interactions, spatial heterogeneity, and incomplete or noisy measurements, which make classical numerical approaches difficult to scale or computationally expensive. By learning directly from data while remaining guided by the underlying physical trends, hybrid AI models can effectively handle such complexities, improve predictive accuracy, and provide robust estimates even when the governing processes are difficult to model using traditional deterministic solvers. As a result, AI-based algorithms offer a practical and flexible tool for modeling and forecasting coupled pollutant transport and aeration dynamics in real-world river systems.
Regarding model interpretability, it is important to note that since the input is restricted to the spatial coordinate (x), traditional feature importance analyses are not applicable. Instead, the model’s interpretability is established through its physical consistency; the RF-MLP framework successfully captures the complex, non-linear spatial gradients inherent in the Advection-Diffusion Equation, ensuring that the AI-driven predictions remain grounded in the deterministic laws of mass transport and longitudinal dispersion.
To demonstrate the framework’s generalizability beyond the analytical generating equation, the hybrid RF-MLP model was evaluated against an independent validation dataset generated via a Numerical Solver. As illustrated in Fig. 6, the hybrid RF-MLP algorithm demonstrates exceptional agreement with the numerical target, accurately capturing the peak concentrations and arrival times. It is worth mentioning that the cross-solver validation datasets generated via analytical solver (Fig. 5) as well as numerical solver (Fig. 6) provide rigorous evidence that the proposed hybrid RF-MLP algorithm has successfully internalized the underlying physical laws of the coupled pollution–aeration equations, rather than merely performing function approximation of the analytical formula. However, the authors emphasize that this cross-solver comparison fundamentally serves as a rigorous mathematical verification of physical model emulation and mathematical consistency. While it confirms that the hybrid RF-MLP architecture successfully emulates the continuous spatial gradients of the governing transport equations, it does not constitute site-specific empirical validation. Natural river systems exhibit complex, stochastic irregularities, transient boundaries, and sensor-level measurement noise that are simplified by idealized, deterministic differential equations. This cross-solver verification is therefore presented as an essential mathematical baseline, establishing physical consistency before deployment in natural real-world environments.

Predicted hybrid AI algorithm for the coupled water pollution and aeration concentrations vs. numerical solver actual data.
Physical based interpretation
In the numerical solution of Eqs. (9) and (10) using explicit finite difference method, the step length is assumed to be \(\:\varDelta\:x=0.05\:\left(km\right)\:\) and \(\:\varDelta\:t=0.002\:\left(day\right)\), for the ensuring of the stability of the finite difference scheme. The default parameter values 0 ≤ \(\:x\) ≤ 4, \(\:\text{t}=0.1\) (day), \(\:\mu\:=0.9\:\left(kg\:{km}^{-1}{day}^{-1}\right)\) \(\:{\text{D}}_{\text{P}}=\:{\text{D}}_{\text{X}}=0.3{(\text{k}\text{m}}^{2}{\text{d}\text{a}\text{y}}^{-1})\), \(\:u\) = 1\(\:\left({km\:day}^{-1}\right),\) \(\:{\:K}_{1}=0.2\) \(\:\left({day}^{-1}\right)\), \(\:{\text{K}}_{2}=1\left({day}^{-1}\right)\), \(\:{\text{K}}_{3}=0.3\left(\text{k}\text{g}{\:\text{k}\text{m}}^{-3}\right)\), \(\:{\:K}_{4}={\:K}_{5}=1\left(km\right)\), \(\:{\text{P}}_{\text{o}}=0.2,{\:\text{P}}_{1}=0.8\:\left(\text{k}\text{g}{\:\text{k}\text{m}}^{-3}\right)\),\(\:\:\:{\text{X}}_{\text{o}}=2.2\:\left(\text{k}\text{g}\:\text{k}{\text{m}}^{-3}\right)\), \(\:{\text{X}}_{1}=0.2\:\left(\text{k}\text{g}\:\text{k}{\text{m}}^{-3}\right)\),\(\:\:{\text{X}}_{2}=6.5\:\left(\text{k}\text{g}\:\text{k}{\text{m}}^{-3}\right)\), \(\:{\uplambda\:}=0.8{(\text{k}\text{m}}^{-1})\), \(\:{\upalpha\:}=0.01\:\left({\text{d}\text{a}\text{y}}^{-1}\right)\) and \(\:\text{S}=7\:\left(\text{k}\text{g}\:{\text{k}\text{m}}^{-3}\right)\).
Figure 5 illustrates the spatial distributions of the dissolved oxygen concentration \(\:X\left(x,t\right)\)and the pollutant concentration \(\:P\left(x,t\right)\) along the river at a fixed time for different values of the inlet flow velocity\(\:\:\:u\), representing different rates of clean-water release at the upstream boundary. At the upstream location\(\:\:x=0\), the dissolved oxygen concentration exhibits high values for all flow velocities due to the continuous injection of clean, oxygen-rich water. This reflects the implemented remediation strategy aimed at improving water quality in a river that was previously polluted as a result of past industrial activities. Since the injected water is free of pollutants, the pollutant concentration near the inlet remains very low, confirming the effectiveness of the clean-water flushing process in protecting the upstream region.
As the water flows downstream, the dissolved oxygen concentration gradually decreases due to its consumption by biochemical processes associated with the degradation of the existing pollutants, in addition to transport and dispersion effects. At the same time, the pollutant concentration initially increases, forming a characteristic downstream hump that represents the transport and redistribution of previously accumulated pollutants along the river. Further downstream, pollutant concentrations decrease due to dilution, dispersion, and degradation processes, indicating a gradual improvement in water quality.
The effect of the inlet flow velocity is clearly observed in both concentration profiles. For lower velocities, the residence time of water within the polluted reach is longer, which enhances oxygen consumption and results in a more rapid decline in dissolved oxygen levels. In contrast, higher flow velocities enhance longitudinal mixing and accelerate downstream transport, delaying the oxygen depletion and shifting the pollutant accumulation zone further downstream. Consequently, increasing the flow velocity improves the overall oxygen availability along the river while reducing localized pollutant buildup.
The horizontal dashed line represents 30% of the dissolved oxygen saturation concentration, which is adopted as the ecological threshold for sustaining aquatic life. The figure shows that, for the selected operating conditions, the dissolved oxygen concentration remains above this critical limit throughout the river reach for all considered flow velocities. This indicates that the applied clean-water release strategy is sufficient to maintain environmentally safe conditions along the river, allowing the ecosystem to support aquatic life.
From an environmental management perspective, the figure demonstrates how the proposed model can be used to assess the effectiveness of different remediation scenarios and to determine suitable flow velocities that ensure safe dissolved oxygen levels. By linking flow control with the coupled dynamics of pollutants and dissolved oxygen, the model provides a practical framework for identifying environmentally safe river sections that are suitable for fishing activities and fish farming, while also enabling the selection of the minimum clean-water release required to achieve these ecological objectives in a sustainable manner.
Figure 7 illustrates a comparison between the analytical solution given by Eq. (21) and the numerical solution of Eq. (9) computed using an explicit finite-difference method for \(\:{K}_{1}={\upmu\:}={P}_{1}=0.\) The profiles are plotted at three different times, \(\:\text{t}=0.02,\:\:0.04,\:0.06.\) The results show excellent agreement between the two approaches across all tested times: the numerical results closely follow the analytical solutions, with only negligible differences attributable to discretization errors. This consistency may confirm the accuracy and stability of the explicit finite-difference scheme. Based on this validation, all subsequent results presented in Figs. 7, 8 and 9 are obtained using the explicit finite-difference method applied to the coupled advection–dispersion Eqs. (9) and (10).
Figure 8 presents the temporal evolution of pollutant concentration \(\:P\left(x,t\right)\) and dissolved oxygen concentration \(\:X\left(x,t\right)\) along the river at three different times, \(\:\text{t}=0.02,\:0.06,\:0.1\). Near the upstream boundary \(\:x=0\), the dissolved oxygen concentration is high due to the injection of clean, oxygen-rich water. Moving downstream, the dissolved oxygen level gradually decreases as oxygen is consumed during pollutant degradation and transported by advection and dispersion. As time progresses, the influence of the injected clean water extends farther along the river, leading to a noticeable improvement in dissolved oxygen levels and a smoother spatial decay, which reflects the gradual recovery of the river system. In contrast, the pollutant concentration \(\:P\left(x,t\right)\:\)remains low near the upstream region because the injected water is free of pollutants. The concentration then increases to a maximum at a certain downstream distance as previously existing pollutants are transported and dispersed along the river. Farther downstream, the pollutant concentration decreases due to dilution and degradation processes. With increasing time, an overall reduction in pollutant concentration is observed throughout the river reach, indicating the effectiveness of the remediation strategy. Overall, the figure highlights the strong interaction between pollutant reduction and dissolved oxygen recovery, demonstrating a progressive improvement in water quality and the establishment of more favorable conditions for aquatic life.
Figure 9 illustrates the influence of the parameter \(\:\mu\:\) on the spatial distributions of the pollutant concentration \(\:P\left(x,t\right)\) and the dissolved oxygen concentration \(\:X\left(x,t\right)\) along the river for \(\:\mu\:=0,\:\:10,\:20\). It is observed from Fig. 8 that the dissolved oxygen curves are almost overlapping as the value of \(\:\mu\:\) increases, indicating that the effect of \(\:\mu\:\) on the spatial distribution of dissolved oxygen is relatively weak. This behavior can be attributed to the fact that the injected water at the upstream boundary contains a dissolved oxygen concentration close to saturation, which provides sufficient oxygen to compensate for the amount consumed during the water purification process, even with increasing \(\:\mu\:\). In addition, natural reaeration contributes to maintaining nearly uniform dissolved oxygen levels along the river, thereby reducing its sensitivity to variations in \(\:\mu\:\). In contrast, the pollutant concentration exhibits a clear response to increasing \(\:\:\mu\:\), with higher values observed along the river as \(\:\mu\:\) increases, particularly in the downstream region. This behavior reflects the direct role of \(\:\mu\:\) in enhancing the presence of pollutants within the river system, compared to its limited influence on dissolved oxygen. Overall, the figure confirms that the clean-water injection strategy ensures the stability of dissolved oxygen levels, while the pollutant concentration remains more sensitive to increases in \(\:\mu\:\).

Comparison between the analytical and numerical solutions P(x,t).
Figure 10 illustrates the influence of the parameter \(\:\alpha\:\) on the spatial distributions of the pollutant concentration \(\:P\left(x,t\right)\) and the dissolved oxygen concentration \(\:X\left(x,t\right)\) along the river for the values \(\:\alpha\:=1,\:\:3,\:\:5\). The figure illustrates the effect of the reaeration coefficient \(\:\alpha\:\) on the spatial distributions of the dissolved oxygen concentration \(\:X\left(x,t\right)\) and the pollutant concentration \(\:P\left(x,t\right)\:\)along the river. It is observed that increasing the value of \(\:\alpha\:\) leads to a noticeable increase in dissolved oxygen levels throughout the spatial domain, with higher \(\:X\left(x,t\right)\:\)curves corresponding to larger values of \(\:\alpha\:\), particularly in the downstream regions. This behavior reflects the effective role of reaeration in replenishing the oxygen consumed during the water purification process and in maintaining higher and more stable dissolved oxygen levels within the river. In contrast, the pollutant concentration \(\:P\left(x,t\right)\:\)shows very similar profiles for different values of\(\:\:\alpha\:\), indicating that the influence of reaeration on pollutant transport is relatively weak. This is because reaeration primarily affects the oxygen balance, while the pollutant dynamics are mainly governed by transport and degradation processes. Overall, the figure demonstrates that increasing \(\:\alpha\:\) directly improves the environmental conditions by enhancing dissolved oxygen availability, while having a negligible effect on the spatial distribution of pollutants.

The variation of P(x,T) and X(x,t) with t.

The variation of P(x,T) and X(x,t) with μ.

The variation of \(\:P\left(x,T\right)\:and\:X(x,t)\) with \(\:\alpha\:\).
