# A Dynamic Bayesian Network-Based Real-Time Crash Prediction Model for Urban Elevated Expressway

Authors: Xian Liu; Jian Lu; Zeyang Cheng; Xiaochi Ma
Journal: Journal of Advanced Transportation
 (2021)

---

## Abstract

Traffic crash is a complex phenomenon that involves coupling interdependency among multiple influencing factors. Considering that interdependency is critical for predicting crash risk accurately and contributes to revealing the underlying mechanism of crash occurrence as well, the present study attempts to build a Real-Time Crash Prediction Model (RTCPM) for urban elevated expressway accounting for the dynamicity and coupling interdependency among traffic flow characteristics before crash occurrence and identify the most probable risk propagation path and the most significant contributors to crash risk. In this study, Dynamic Bayesian Network (DBN) was the framework of the RTCPM. Random Forest (RF) method was employed to identify the most important variables, which were used to build DBN-based RTCPMs. The PC algorithm combined with expert experience was further applied to investigate the coupling interdependency among traffic flow characteristics in the DBN model. A comparative analysis among the improved DBN-based RTCPM considering the interdependency, the original DBN-based RTCPM without considering the interdependency, and Multilayer Perceptron (MLP) was conducted. Besides, the sensitivity and strength of influences analyses were utilized to identify the most probable risk propagation path and the most significant contributors to crash risk. The results showed that the improved DBN-based RTCPM had better prediction performance than the original DBN-based RTCPM and the MLP based RTCPM. The most probable risk influencing path was identified as follows: speed on current segment (V) (time slice 2)⟶V (time slice 1)⟶speed on upstream segment (U_V) (time slice 1)⟶Traffic Performance Index (TPI) (time slice 1)⟶crash risk on current segment. The most sensitive contributor to crash risk in this path was V (time slice 2), followed by TPI (time slice 1), V (time slice 1), and U_V (time slice 1). These results indicate that the improved DBN-based RTCPM has the potential to predict crashes in real time for urban elevated expressway. Besides, it contributes to revealing the underlying mechanism of crash and formulating the real-time risk control measures.


---

## Body

## 1. Introduction

Predicting road crashes in real time is a hotspot in road safety under the context of active traffic management (ATM) over the past two decades. Real-time crash prediction refers to the assumption that the occurrence probability of a crash on a specific road segment can be predicted within a very short precrash time interval by adopting instantaneous traffic flow characteristics [1–3]. The development of Intelligent Transportation System (ITS) and advanced transportation information systems (ATIS) is helpful for easily collecting traffic data in real time, promoting the effective and accurate assessment on crash risk on highways and expressways by use of RTCPMs [4–11].In general, numerous RTCPMs studies establish a direct connection between traffic flow data (i.e., volume, speed, occupancy and their combinations) and crash data. In these models, the collinearity and correlation among dependent variables are avoided; thus, the independence of variables is guaranteed [12, 13]. However, road crash is a complex phenomenon involving coupling interdependency among multiple influencing factors. The concept of coupling interdependency can be used to express the interaction between various risks. Although these complex system factors can exhibit many characteristics on their own, in reality these individual factors interact and couple with each other in even more complex ways in terms of coupling direction and coupling strength [14–16]. This interaction is called coupling interdependency, which can lead to an increased or a decreased risk of an accident [17]. Therefore, it is essential for RTCPMs to account for the interdependency among influencing factors. Additionally, the one-time interval of traffic data is frequently adopted for real-time crash prediction in a number of RTCPMs [6, 18]. However, for urban elevated expressway, the merging and lane-changing driving behaviours are frequent due to the dense-ramp setting. The traffic flow characteristic is prone to displaying dynamicity that varies over time, which is closely associated with crash risk [19]. Therefore, the dynamicity of traffic flow in the temporal dimension should be considered with the implementation of the RTCPM for predicting crashes on urban elevated expressway.DBN, a particular form of Bayesian Network (BN), represents the dynamic evolution of some state space model through time [20]. It has been widely used to predict and assess the dynamically evolving process of risk in the field of maritime accidents, tunnel construction, ship-ice collision, etc. [21–23]. In order to express the dynamicity of traffic flow characteristics, some RTCPMs studies apply time-series traffic data consisting of several time intervals [24–27], which are proved to be feasible and robust. However, these researches ignore the investigation of interdependency among different traffic flow characteristics and simply connect each influencing factor to crash risk directly in the construction process of the graph structure. As the most critical step in the DBN construction, the interdependency of variables can be well assessed in the DBN model with the application of the structure learning algorithm. Besides, the neural network-based models (e.g., MLP) are also able to accommodate correlated dependent variables. However, the whole model should be rebuilt and recalibrated once the future new variables and knowledge from new data are input, whose tuning process can be highly resource-demanding [13].Furthermore, considering the interdependency among influencing factors also helps to reveal the underlying mechanism of crash occurrences. The present study estimates the crash risk by quantifying the probability of crash occurrences. We hope this model can provide some real-time countermeasures to mediate risk when there is a high probability of crash. The formulation of countermeasures should be based on the identification of risk propagation path and significant risk contributors. However, there has been a dilemma between predictive and explanatory models: the models specialized in prediction are not the best in knowledge discovery, and vice versa [7, 28]. The DBN model has the advantage of implementing uncertainty analysis and probability reasoning and conducting bidirectional uncertainty investigation for prediction and diagnostic analyses. Combining with the sensitivity and strength of influences analysis methods can not only identify the most probable risk propagation path, but also can recognise the most sensitive contributors in the propagation path [29]. Once the most sensitive risk contributors in the whole propagation path are revealed, the references for the sequence and emphasis of mediation can be provided, which helps to formulate appropriate real-time countermeasures to cut off the risk propagation path and decrease the probability of crash occurrence.The existing DBN-based RTCPMs mainly emphasize the dynamicity of traffic flow characteristics, lacking investigation on the coupling interdependency among traffic flow characteristics. The main contributions of this study are (1) to apply the DBN structure learning algorithm in an example to predict road crashes; (2) to compare the performances of two DBN-based RTCPMs (considering the interdependency and not considering the interdependency) and the MLP-based RTCPM; and (3) to identify the most sensitive risk contributors in the propagation path by the use of the sensitivity and strength of influence analyses.The manuscript is organized into five sections. The remainder is organized as follows. In Section2, the materials and methods are presented. Section 3 presents the results and discussions. Section 4 provides some concluding remarks.


