Research Article
Predicting Freeway Traffic Crash Severity Using XGBoost-Bayesian Network Model with Consideration of Features Interaction
Algorithm 1
K2 algorithm optimization process.
| Input: node variable set “n,” node order “order,” maximum number of parent nodes “Max_fan_in,” observation data set “D.” | | Output: Optimal network structure based on K2 algorithm, that is, each point and its parent node. | (1) | for i = 1 to n (n represents the number of total nodes); | (2) | π i = ∅; | (3) | p old = (i, πi); | (4) | Set variable OKTOProceed = true; | (5) | while OKTOProceed = true and |πi| < m do; | (6) | pick one node z from pred (i) − πi, let (i, πi {z}) maximize, where pred (i) denotes the nodes whose order is before the ith node; | (7) | Calculate ; | (8) | If then; | (9) | ; | (10) | ; | (11) | ; | (12) | else ; | (13) | end while; | (14) | return (node , parent node ); | (15) | end for; | (16) | end K2. |
|