## 3 Methodology
### BP Neural Network Delay Model
#### 3.2.3 Network Training  
Since 240 pairs of delayed data are obtained in inside and outside simulation experiments, the number of training sample pairs of the model is 240. The vector \(X\) is composed of four normalized influential factor data and used as input samples, as shown in Formula (3). The delay value \(y\) obtained by the simulation is taken as the output layer. When mapping from the input layer to hidden layer, the input value of each neuron in the hidden layer is calculated according to Formula (4).  
\[X=\left[x_{1},x_{2},x_{3},x_{4}\right] \tag{3}\]  
\[b_{j}^{\prime}=\sum_{i=1}^{4}w_{ij}x_{i}-\theta_{j} \tag{4}\]  
In Formula (4), \(w_{ij}\) represents the connection weight value from the input layer to the hidden layer; \(\theta_{j}\) represents the hidden layer's threshold value.  
Because of the nonlinear relationship between input sample influential factors and output sample delay, the activation function should be introduced to overcome the linear relationship between input sample influential factors and output sample delay.  
Figure 3: BP neural network structure diagram.  
model's limitations. Sigmoid is selected as the activation function, as shown in Formula (5). The output value \(\text{b}_{j}\) of the hidden layer can be obtained by substituting Formula (4) into the activation function, as shown in Formula (6). When the hidden layer is mapped to the output layer, the input value of the output layer is calculated according to Formula (7).  
\[f(x)=\frac{1}{1+e^{-x}} \tag{5}\]  
\[b_{j}=\frac{1}{1+\exp\biggl{(}-\sum\limits_{i=1}^{4}w_{ij}x_{i}+\theta_{j} \biggr{)}} \tag{6}\]  
\[y^{\prime}=\sum\limits_{j=1}^{5}v_{j}b_{j}-\alpha \tag{7}\]  
In the formula, \(v_{j}\) represents the connection weight value from the hidden layer to the output layer; \(\alpha\) represents the threshold value of the output layer. Similarly, the output value of output layer is calculated according to Formula (8).  
\[y^{\prime\prime}=\frac{1}{1+\exp\biggl{(}-\sum\limits_{j=1}^{5}v_{j}b_{j}+ \alpha\biggr{)}} \tag{8}\]  
The error of a pair of training samples is shown in Formula (9) in this case.  
\[E=\frac{1}{2}(y-y^{\prime\prime})^{2} \tag{9}\]  
The gradient reduction method is used to adjust the weight value and threshold value of each layer so that the error decreases along the gradient. The adjustment weight value from the hidden layer to the output layer and the threshold value of the output layer is shown in Formulas (10) and (11), respectively.  
\[\triangle\ v_{j}=-\eta\frac{\partial E}{\partial v_{j}}=-\eta gb_{j} \tag{10}\]  
\[\triangle\ \alpha=-\eta g \tag{11}\]  
where \(\eta\) represents the training rate, and its value determines how far the weight value can move in the direction of the error drop gradient in a small range. \(\eta\) generally ranges from 0.01 to 0.8, and here, it is 0.02. \(g\) is calculated according to Formula (12) and is the correction error of the layer's output.  
\[g=(y-y^{\prime\prime})\cdot y^{\prime\prime}\cdot(1-y^{\prime\prime}) \tag{12}\]  
In the same way, the adjustment weight value from the input layer to the hidden layer and the threshold value of the hidden layer can be obtained, as shown in Formulas (13) and (14). The correction error \(e_{j}\) of the hidden layer is calculated according to Formula (15).  
\[\triangle\ w_{ij}=-\eta e_{j}x_{i} \tag{13}\]  
\[\triangle\ \theta_{j}=-\eta e_{j} \tag{14}\]  
\[e_{j}=b_{j}\bigl{(}1-b_{j}\bigr{)}\sum\limits_{i=1}^{4}v_{j}g \tag{15}\]  
According to the adjustment value, the corresponding weight value and the threshold value of the next iteration are adjusted to complete an iteration process. In this study, two sets of BP neural network models are established for two situations of inside and outside left-turn lanes. The set number of training is 1000.