## 2 Literature Review  
The increasing demand for highways has resulted in complex traffic flows, leading to a wide scope of research on modeling and predicting traffic accidents [6; 7]. Generally, the occurrence of a traffic accident on a highway is associated with the upstream and downstream traffic flow status. Specifically, an increase in the downstream traffic density (road occupancy rate) results in differences in the upstream traffic speed and causes traffic accidents [8]. Before an accident occurs, vehicles in the traffic flow are in relative motion. When the speed of a vehicle substantially varies from the mean speed of the traffic flow, the probability of a crash increases [9; 10]. Therefore, traffic speed differences should be considered in the prediction of traffic accidents and establishment of warning mechanisms. Real-time crash prediction methods typically rely on statistical and machine learning approaches. Statistical methods include logistic models and Bayesian logistic models [11; 12]. With the emergence of big data analysis and artificial intelligence, various machine learning methods, including artificial neural networks [13], support vector machines [14], and random forest models [15], have been used in real-time crash prediction to achieve high prediction accuracy. Relevant studies have indicated that deep learning can further enhance the real-time prediction of traffic accidents by machine learning models [16] and that machine learning is more accurate than statistical approaches [17]. For instance, [PERSON] et al. [2] used real-time traffic and weather parameters to examine factors affecting highway traffic accidents. They reported that, compared with shallow neural networks and other machine learning methods, deep learning models yielded more accurate results. [PERSON] al. [18] used spatiotemporal correlation models to develop a highly accurate deep learning model for predicting the risk of traffic accidents. They confirmed that their model was able to effectively predict accidents. [PERSON] et al. [19] proposed a structure learning method to constructing Bayesian networks. The network can fully illustrate the causal relationship between risk contribution characteristics and risk events on the vehicle road. The results indicate that the optimal network has achieved satisfactory results in terms of structure complexity and prediction accuracy. In addition, compared with the networks constructed by other state-of-the-art structural learning methods, the optimal networks show superior performance in terms of causality interpretation. In the present study, the data recorded for traffic accidents and normal traffic were highly imbalanced, which means that direct use of this dataset in model training will produce prediction results that do not reflect the actual condition, resulting in false-positive (indicating the occurrence of an accident although none occurred) or false-negative (indicating the absence of an accident although one did occur) errors. Therefore, the imbalanced dataset used in this study must be balanced first. In the current development of prediction models, data balancing methods have received increasing attention. Undersampling and oversampling methods have been used to convert imbalanced training data to balanced data. Notably, previous studies have predominantly used manually balanced data to train and verify models. However, manual balancing through undersampling methods may result in the loss of crucial data recording the occurrence of normal events. By contrast, oversampling methods may repeat or excessively emphasize crash event data, resulting in overfitting [20]. Class weight and focal loss methods do not process imbalanced data directly. Instead, they involve the use of loss functions to adjust the weights of imbalanced data in neural networks and resolve the problem of imbalanced data. [PERSON] and [PERSON] [21] used driver risk prediction datasets to prepare training data and extract features in order to increase the accuracy of their model.