# An Attention-Based CNN-LSTM Method for Effluent Wastewater Quality Prediction
## 4 Experiments
### Experimental Results
#### 4.3.1 Comparison with Sliding Window Method
Each step only predicts the part of the test set adjacent to the training set. After completing the prediction, we slide back to proceed to the next step. Finally, the predicted results of each step are combined to obtain all of the predicted results. The predicted results before and after using sliding window prediction (SWP) are shown in Figure 9.  
In the figure, the black line represents the target values of the wastewater quality indicators, the red line represents the predicted values without using SWP, and the green line represents the predicted values with SWP. As can be seen from the image, the effect of prediction is significantly improved after using SWP. For the parts with poor prediction without using SWP, such as the middle part of the line, the prediction effect is improved after using SWP. We also calculated the MAPE value of the predicted results for 5 days, 10 days, 20 days and 30 days, as shown in Figure 10. After using the SWP method, the prediction performance is improved in two aspects. On one hand, the accuracy of the prediction is improved, which means that for any effluent wastewater quality indicator, after using SWP, the MAPE value of the predicted result is decreased, showing that the model can achieve more accurate prediction with SWP. On the other hand, the stability of prediction is improved. In the absence of SWP, the MAPE value of the predicted results increases over time. After the sliding window is adopted, the MAPE values of the predicted results remain stable. Figure 8: Sliding window method. The SWP method can maintain stable prediction performance by constantly updating the parameters of the model, and can be used in any model of wastewater quality prediction based on neural network. In order to better compare different models, the SWP method was adopted in all subsequent experiments. Furthermore, in order to compare the predicted results of different methods more intuitively, we use the following point cloud map (PCM) to show the predicted results. The horizontal axis of the image represents the actual value, and the vertical axis represents the predicted value. The closer the point cloud on the image to the diagonal line, the more accurate the prediction results. Figure 10: The trend of MAPE before and after using SWP in COD. Figure 9: (**a**) The target and predicted values of COD before and after using SWP; (**b**) the target and predicted values of NH3-N before and after using SWP; (**c**) the target and predicted values of TP before and after using SWP; (**d**) the target and predicted value of TN before and after using SWP. As can be seen from Figure 11, for the indicators COD and TP, there are a large number of discrete points with poor prediction effects on the edge of the point cloud map when SWP is not used for prediction. After SWP is used for prediction, the original discrete points on both sides of the slanted line move closer to the middle, while the point clouds converge toward the middle. For the indicators NH3 and TN, when SWP is not used, a small number of points are distributed on the edge. After SWP is used, it is difficult to find scattered points on the edge of the point cloud map. Figure 11: _Cont._  
As can be seen from Table 3, after using SWP, the accuracy of prediction is improved to some extent, with MSE decreasing by 0.25, MAPE decreasing by 5% and LER decreasing by 7%. For practical engineering applications, wastewater treatment plants care more about the MAPE and LER metrics. MAPE represents the prediction accuracy of the model. The lower the MAPE value, the higher the accuracy of prediction for the whole dataset. LER represents the stability of the model under different working conditions. The lower the LER value, the fewer \"mistakes\" are made in the prediction results, and the stronger the stability of the model. In summary, after SWP is used, the prediction performance of the model remains stable over time, indicating that the stability and accuracy of the prediction are improved.