## 2. Materials and Methods

### 2.1. Study Area and Data Preparation

The 40 segments of the Yan'an elevated expressway in Shanghai, China, sequentially linking up to each other along the westbound and eastbound expressway, were selected as the study areas (see Figure1). All segments are three-lane with detectors spaced at an approximate distance of 300–500 m. Each segment has similar road geometry and on/off-ramp arrangement; thus, the road geometries and ramp locations were not considered as influencing variables on the crash risk. There were 82 crashes that happened on the Yan'an expressway during August and September 2018. The dates, times, and segment IDs of the crashes were collected. Based on the matched case-control design, three corresponding noncrash cases for each crash case were randomly matched for the same segment and occurrence time (246 noncrash cases in total). Besides, traffic flow characteristics and weather variables were also obtained as inputs of the RTCPM, aiming at classifying the crash and noncrash states based on the investigation of relationship between crash risk, traffic flow characteristics, and weather conditions.Figure 1
Yan'an elevated expressway, Shanghai, China.The existing dual-loop detectors in study areas are available for providing the average speed (km/h) and the average volume of a single lane (pcu/h) for each segment. Hourly weather variables, including visibility (km) and weather type (rainy or sunny), were collected from the Shanghai Xujiahui Observatory, which is 7.5 km far from the Yan'an expressway. In this study, the Traffic Performance Index (TPI) varying between 0 and 1 was applied as an indicator to measure the magnitude of congestion degree, where 1 is a traffic jam state and 0 is a free flow state (equation (1)). Consider(1)TPI=Vmax−ViVmax,where Vmax is the maximum speed and Vi is the average speed at the ith time period.The average speed data on the current, upstream, and downstream segments of the crash location and the TPI of the whole expressway were aggregated in 5-minute intervals. The evolution of traffic flow with time leading to a crash was a dynamic process; thus, the traffic flow characteristics of several time intervals before the crash should be combined to build the model. The intervals of 0–5 min (time slice 0), 5–10 min (time slice 1), and 10–15 min (time slice 2) prior to the crash were considered. The time slice 0 was excluded, because the crash warning system needs some time to recognise crash states, and the actual crash occurrence time and recorded time are not always completely consistent. Due to the raw weather data updated once an hour, the weather condition was regarded as a stable influencing variable across different time slices. Finally, the traffic flow and weather data corresponding to 82 crash cases and 246 noncrash cases were generated. In total, nine variables combining traffic flow characteristics on current, upstream, and downstream segments of the crash location with weather condition are shown in Table1.Table 1
Information of the nine alternative variables.
VariableDescriptionTPIThe average TPI of the whole expressway within 5 min intervalVThe average speed of current segment within 5 min interval (km/h)U_VThe average speed of upstream segment within 5 min interval (km/h)D_VThe average speed of downstream segment within 5 min interval (km/h)QThe volume of current segment within 5 min interval (pcu/h)U_QThe volume of upstream segment within 5 min interval (pcu/h)D_QThe volume of downstream segment within 5 min interval (pcu/h)VisibilityThe horizontal visibility within one hour (km)WeatherThe weather type in one hour, rainy or sunny


### 2.2. Random Forest (RF)

The main purpose of constructing RTCPM is to evaluate crash risk in real time. High-dimensional variable space can increase the processing complexity of the RTCPM. Thus, Random Forest (RF), a widely used variable selection model, was implemented in this study to select influencing variables and reduce the redundancy of variables. Variable importance (VI) metric was used as the criterion to pick the mostly related variables [12, 30], which can be determined with the following steps.(1)
SampleN amount of data from the learning set to build a tree classifier by bootstrap sample technique, and the remaining samples of the learning set were not used in the growth of the tree. The left-out samples, an effective internal test data set, were called out-of-bag (OOB) data, which were adopted to obtain an unbiased error estimate. m number of variables were randomly selected from the original variable set M (m <M), and the best split variable in m at each tree node was adopted to split node. Each tree grew naturally without pruning. Repeat this step k times to construct RF consisting of k trees.(2)
Each tree classifier produced a classification result by voting for the binary target (crash or noncrash) based on OOB samples, and the classification error rateRi was calculated consequently.(3)
Add random noise disturbance for the values of any variable in the OOB sample, and the new OOB sample was produced. Each tree that was implemented for crash/noncrash classification tests with the new OOB sample was used to calculate the classification error rateRi’.(4)
VI was calculated as the increase in the mean of the classification error rate of trees after adding random noise disturbance. The calculation formula was shown in the following equation:(2)VI=1k∑i=1kRi′−Ri.


### 2.3. Dynamic Bayesian Network (DBN)

