## 4 Prediction Model and Numerical Testing
### National Highway Crash Prediction and Warning Model
The data then undergo multiplication with a connection weight matrix and addition with a bias term (i.e., a column vector) to produce a set of values. These values are then input into an activation function to obtain the final output of a hidden layer as follows: \[z_{i}^{l}=\sum_{i}\sum_{j}w_{ij}^{l}a_{i}^{l-1}+b_{i}^{l}v_{sw}=\frac{q_{b}-q _{a}}{o_{b}-o_{a}}\] (2)  
\[\sigma\left(z_{i}^{l}\right)=\text{ReLu}\left(z_{i}^{l}\right)=a_{i}^{l} \tag{3}\]  
where \(w_{ij}^{l}\) is the weight of the \(i\)th perceptron in the \(l\)th layer, \(a_{i}^{l-1}\) is the output of the \(l\)th layer, \(a_{i}^{l}\) is the output of the \(i\)th perceptron in the \(l\)th layer, \(a_{i}^{l-1}\) is the output of the \(l\)th layer, \(b_{i}^{l}\) is the bias term of the \(i\)th perceptron in the \(l\)th layer, and \(\sigma(\cdot)\) is an activation function. The activation function of each hidden layer is a rectified linear unit. 2. Since the model outputs are binary solutions, the activation function of the output layer is a sigmoid function. The output \(\hat{y}\) of the output layer is calculated as \[\hat{y}=\text{Sigmoid}\left(\sum_{j}w_{j}^{o}.a_{i}^{h}+b^{h}\right)\] (4) where \(w_{j}^{o}\) is the weight of the output layer perceptron and \(a_{i}^{h}\) is the output of a hidden layer. 3. Binary cross-entropy is used as the loss function, which is defined as follows: \[Loss(\hat{y}_{k},y_{k})=-\frac{1}{K}\sum_{k}(\hat{y}_{k}\cdot\log(p(y_{k}))+( 1-\hat{y}_{k})\cdot\log(1-p(y_{k}))),\] (5) where \(\hat{y}_{k}\) is the \(k\)th output of the output layer and \(y_{k}\) is the label of the \(k\)th accident in the dataset. When an accident occurs, the output value is 1; otherwise, it is 0. Here, \(p(y_{k})\) represents the probability of accident occurrence. The loss function determines the prediction accuracy of the model. 5. DNN back propagation 1. In accordance with [PERSON] and [PERSON] [26], adaptive moment estimation (Adam) was used in this study as an optimizer to update DNN parameters. The loss function uses the chain rule to determine the partial derivative of parameters (\(w_{ij}^{l}\), \(b_{i}^{l}\)) in each layer: \[\frac{\partial Loss(\cdot)}{\partial\mathbf{w}^{l}}=\frac{\partial Loss(\cdot)}{ \partial p(y_{k})}\frac{\partial p(y_{k})}{\partial\mathbf{z}^{l+1}}\frac{ \partial\mathbf{z}^{l+1}}{\partial\mathbf{w}^{l}},\] (6) \[\frac{\partial Loss(\cdot)}{\partial\mathbf{b}^{l}}=\frac{\partial Loss(\cdot )}{\partial p(y_{k})}\frac{\partial p(y_{k})}{\partial\mathbf{z}^{l+1}}\frac{ \partial\mathbf{z}^{l+1}}{\partial\mathbf{b}^{l}}\] (7) \(\mathbf{b}\). Generally, the Momentum optimizer adjusts the speed of change in the gradient descent direction, and AdaGrad uses an adaptive method to adjust the learning rate (\(\eta\)) of gradient descent. The Adam optimizer integrates both Momentum and AdaGrad and updates the exponential moving average \(m_{t}\) and squared gradient \(v_{t}\). Parameters \(\beta_{1}\) and \(\beta_{2}\), which belong to the interval [0, 1), are used to control the learning rate decay of (\(m_{t}\), \(v_{t}\)), update the estimated values (\(\hat{m}_{t}\), \(\hat{v}_{t}\)), and thereby update each parameter (\(w_{ij}^{l}\), \(b_{i}^{l}\)) in the neural network: \[w_{ij}^{l}=w_{ij}^{l}-\eta\frac{\hat{m}_{t}}{\sqrt{\hat{v}_{t}+\epsilon}}\] (8) \[b_{i}^{l}=b_{i}^{l}-\eta\frac{\hat{m}_{t}}{\sqrt{\hat{v}_{t}+\epsilon}}\] (9)