# Operational Risk Assessment of Engineering Vehicles Considering Driver Characteristics
## 4 Model Network Training and Testing
### Model Network Training  
In this study, 100 sets of data obtained via survey and expert scoring have been used as samples. These sets are divided into two parts. A total of 80 sets of sample data are used for the training of the model, and the remaining 20 sets of data are used for the testing of the BP network. Python software v. 3.8 programming is applied to train the network. The number of nodes in the input layer is 10, the input of the network is an 80 * 10 matrix, and the output is an 80 * 1 matrix. Comparison experiments are used in selecting the model training parameters and methods in order to ensure that the results of the model training are optimized.  
(1) Comparison of the Number of Nodes in the Hidden Layer  
In the neural network hidden layer, the numbers of neurons for training and testing are selected as 32 and 64. The training results are evaluated using the mean square error  
\begin{table}
\begin{tabular}{c c c} \hline \hline  & **Input** & **Output** \\ \hline
**Driver Factors** & **Road Environmental Factors** & **Management Factors** & **Risk Level** \\ \hline Driver’s Experience & Segregation of Motorized and Nonmotorized Lanes & Accidents at Transportation \\ Undesirable Driving Behavior & Road Congestion Index & Companies \\  & Road Congestion Index & Number of Times the \\  & & Companies Were Notified \\ Traveling Speed & Weather Conditions & GPS Offline Rate of \\  & & Engineering Vehicles \\ Continuous Driving Hours & — & — \\ \hline \hline \end{tabular}
\end{table}
Table 4: Input and output of the BP neural network.  
greatly, indicating an overfitting. Therefore, regularization comparison experiments are added to the next set of experiments to enhance model optimization.  
(3) Regularization Optimization  
In this study, L2 regularization is added to the hidden layer of the network model to optimize the model. L2 regularization mainly means that the weight parameters tend to have small values. Moreover, the model tends to choose parameters with small weight values, thereby reducing its complexity. Parameters with small weight values are usually highly insensitive to noise in the training data and help prevent overfitting.  
The formula for L2 regularization is shown in Equation (4).  
\[L_{L_{2}}=\lambda\sum_{i=1}^{n}{\omega_{i}}^{2}, \tag{4}\]  
where \(\lambda\) is the regularization parameter for controlling the regularization strength, \(n\) is the number of weighting parameters, and \(w_{i}\) is the value of the \(i\)th weighting parameter.  
The comparison of the original training results with the results after performing L2 regularization is shown in Figure 8. With reference to the previous results of each hyperparameter's optimization, the figure on the left shows the training and testing results using 64 neurons and sigmoid as the activation function. Moreover, the loss value on the testing set is 0.0326. The figure on the right shows the training and testing results with the addition of L2 regularization. The loss on its training set is 0.0331. The model converges well and can achieve a low test loss with the addition of L2 regularization.  
(4) Comparison of K-fold Cross-validation  
On the basis of the above optimization results, this study finally adopts 64 as the number of neurons in the hidden layer, sigmoid as the activation function, and L2 regular  
Figure 8: Comparison of regular optimization.  
Figure 7: Comparison of different activation functions.  
The mean absolute error (MAE) is used for evaluation, and is calculated as follows to evaluate the model's accuracy:  
\[MAE=\frac{1}{n}\sum_{n=1}^{N}\Big{|}O_{pred}-T_{real}\Big{|}, \tag{5}\]  
where \(O_{pred}\) is the predicted output value, and \(T_{real}\) is the real value of the sample.  
The optimal model is selected as the final training model based on the loss value of the validation results by comparing the model effects of each round of cross-validation.