The Bayesian Network (BN) is a probabilistic graphical model that expresses the probability relationships among a set of variables that connect those variables in a directed acyclic graph (DAG). The BN has the advantages in learning causal relationships, predicting the consequences of intervention, and analyzing the most probable explanations of consequences. Some researchers have adopted BN to evaluate and analyze traffic accidents risk [31–33]. Most crashes did not happen based on a particular point in time, but they can be described through multiple traffic states among a series of time slices. The DBN is a kind of BN, which can couple time-series data to express the risk evolving process with time flowing forward [20]. With the application of the probabilistic inference, the critical step of BN generalization was to reveal the probabilistic dependencies of random variables, which are also expressed in time sequence in the DBN. Two types of dependencies existed in the DBN: dependencies within one time slice and dependencies among time slices. The DBN model consisted of observable evidence X = {x1,x2, … , xt} and hidden variables Y = {y1, y2, … , yt}, which were traffic state variables and crash likelihood, respectively. When a Markov model and a BN were integrated to construct a DBN model, there were a transition model P(xt|xt−1), an observation model P(yt|xt), and an initial state distribution P(x1). The joint probability distribution can be expressed as follows:(3)PX,Y=∏t=2tPxt|xt−1∏t=1tPyt|xtPx1.There were three key steps to initialize a DBN model: (1) The ChiMerge algorithm was adopted to implement the discretization of continuous variables. (2) Structure learning was applied to present the graphic dependencies among variables. In this step, the DBN not only estimated the dependencies between variables within one time slice but also examined them among different time slices. The PC algorithm was used to build the structure of the BN within one slice among traffic state variables and crash likelihood. Then, the same variables among different slices were connected to build the structure of the DBN. (3) Parameter learning was conducted to learn the conditional probability distribution of variables within one time slice and across time slices. Parameter estimation was tested by the Expectation Maximization (EM) algorithm.


### 2.4. ChiMerge Algorithm

The continuous variables are usually problematic in DBNs because it fails to capture the relationships between the continuous variables [34]. The classical way to deal with continuous variables in DBNs is to discretize the variables [35]. Discretization is the operation of dividing continuous variables into a small number of intervals, where each interval is mapped to a discrete symbol. There are two widely used simple methods, the equal-width intervals, which divides the variables between the minimum and maximum values into a number of intervals in equal size, and the equal-frequency intervals, where the interval boundaries are chosen based on the fact that each interval contains the same number of samples. However, both of the methods ignore the class of samples [36]. A good discretization has both the intrainterval uniformity and interinterval difference. ChiMerge algorithm performs merging operation by using the χ2 statistic to test whether there are significant differences or similarities of relative class frequencies between adjacent intervals.The ChiMerge algorithm is mainly consisted of several steps.(1)
Sort the samples according to their value.(2)
Calculate theχ2 value for each pair of adjacent intervals with the following equation:(4)χ2=∑i=1m∑j=1nAij−Eij2Eij,wherem = 2 (the 2 intervals being compared), n = 2 (number of classes, i.e., crash and noncrash), Aij = number of samples in the ith interval, jth class, and Eij = expected frequency of Aij.(3)
Merge the pair of adjacent intervals with the lowestχ2 value until all pairs of intervals with χ2 values beyond χ2 threshold. The χ2 threshold is determined by a desired significance level (0.95 percentile level in this study) and the number of degrees of freedom (1 less than the number of classes). There are 2 classes (crash and noncrash); thus, the degree of freedom is 1. Finally, the χ2 value is 3.841.


### 2.5. PC Algorithm

The PC algorithm is an efficient and classical algorithm used for structural learning in BN [37, 38]. The process of the PC algorithm mainly consists of three steps:(1)
Determine the skeleton of the graph by conditional independence tests. LetX = {x1, x2, …, xk}be a set of random variables and V = {v1,v2,…,vk} be a set of nodes in a graph so that each node in V represents a random variable in X. Then, construct an undirected graph G where all nodes are connected to each other, and then the PC algorithm implements statistical tests to remove or maintain edges between adjacent nodes xi and xj given a conditioning xγ in the graph by calculating the cross entropy CE(xi, xj | xγ):(5)CExi,xj|xγ=∑xγPxγ∑xi,xjPxi,xj|xγ⋅logPxi,xj|xγPxi|xγPxj|xγ.The PC algorithm adoptsG2 test statistic, which equals 2nCE(xi, xj|xγ) with n indicating the sample size, to verify the independence. The result of this first step is the skeleton of the graph.(2)
Search thev-structures. If two variables xi and xj are not conditionally independent with given xγ, then vγ is determined as a collider node and a v-structure vi ⟶ vγ ← vj is drawn, and the other edges remain undirected vi − vγ − vj.(3)
Confirm the directions of the rest of the edges. Combining with expert experience, some undirected edges between nodes are specified based on the principles where any cycle and any otherv-configuration are not allowed.


### 2.6. Expectation Maximization (EM) Algorithm

The EM algorithm is a general algorithm to calculate maximal log likelihood and the performance has been proved to be effective in parameter learning of BN [39]. The basic theory of the EM algorithm is to learn the dependence among the nodes by iterating the process of parameters estimation [40]. The EM algorithm mainly consists of three steps:(1)
Initializeθ: Given a set of unknown parameters θ, the value of a log likelihood is maximized. The object function is(6)ℓθ;X=logPX|θ=log∑YPY,X|θ.Introduce a distributionQ(Y): an initialization distribution of θ is defined based on Jensen’s inequality:(7)ℓθ;X=log∑YQYPY,X|θQY≥∑YQYlogPY,X|θQY.(2)
E-Step: Calculate the distributionQ(Y) = P(Y|X; θ), which is viewed as the E-step.(3)
M-Step: Optimize the parameters based on the estimation of the joint probability distribution, which is viewed as the M-step.(8)θ′=argmaxθ∑YQYlogPY,X|θQY.θ′ replaces θ. The iterations process would be repeated until a local optimum of the estimated parameters is achieved.


### 2.7. Multilayer Perceptron (MLP)

The neural network, an effective function approximator, is often used to solve regression and prediction problems in various fields. A general multilayer perceptron model can be performed by the following 3 steps.(1)
Initialize the MLP model. Assume that the original function can be approximated by a set of basic functions:(9)Fx=∑i=1mwiφix+e,whereF is the original function, x is the input vector, m is the number of network synapses, w is the weight of synapses, φ is the basis function allocated on synapses, commonly used functions with S-shaped curves (such as tanh), and e is the error.(2)
Load the sample point pair (x, y) and calculate the error between the predicted and true values:(10)e=∑iwiφix−y,wherey is the true value of the sample.(3)
Adjust network synapse weights according to error feedback. The general calculation formula of the adjustment is(11)Δw=φ′x∑kwkek,wherek is the layer after which the neuron to be adjusted is located. When the adjustment ∆w is less than a preset threshold value η, this step would be terminated; otherwise, the weights would be updated and the process would go back to Step (2).


