## 3 Neural Network-Based Bridge Maintenance Cost Prediction Framework
### Sample Screening  
Anomaly detection is an important step in pre-processing the training data. The main function of anomaly detection is to check whether there are input errors and unreasonable data. Ignoring the existence of outliers in engineering practices is very dangerous. Incorporating outliers into the calculation and analysis processes of data without excluding them will adversely affect the training and prediction results. For the outlier detection of actual engineering data, scholars have carried out valuable research. For example, [PERSON] et al. adopted wavelet transform and generalized Pareto distribution for data processing and proposed a two-level anomaly detection method, namely the threshold-based anomaly detection and anomaly trend detection [37]. [PERSON] et al. proposed an online detection method for structural health monitoring data anomalies based on the Bayesian dynamic linear model. This method has better calculation accuracy and higher calculation efficiency [38]. The isolation forest method was proposed by [PERSON] et al. in 2008 [39]. In 2011, the method was applied to the anomaly detection of data samples [40]. In isolated forests, anomalies are defined as points that are more sparsely distributed and further away from high-density groups. In the feature space constructed by the isolation forest, if the data distribution in a certain area is sparse, it means that the probability of normal data values appearing in that area is very low. Therefore, if a certain data frequently appears in these areas, it is judged as an anomaly. Isolation forest is an unsupervised anomaly detection method suitable for continuous numerical data. That is, it does not require labeled samples for training, and the method has good robustness to data with low feature dimensions. Taking into account the data characteristics of the bridge maintenance costs in this study, it was necessary to choose an anomaly detection method that was suitable for small datasets with low feature dimensions. The isolation forest method has been widely used in the detection of anomalies in actual engineering data. For example, smart grid data [41] and optical emission spectroscopy data [42]. The isolation forest method has been proven to process data quickly and efficiently. It is particularly suitable for small and medium datasets with low feature dimensions. Therefore, this study adopted it as a method of anomaly detection. Consider a dataset \(X=\{x_{1},x_{2},\ldots,x_{n}\}\) with \(n\) samples and \(d\) features. First, decision trees are built. Then, a feature \(q\) and its segmentation threshold \(p\) are selected randomly. Finally, the dataset \(X\) is segmented recursively until there is only one sample \(x_{i}\) on the node. The length of the segmentation path of sample \(x_{i}\) from the root node to the leaf node in  
Figure 4: Flow chart for Bayesian optimization calculation. the decision tree is represented by \(h(x)\). For the dataset \(X\), the average path length of the decision trees is:  
\[c(n)=\left\{ \begin{array}{cl}2H(n-1)-2(n-1)/n&for\ n>2\\ 1&for\ n=2\\ 0&otherwise\end{array} \right. \tag{11}\]  
where \(n\) is the number of samples and \(H(k)\) is the harmonic number, which can be estimated by \(H(k)=\ln k+\xi\), where \(\xi\) is Euler's constant. As \(c(n)\) is the average of \(h(x)\) for the given \(n\), we use it to normalize \(h(x)\). The anomaly score \(s\) of an instance \(x\) is defined as:  
\[s(x,n)=2^{-\frac{E(h(x))}{c(n)}} \tag{12}\]  
where \(E(h(x))\) is the average value of \(h(x)\) is the average value of. The following conditions apply to the three special values of abnormal scores:  
1. When \(E(h(x))\to 0\), \(s\to 1\);
2. When \(E(h(x))\to n-1\), \(s\to 0\);
3. When \(E(h(x))\to c(n)\), \(s\to 0.5\). We can make the following assessment based on the anomaly score \(s\). If an instance returns a value of \(s\) that is very close to 1, then it is definitely an anomaly. If an instance has an \(s\) value much less than 0.5, then it can quite safely be regarded as a normal instance.