## 3 Results and Discussion
### Elevation of the Pipe Centerline
#### 3.1.2 Restoration of Abnormal Elevation Data  
The abnormal data can be divided into two categories: one is single abnormal data, which can be restored using the mean method, and the other is continuous abnormal data, the restoration of which is much more complex. Therefore, the prediction model of machine learning is used to restore the abnormal data. Before training, the data need to be normalized through the min/max method to obtain better model performance. The prediction model uses MLR, ANN, SVR, RF, and GBDT; to enable the model to grasp the change trend of the sequential data for the elevation of pipeline, the input of the model is the five data before the abnormal data point, and then  
Figure 4: Confusion matrix of the model. the value of the next data is predicted for the elevation of pipeline. The prediction model is shown in Equation (23). \[Y\_pred\_value=g(H_{i+1},\ldots,H_{i+5}) \tag{23}\]  
where \(Y\_pred\_value\) is the predicted value for the elevation of pipeline, \(g(\cdot)\) is the prediction algorithm, and \(H_{i+1}\) is the elevation data at point \(i+1\). The normal data are used to train the model, and after data preprocessing, there are a total of 1231 samples, of which 70% are trained and 30% are used as the testing set. The performance of the training set and testing set for the model is shown in Tables 1 and 2. Table 1 shows that RF and GBDT based on ensemble learning obtain the best performance, indicating its advanced nature and strong fitting ability to the data. However, the generalization depends on its performance in the testing set. Compared with the performance of the training set, as indicated in Table 3, the accuracy of the two algorithms in the testing set has greatly decreased, indicating that overfitting has occurred. In addition, Table 3 also shows that RF and MLR outperform the other algorithms with MAPE of 6.71% and 6.48%, respectively. Because the data for the elevation of pipeline are one-dimensional sequential data and the input variables are relatively simple, MLR performs best. This conclusion can also be seen in Figure 5, where the abscissa and the ordinate represent the actual and predicted values, respectively. The smaller the error, the closer the fitted line and diagonal and, correspondingly, the larger the value of the fit R2, and compared with other models, MLR conforms to the above optimal characteristics. Therefore, the trained MLR is used to restore the abnormal data. The restored result is shown in Figure 6; the red line is the original data, and the blue line is the restored data. It is shown that most of the abnormal data, such as the pink-like data points in the figure, are restored as normal data, which is consistent with the change trend of the data for the elevation of pipeline. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **RF** & **MLR** & **SVR** & **GBDT** & **ANN** \\ \hline MAE & 0.23 & 0.48 & 1.18 & 0.35 & 0.50 \\ MAPE & 1.96\% & 4.86\% & 21.51\% & 4.51\% & 4.56\% \\ RMSE & 0.54 & 1.12 & 3.85 & 0.68 & 1.15 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Model evaluation on the training set for the elevation of pipeline. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **RF** & **MLR** & **SVR** & **GBDT** & **ANN** \\ \hline MAE & 0.61 & 0.47 & 1.49 & 0.62 & 0.55 \\ RMSE & 1.28 & 0.89 & 5.40 & 1.31 & 0.95 \\ MAPE & 6.71\% & 6.48\% & 26.10\% & 8.30\% & 7.66\% \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Model evaluation on the testing set for the elevation of pipeline. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Algorithms** & **MAE (Meter)** & **MAPE** & **RMSE (Meter)** \\ \hline RF & 0.0051 & 0.055\% & 0.0122 \\ SVR & 0.0351 & 0.378\% & 0.0645 \\ GBDT & 0.0008 & 0.008\% & 0.0010 \\ MLR & 0.0138 & 0.149\% & 0.0230 \\ ANN & 4.7384 & 50.988\% & 5.4496 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Model evaluation on the class 1 water level training set. Figure 5: Model performance on the testing set for the elevation of pipeline.