## 2.1. Study Area and Data Preparation

The 40 segments of the Yan'an elevated expressway in Shanghai, China, sequentially linking up to each other along the westbound and eastbound expressway, were selected as the study areas (see Figure1). All segments are three-lane with detectors spaced at an approximate distance of 300–500 m. Each segment has similar road geometry and on/off-ramp arrangement; thus, the road geometries and ramp locations were not considered as influencing variables on the crash risk. There were 82 crashes that happened on the Yan'an expressway during August and September 2018. The dates, times, and segment IDs of the crashes were collected. Based on the matched case-control design, three corresponding noncrash cases for each crash case were randomly matched for the same segment and occurrence time (246 noncrash cases in total). Besides, traffic flow characteristics and weather variables were also obtained as inputs of the RTCPM, aiming at classifying the crash and noncrash states based on the investigation of relationship between crash risk, traffic flow characteristics, and weather conditions.Figure 1
Yan'an elevated expressway, Shanghai, China.The existing dual-loop detectors in study areas are available for providing the average speed (km/h) and the average volume of a single lane (pcu/h) for each segment. Hourly weather variables, including visibility (km) and weather type (rainy or sunny), were collected from the Shanghai Xujiahui Observatory, which is 7.5 km far from the Yan'an expressway. In this study, the Traffic Performance Index (TPI) varying between 0 and 1 was applied as an indicator to measure the magnitude of congestion degree, where 1 is a traffic jam state and 0 is a free flow state (equation (1)). Consider(1)TPI=Vmax−ViVmax,where Vmax is the maximum speed and Vi is the average speed at the ith time period.The average speed data on the current, upstream, and downstream segments of the crash location and the TPI of the whole expressway were aggregated in 5-minute intervals. The evolution of traffic flow with time leading to a crash was a dynamic process; thus, the traffic flow characteristics of several time intervals before the crash should be combined to build the model. The intervals of 0–5 min (time slice 0), 5–10 min (time slice 1), and 10–15 min (time slice 2) prior to the crash were considered. The time slice 0 was excluded, because the crash warning system needs some time to recognise crash states, and the actual crash occurrence time and recorded time are not always completely consistent. Due to the raw weather data updated once an hour, the weather condition was regarded as a stable influencing variable across different time slices. Finally, the traffic flow and weather data corresponding to 82 crash cases and 246 noncrash cases were generated. In total, nine variables combining traffic flow characteristics on current, upstream, and downstream segments of the crash location with weather condition are shown in Table1.Table 1
Information of the nine alternative variables.
VariableDescriptionTPIThe average TPI of the whole expressway within 5 min intervalVThe average speed of current segment within 5 min interval (km/h)U_VThe average speed of upstream segment within 5 min interval (km/h)D_VThe average speed of downstream segment within 5 min interval (km/h)QThe volume of current segment within 5 min interval (pcu/h)U_QThe volume of upstream segment within 5 min interval (pcu/h)D_QThe volume of downstream segment within 5 min interval (pcu/h)VisibilityThe horizontal visibility within one hour (km)WeatherThe weather type in one hour, rainy or sunny


## 2.2. Random Forest (RF)

The main purpose of constructing RTCPM is to evaluate crash risk in real time. High-dimensional variable space can increase the processing complexity of the RTCPM. Thus, Random Forest (RF), a widely used variable selection model, was implemented in this study to select influencing variables and reduce the redundancy of variables. Variable importance (VI) metric was used as the criterion to pick the mostly related variables [12, 30], which can be determined with the following steps.(1)
SampleN amount of data from the learning set to build a tree classifier by bootstrap sample technique, and the remaining samples of the learning set were not used in the growth of the tree. The left-out samples, an effective internal test data set, were called out-of-bag (OOB) data, which were adopted to obtain an unbiased error estimate. m number of variables were randomly selected from the original variable set M (m <M), and the best split variable in m at each tree node was adopted to split node. Each tree grew naturally without pruning. Repeat this step k times to construct RF consisting of k trees.(2)
Each tree classifier produced a classification result by voting for the binary target (crash or noncrash) based on OOB samples, and the classification error rateRi was calculated consequently.(3)
Add random noise disturbance for the values of any variable in the OOB sample, and the new OOB sample was produced. Each tree that was implemented for crash/noncrash classification tests with the new OOB sample was used to calculate the classification error rateRi’.(4)
VI was calculated as the increase in the mean of the classification error rate of trees after adding random noise disturbance. The calculation formula was shown in the following equation:(2)VI=1k∑i=1kRi′−Ri.


## 2.3. Dynamic Bayesian Network (DBN)

The Bayesian Network (BN) is a probabilistic graphical model that expresses the probability relationships among a set of variables that connect those variables in a directed acyclic graph (DAG). The BN has the advantages in learning causal relationships, predicting the consequences of intervention, and analyzing the most probable explanations of consequences. Some researchers have adopted BN to evaluate and analyze traffic accidents risk [31–33]. Most crashes did not happen based on a particular point in time, but they can be described through multiple traffic states among a series of time slices. The DBN is a kind of BN, which can couple time-series data to express the risk evolving process with time flowing forward [20]. With the application of the probabilistic inference, the critical step of BN generalization was to reveal the probabilistic dependencies of random variables, which are also expressed in time sequence in the DBN. Two types of dependencies existed in the DBN: dependencies within one time slice and dependencies among time slices. The DBN model consisted of observable evidence X = {x1,x2, … , xt} and hidden variables Y = {y1, y2, … , yt}, which were traffic state variables and crash likelihood, respectively. When a Markov model and a BN were integrated to construct a DBN model, there were a transition model P(xt|xt−1), an observation model P(yt|xt), and an initial state distribution P(x1). The joint probability distribution can be expressed as follows:(3)PX,Y=∏t=2tPxt|xt−1∏t=1tPyt|xtPx1.There were three key steps to initialize a DBN model: (1) The ChiMerge algorithm was adopted to implement the discretization of continuous variables. (2) Structure learning was applied to present the graphic dependencies among variables. In this step, the DBN not only estimated the dependencies between variables within one time slice but also examined them among different time slices. The PC algorithm was used to build the structure of the BN within one slice among traffic state variables and crash likelihood. Then, the same variables among different slices were connected to build the structure of the DBN. (3) Parameter learning was conducted to learn the conditional probability distribution of variables within one time slice and across time slices. Parameter estimation was tested by the Expectation Maximization (EM) algorithm.


