# Dissolved Oxygen Modeling by a Bayesian-Optimized Explainable Artificial Intelligence Approach
## 4 Model Application and Results
### Effects of Forecast Horizon  
The previous sections have illustrated the models' real-time prediction capabilities. However, in practical applications, it is often valuable for forecasting future DO levels for decision-making purposes. Consequently, this section explores the impact of forecast horizon (FH) on model performance. We usually have two approaches to achieve this: (a) using lagged target predictors and (b) using lagged extraneous parameters. The latter approach is applied, as extraneous parameters enable the model to adapt to changing environmental conditions that may not be evident in historical DO data alone. Additionally, this method helps uncover the underlying physical processes governing the system. The same optimization, training, and testing procedures used in the previous sections are applied.  
Table 4 shows the model performance for varying forecast horizons. The prediction terminates when the CD index drops below the desired value of 0.75 [39; 40]. A longer FH often leads to lower accuracy because uncertainty increases and the correlation between past and future values weakens. This is consistent with previous studies [36; 45]. As FH increases from 5 days to 30 days, the errors increase by 144% for RMSE and 161% for MAE. The model performs well by delivering satisfactory results with FH = 30 days, which is remarkable. This high accuracy for extended horizons may be attributed to two factors. First, the BO algorithm consistently optimizes the model for each run, ensuring robust and reliable performance. Second, the inclusion of extraneous variables, rather than relying solely on lagged DO levels, effectively captures the underlying physical processes. This understanding helps the model to accurately estimate DO levels, even over longer prediction periods.  
Figure 9 exhibits the boxplot comparison of measured and predicted DO at varying forecast horizons. Moreover, Figure 9 shows the distribution of both measured (gray) and predicted (pink) DO values, with the central lines representing medians, square markers indicating means, and whiskers showing the range within 1.5 times the interquartile range (IQR). Overall, the predicted and measured values have similar medians and means across all forecast horizons, though the predicted values generally show slightly more variance.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**FH (Day)**} & \multicolumn{3}{c}{**Training Phase**} & \multicolumn{3}{c}{**Testing Phase**} \\  & **CD** & **RMSE (mg/L)** & **MAE (mg/L)** & **CD** & **RMSE (mg/L)** & **MAE (mg/L)** \\ \hline
5 & 0.965 & 0.379 & 0.274 & 0.946 & 0.463 & 0.373 \\
10 & 0.921 & 0.569 & 0.431 & 0.925 & 0.545 & 0.421 \\
15 & 0.917 & 0.581 & 0.453 & 0.912 & 0.581 & 0.422 \\
20 & 0.870 & 0.727 & 0.525 & 0.883 & 0.635 & 0.457 \\
25 & 0.902 & 0.637 & 0.500 & 0.859 & 0.736 & 0.585 \\
30 & 0.949 & 0.468 & 0.303 & 0.769 & 0.926 & 0.715 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Model performance for varying forecast horizons.  
Figure 8: Sensitivity analysis of the DO-prediction model.  
This suggests that the ML model performs consistently well in predicting DO levels over time, with minor deviations from the measured data. However, as the FH increases, there is a slight increase in the spread of the predicted values, reflected in the wider IQR and longer whiskers for some of the forecast periods (e.g., FH = 25 d and FH = 30 d). This suggests that while the model continues to capture the overall trends, its predictive confidence slightly decreases as the forecast horizon extends, with greater variability in the predicted DO levels at longer timeframes.