## 2.4. ChiMerge Algorithm

The continuous variables are usually problematic in DBNs because it fails to capture the relationships between the continuous variables [34]. The classical way to deal with continuous variables in DBNs is to discretize the variables [35]. Discretization is the operation of dividing continuous variables into a small number of intervals, where each interval is mapped to a discrete symbol. There are two widely used simple methods, the equal-width intervals, which divides the variables between the minimum and maximum values into a number of intervals in equal size, and the equal-frequency intervals, where the interval boundaries are chosen based on the fact that each interval contains the same number of samples. However, both of the methods ignore the class of samples [36]. A good discretization has both the intrainterval uniformity and interinterval difference. ChiMerge algorithm performs merging operation by using the χ2 statistic to test whether there are significant differences or similarities of relative class frequencies between adjacent intervals.The ChiMerge algorithm is mainly consisted of several steps.(1)
Sort the samples according to their value.(2)
Calculate theχ2 value for each pair of adjacent intervals with the following equation:(4)χ2=∑i=1m∑j=1nAij−Eij2Eij,wherem = 2 (the 2 intervals being compared), n = 2 (number of classes, i.e., crash and noncrash), Aij = number of samples in the ith interval, jth class, and Eij = expected frequency of Aij.(3)
Merge the pair of adjacent intervals with the lowestχ2 value until all pairs of intervals with χ2 values beyond χ2 threshold. The χ2 threshold is determined by a desired significance level (0.95 percentile level in this study) and the number of degrees of freedom (1 less than the number of classes). There are 2 classes (crash and noncrash); thus, the degree of freedom is 1. Finally, the χ2 value is 3.841.


## 2.5. PC Algorithm

The PC algorithm is an efficient and classical algorithm used for structural learning in BN [37, 38]. The process of the PC algorithm mainly consists of three steps:(1)
Determine the skeleton of the graph by conditional independence tests. LetX = {x1, x2, …, xk}be a set of random variables and V = {v1,v2,…,vk} be a set of nodes in a graph so that each node in V represents a random variable in X. Then, construct an undirected graph G where all nodes are connected to each other, and then the PC algorithm implements statistical tests to remove or maintain edges between adjacent nodes xi and xj given a conditioning xγ in the graph by calculating the cross entropy CE(xi, xj | xγ):(5)CExi,xj|xγ=∑xγPxγ∑xi,xjPxi,xj|xγ⋅logPxi,xj|xγPxi|xγPxj|xγ.The PC algorithm adoptsG2 test statistic, which equals 2nCE(xi, xj|xγ) with n indicating the sample size, to verify the independence. The result of this first step is the skeleton of the graph.(2)
Search thev-structures. If two variables xi and xj are not conditionally independent with given xγ, then vγ is determined as a collider node and a v-structure vi ⟶ vγ ← vj is drawn, and the other edges remain undirected vi − vγ − vj.(3)
Confirm the directions of the rest of the edges. Combining with expert experience, some undirected edges between nodes are specified based on the principles where any cycle and any otherv-configuration are not allowed.


## 2.6. Expectation Maximization (EM) Algorithm

The EM algorithm is a general algorithm to calculate maximal log likelihood and the performance has been proved to be effective in parameter learning of BN [39]. The basic theory of the EM algorithm is to learn the dependence among the nodes by iterating the process of parameters estimation [40]. The EM algorithm mainly consists of three steps:(1)
Initializeθ: Given a set of unknown parameters θ, the value of a log likelihood is maximized. The object function is(6)ℓθ;X=logPX|θ=log∑YPY,X|θ.Introduce a distributionQ(Y): an initialization distribution of θ is defined based on Jensen’s inequality:(7)ℓθ;X=log∑YQYPY,X|θQY≥∑YQYlogPY,X|θQY.(2)
E-Step: Calculate the distributionQ(Y) = P(Y|X; θ), which is viewed as the E-step.(3)
M-Step: Optimize the parameters based on the estimation of the joint probability distribution, which is viewed as the M-step.(8)θ′=argmaxθ∑YQYlogPY,X|θQY.θ′ replaces θ. The iterations process would be repeated until a local optimum of the estimated parameters is achieved.


## 2.7. Multilayer Perceptron (MLP)

The neural network, an effective function approximator, is often used to solve regression and prediction problems in various fields. A general multilayer perceptron model can be performed by the following 3 steps.(1)
Initialize the MLP model. Assume that the original function can be approximated by a set of basic functions:(9)Fx=∑i=1mwiφix+e,whereF is the original function, x is the input vector, m is the number of network synapses, w is the weight of synapses, φ is the basis function allocated on synapses, commonly used functions with S-shaped curves (such as tanh), and e is the error.(2)
Load the sample point pair (x, y) and calculate the error between the predicted and true values:(10)e=∑iwiφix−y,wherey is the true value of the sample.(3)
Adjust network synapse weights according to error feedback. The general calculation formula of the adjustment is(11)Δw=φ′x∑kwkek,wherek is the layer after which the neuron to be adjusted is located. When the adjustment ∆w is less than a preset threshold value η, this step would be terminated; otherwise, the weights would be updated and the process would go back to Step (2).


## 3. Results and Discussion

The DBN-based RTCPM was constructed based on the training dataset (involving 264 crash data and noncrash data) and validated based on the validation dataset (involving 64 crash data and noncrash data).


### 3.1. Variable Selection

Figure2 shows the variable importance ranking which was determined by RF method. It is clear that the most important three variables were the TPI (0.151), V (0.144), and U_V (0.144) (VI >0.14). The relative importance of other variables was less than 0.12. Therefore, the TPI, V, and U_V were selected as influencing variables to construct the DBN model. It is surprising that the visibility and weather played limited roles. It is probably explained by the collection time of the crash data (from August to September), when there were more daylight and less visibility differences (mean = 21.32 km, SD = 10.90 km). According to the Horizontal Visibility Grading of Chinese Standard (GB/T 33673–2017), when the visibility is greater than or equal to 10 km, the visual field is considered as a good level. Therefore, the overall good visibility did not contribute a lot to crash risk in this study. In addition, a classified weather variable, the weather type (rainy/sunny), was used as the proxy to represent the weather condition in this study, rather than a quantized variable, rainfall. We assume that the relationship between the crash risk and rainfall might be more obvious than the weather type.Figure 2
Variable importance ranking determined by Random Forest.


### 3.2. DBN Model Construction

The DBN models with and without considering the interdependence among traffic flow characteristics (TPI, V, and U_V) were both constructed based on the training dataset. The former model (the improved DBN-based RTCPM) was the main purpose, and the latter one (the original DBN-based RTCPM) was developed for comparison. Before constructing the graphical structure of the improved DBN-based RTCPM, the three traffic flow characteristics were discretized according to their corresponding crash cases using the ChiMerge algorithm. The number of discretization states of every variable was confined to 10 so that the calculation complexity in DBN models can be decreased. The discretization ranges of TPI, V, and U_V are presented in Figures3–5, respectively. The results showed that the adjacent discretization intervals in every variable were characterized by distinguishable crash/noncrash ratio, indicating that the ChiMerge algorithm performs a good discretization.Figure 3
Discretization ranges of TPI.Figure 4
Discretization ranges of V.Figure 5
Discretization ranges of U_V.After discretization, the PC algorithm and expert assessment were utilized to investigate the interdependency among traffic flow characteristics within one time slice. The dynamicity of traffic flow characteristics was reflected by connecting the same variables from time slice 2 to time slice 1. The dynamicity and interdependency determined the graphical structure of the improved DBN-based RTCPM (Figure6). The original DBN-based RTCPM did not consider the interdependency among traffic flow characteristics, and its graphical structure was directly determined by connecting the traffic flow variables to crash risk within one time slice and connecting the same variables between two time slices (Figure 7).Figure 6
Graphical structural of the improved DBN-based RTCPM.Figure 7
Graphical structural of the original DBN-based RTCPM.Afterwards the parameter learning process was implemented using the EM algorithm. The initial states of the improved DBN-based RTCPM and the original DBN-based RTCPM are presented in Figures8 and 9, respectively. It was observed that their overall probabilities of a traffic flow state being associated with a crash were different (36% and 42%, respectively) when no new evidence was entered into the DBN. This difference suggested the importance of comparing the performance of the two types of DBN-based RTCPM.Figure 8
Initial state of the improved DBN-based RTCPM.Figure 9
Initial state of the original DBN-based RTCPM.


### 3.3. Model Validation and Comparison

The validation dataset was used to validate the DBN models. When no new evidence was entered into the DBN, the marginal probability of crash risk node of initial state of DBN model was set as the classification threshold for evaluating the model performance. And then, each validation dataset was entered individually in the models. The crash risks, i.e., the posterior probability of crash risk node, relating to the prone traffic condition, were calculated based on the prior probabilities. Several evaluation metrics based on the confusion matrix (Table2) are presented in the following equations:(12)overall_accuracy=Tcrash+TnoncrashTcrash+Fcrash+Fnoncrash+Tnoncrash,(13)sensitivity=TcrashTcrash+Fnoncrash,(14)specificity=TnoncrashTnoncrash+Fcrash,(15)precision=TcrashTcrash+Fcrash,(16)recall=TcrashTcrash+Fnoncrash,(17)F−measure=2∗precision∗recallprecision+recall,(18)G−means=sensitivity∗specificity.Table 2
Confusion matrix.
Predicted crashesPredicted noncrashesActual crashesTcrashFnoncrashActual noncrashesFcrashTnoncrashBesides the overall accuracy from equation (12), the sensitivity from equation (13), G-means from equation (17), and F-measure from equation (18) were used to compare the performance of two types of DBNs and MLP. For imbalanced classification, the overall accuracy metric is not sufficient due to its inability to examine the minor positive samples; thus, the sensitivity was chosen as the supplementary metric to examine the crash classification accuracy. The F-measure is the harmonic mean of precision and recall and represents the ability to detect crashes. Furthermore, the balanced classification ability can be reflected by G-means, which is the geometric mean of sensitivity and specificity. The comparison results are presented in Table 3.Table 3
Performance comparison of two types of DBNs and MLP.
Overall accuracySensitivityF-measureG-meansOriginal DBN-based RTCPM0.7500.3130.3850.529Improved DBN-based RTCPM0.7660.6880.5950.738MLP-based RTCPM0.7250.5560.4760.656As illustrated by Table3, all the models can reach a good classification accuracy. Among them, the improved DBN-based RTCPM showed the best overall classification accuracy, followed by the original DBN-based RTCPM and MLP-based RTCPM. For the crash detection ability, the sensitivity metric indicated that the improved DBN-based RTCPM performed the best, and the relatively poor performance was seen in the original DBN-based RTCPM. Furthermore, the F-measure also suggested that the improved DBN-based RTCPM had better crash prediction ability than the original DBN-based RTCPM and MLP-based RTCPM. With respect to the balanced classification ability, the G-means revealed that the improved DBN-based RTCPM achieved better than the other models. For all the comparisons, the results demonstrated that the improved DBN-based RTCPM can achieve desirable overall prediction performance. It is also demonstrated that this model had an effective ability to monitor crashes in real time. Meanwhile, the model can keep the balance between crash and no-crash prediction. In summary, the prediction performance of DBN-based RTCPM can be improved by accounting for the interdependence of traffic flow characteristics.


### 3.4. Sensitivity and Strength of Influences Analysis

Investigation of the interdependency among the traffic flow also contributes to revealing the underlying mechanism of crash occurrence, which is helpful for formulating the real-time risk control measures. The sensitivity and strength of influences analysis were implemented in a professional DBN analysis software, Genie, to identify the most significant contributors to crash risk and the most probable risk propagation path.


### 3.5. Sensitivity Analysis

The sensitivity analysis of Genie can be utilized to identify which node had greater contribution to the target node in DBN. Setting the crash risk as the target node, conducting sensitivity analysis on it, and the contribution degrees of traffic flow characteristics on crash risks are presented in Figure10 in a descending order. The results showed that the TPI in time slice 2 was the most sensitive factor that results in crash risk, followed by V in time slice 2, TPI in time slice 1, etc.Figure 10
Results of sensitivity analysis.


### 3.6. Strength of Influences Analysis

The strength of influences analysis was utilized to identify the most probable risk propagation path based on the improved interdependency structure. The strength of influence is always calculated from the distance between the probability distributions of the child node conditional on the state of its parent node. As shown in Figure11, the arcs have different values and thicknesses, presenting the strength of influence between connected nodes. The biggest accumulative value indicates that the most probable risk propagation path is V (time slice 2)⟶V (time slice 1)⟶U_V (time slice 1)⟶TPI (time slice 1)⟶crash risk on current segment.Figure 11
Results of strength of influences analysis.Synthesizing the results of sensitivity and strength of influences analysis can be used to identify the most probable risk propagation path, as well as determine the most sensitive contributor in the propagation path. The results suggested that the sequence and emphasis of the real-time risk countermeasures should sequentially lay on V (time slice 2), TPI (time slice 1), V (time slice 1), and U_V (time slice 1).


## 3.1. Variable Selection

Figure2 shows the variable importance ranking which was determined by RF method. It is clear that the most important three variables were the TPI (0.151), V (0.144), and U_V (0.144) (VI >0.14). The relative importance of other variables was less than 0.12. Therefore, the TPI, V, and U_V were selected as influencing variables to construct the DBN model. It is surprising that the visibility and weather played limited roles. It is probably explained by the collection time of the crash data (from August to September), when there were more daylight and less visibility differences (mean = 21.32 km, SD = 10.90 km). According to the Horizontal Visibility Grading of Chinese Standard (GB/T 33673–2017), when the visibility is greater than or equal to 10 km, the visual field is considered as a good level. Therefore, the overall good visibility did not contribute a lot to crash risk in this study. In addition, a classified weather variable, the weather type (rainy/sunny), was used as the proxy to represent the weather condition in this study, rather than a quantized variable, rainfall. We assume that the relationship between the crash risk and rainfall might be more obvious than the weather type.Figure 2
Variable importance ranking determined by Random Forest.


## 3.2. DBN Model Construction

The DBN models with and without considering the interdependence among traffic flow characteristics (TPI, V, and U_V) were both constructed based on the training dataset. The former model (the improved DBN-based RTCPM) was the main purpose, and the latter one (the original DBN-based RTCPM) was developed for comparison. Before constructing the graphical structure of the improved DBN-based RTCPM, the three traffic flow characteristics were discretized according to their corresponding crash cases using the ChiMerge algorithm. The number of discretization states of every variable was confined to 10 so that the calculation complexity in DBN models can be decreased. The discretization ranges of TPI, V, and U_V are presented in Figures3–5, respectively. The results showed that the adjacent discretization intervals in every variable were characterized by distinguishable crash/noncrash ratio, indicating that the ChiMerge algorithm performs a good discretization.Figure 3
Discretization ranges of TPI.Figure 4
Discretization ranges of V.Figure 5
Discretization ranges of U_V.After discretization, the PC algorithm and expert assessment were utilized to investigate the interdependency among traffic flow characteristics within one time slice. The dynamicity of traffic flow characteristics was reflected by connecting the same variables from time slice 2 to time slice 1. The dynamicity and interdependency determined the graphical structure of the improved DBN-based RTCPM (Figure6). The original DBN-based RTCPM did not consider the interdependency among traffic flow characteristics, and its graphical structure was directly determined by connecting the traffic flow variables to crash risk within one time slice and connecting the same variables between two time slices (Figure 7).Figure 6
Graphical structural of the improved DBN-based RTCPM.Figure 7
Graphical structural of the original DBN-based RTCPM.Afterwards the parameter learning process was implemented using the EM algorithm. The initial states of the improved DBN-based RTCPM and the original DBN-based RTCPM are presented in Figures8 and 9, respectively. It was observed that their overall probabilities of a traffic flow state being associated with a crash were different (36% and 42%, respectively) when no new evidence was entered into the DBN. This difference suggested the importance of comparing the performance of the two types of DBN-based RTCPM.Figure 8
Initial state of the improved DBN-based RTCPM.Figure 9
Initial state of the original DBN-based RTCPM.


## 3.3. Model Validation and Comparison

The validation dataset was used to validate the DBN models. When no new evidence was entered into the DBN, the marginal probability of crash risk node of initial state of DBN model was set as the classification threshold for evaluating the model performance. And then, each validation dataset was entered individually in the models. The crash risks, i.e., the posterior probability of crash risk node, relating to the prone traffic condition, were calculated based on the prior probabilities. Several evaluation metrics based on the confusion matrix (Table2) are presented in the following equations:(12)overall_accuracy=Tcrash+TnoncrashTcrash+Fcrash+Fnoncrash+Tnoncrash,(13)sensitivity=TcrashTcrash+Fnoncrash,(14)specificity=TnoncrashTnoncrash+Fcrash,(15)precision=TcrashTcrash+Fcrash,(16)recall=TcrashTcrash+Fnoncrash,(17)F−measure=2∗precision∗recallprecision+recall,(18)G−means=sensitivity∗specificity.Table 2
Confusion matrix.
Predicted crashesPredicted noncrashesActual crashesTcrashFnoncrashActual noncrashesFcrashTnoncrashBesides the overall accuracy from equation (12), the sensitivity from equation (13), G-means from equation (17), and F-measure from equation (18) were used to compare the performance of two types of DBNs and MLP. For imbalanced classification, the overall accuracy metric is not sufficient due to its inability to examine the minor positive samples; thus, the sensitivity was chosen as the supplementary metric to examine the crash classification accuracy. The F-measure is the harmonic mean of precision and recall and represents the ability to detect crashes. Furthermore, the balanced classification ability can be reflected by G-means, which is the geometric mean of sensitivity and specificity. The comparison results are presented in Table 3.Table 3
Performance comparison of two types of DBNs and MLP.
Overall accuracySensitivityF-measureG-meansOriginal DBN-based RTCPM0.7500.3130.3850.529Improved DBN-based RTCPM0.7660.6880.5950.738MLP-based RTCPM0.7250.5560.4760.656As illustrated by Table3, all the models can reach a good classification accuracy. Among them, the improved DBN-based RTCPM showed the best overall classification accuracy, followed by the original DBN-based RTCPM and MLP-based RTCPM. For the crash detection ability, the sensitivity metric indicated that the improved DBN-based RTCPM performed the best, and the relatively poor performance was seen in the original DBN-based RTCPM. Furthermore, the F-measure also suggested that the improved DBN-based RTCPM had better crash prediction ability than the original DBN-based RTCPM and MLP-based RTCPM. With respect to the balanced classification ability, the G-means revealed that the improved DBN-based RTCPM achieved better than the other models. For all the comparisons, the results demonstrated that the improved DBN-based RTCPM can achieve desirable overall prediction performance. It is also demonstrated that this model had an effective ability to monitor crashes in real time. Meanwhile, the model can keep the balance between crash and no-crash prediction. In summary, the prediction performance of DBN-based RTCPM can be improved by accounting for the interdependence of traffic flow characteristics.


## 3.4. Sensitivity and Strength of Influences Analysis

Investigation of the interdependency among the traffic flow also contributes to revealing the underlying mechanism of crash occurrence, which is helpful for formulating the real-time risk control measures. The sensitivity and strength of influences analysis were implemented in a professional DBN analysis software, Genie, to identify the most significant contributors to crash risk and the most probable risk propagation path.


## 3.5. Sensitivity Analysis

The sensitivity analysis of Genie can be utilized to identify which node had greater contribution to the target node in DBN. Setting the crash risk as the target node, conducting sensitivity analysis on it, and the contribution degrees of traffic flow characteristics on crash risks are presented in Figure10 in a descending order. The results showed that the TPI in time slice 2 was the most sensitive factor that results in crash risk, followed by V in time slice 2, TPI in time slice 1, etc.Figure 10
Results of sensitivity analysis.


## 3.6. Strength of Influences Analysis

The strength of influences analysis was utilized to identify the most probable risk propagation path based on the improved interdependency structure. The strength of influence is always calculated from the distance between the probability distributions of the child node conditional on the state of its parent node. As shown in Figure11, the arcs have different values and thicknesses, presenting the strength of influence between connected nodes. The biggest accumulative value indicates that the most probable risk propagation path is V (time slice 2)⟶V (time slice 1)⟶U_V (time slice 1)⟶TPI (time slice 1)⟶crash risk on current segment.Figure 11
Results of strength of influences analysis.Synthesizing the results of sensitivity and strength of influences analysis can be used to identify the most probable risk propagation path, as well as determine the most sensitive contributor in the propagation path. The results suggested that the sequence and emphasis of the real-time risk countermeasures should sequentially lay on V (time slice 2), TPI (time slice 1), V (time slice 1), and U_V (time slice 1).


## 4. Conclusions

This study aimed to build a RTCPM for urban elevated expressway by using the DBN model to capture the dynamicity and coupling interdependency among traffic flow characteristics before crash occurrence. The model was built and validated adopting traffic flow data collected on the Yan'an elevated expressway. Based on the DBN-based RTCPM, the sensitivity and strength of influences analysis were utilized to identify the most probable risk propagation path and the most sensitive contributors to crash risk. The main conclusions are as follows:(1)
In model construction process, interdependency in the DBN model was determined by the PC algorithm and expert experience, and the dynamicity of traffic flow characteristics was expressed by adopting data in time slices. By validation, the improved DBN-based RTCPM got an overall accuracy of 76.6%, with a crash prediction accuracy of 68.8% and a crash/noncrash balanced classification accuracy of 73.8%. The results indicated that the model can achieve an effective crash prediction for urban elevated expressway.(2)
Comparisons of the original DBN-based RTCPM and MLP-based RTCPM suggested that the improved DBN-based RTCPM can identify the interdependency among traffic flow characteristics before crash occurrences. The comparison results also indicated that the improved DBN-based RTCPM was more suitable for the prediction of real-time crashes for urban elevated expressway.(3)
According to the results of sensitivity and strength of influences analysis, the most probable risk propagation path is V (time slice 2)⟶V (time slice 1)⟶U_V (time slice 1)⟶TPI (time slice 1)⟶crash risk on current segment, and the most sensitive contributor to crash risk in this path is V (time slice 2), followed by TPI (time slice 1), V (time slice 1), and U_V (time slice 1). The results suggested that the formulation of the real-time risk countermeasures should sequentially focus on this sequence in the propagation path.There would be two extensions in future research. On the one hand, the model was built and validated on the same urban elevated expressway; thus, the transferability of the model to another urban elevated expressway has not been discussed. On the other hand, the specific real-time risk countermeasures such as variable speed limit (VSL) can be investigated to improve crash risk.



---

*Source: 5569143-2021-05-15.xml*