A traffic accident severity prediction method, system and computer storage medium

By selecting feature data using random forests, combining lightweight gradient boosting machines and focus loss functions, and adjusting parameters using Bayesian optimization, the problem of insufficient identification of severe accidents in traffic accident severity prediction is solved, achieving higher recall and more effective allocation of rescue resources.

CN116128108BActive Publication Date: 2026-05-29SHAANXI UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHAANXI UNIV OF SCI & TECH
Filing Date
2022-12-13
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In existing technologies, methods for predicting the severity of traffic accidents have poor ability to identify serious accidents and low recall rates, resulting in a mismatch between rescue resources and actual needs.

Method used

We used the random forest method to select feature data, established a prediction network based on a lightweight gradient booster, used focus loss as the loss function, and adjusted the model parameters and classification threshold through Bayesian optimization to improve the prediction ability of serious accidents.

Benefits of technology

It improved the ability to predict serious accidents, increased the detection rate by 17.4%, and ensured the effective allocation of rescue resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116128108B_ABST
    Figure CN116128108B_ABST
Patent Text Reader

Abstract

The application discloses a traffic accident severity prediction method, system and computer storage medium, the method comprises the following steps: selecting training feature data; establishing a prediction network based on a light gradient boosting machine; inputting the selected training feature data into the prediction network to obtain corresponding training prediction results; determining the difference between the training prediction results and the target results by using a loss function; optimizing and adjusting the parameters of the prediction network to obtain a prediction model; obtaining to-be-predicted feature data; inputting the to-be-predicted feature data into the prediction model to predict the corresponding traffic accident severity. The application selects a LightGBM model with a faster training speed to predict the accident severity, adopts a focal loss as the loss function, adjusts the classification threshold for dividing positive and negative samples, and finally uses a Bayesian optimization algorithm to find the optimal value of the model parameters, so that the recall rate of the prediction model is increased by 17.4%, and the prediction ability for serious accidents is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer data processing technology, and in particular to a method, system and computer storage medium for predicting the severity of traffic accidents. Background Technology

[0002] With economic development, the imbalance between supply and demand for transportation resources is intensifying, leading to more frequent traffic accidents. However, during accident rescue operations, the lack of accurate prediction of accident severity often results in a mismatch between dispatched rescue resources and actual needs, causing casualties. Therefore, predicting accident severity after it occurs to provide scientific reference for accident rescue organizations' decision-making is an important research direction today.

[0003] In recent years, the level of transportation informatization in various countries has been continuously improving, and the scale of traffic accident datasets has also grown rapidly. Predicting the severity of traffic accidents has become an urgent problem to be solved. However, traffic accident datasets are usually characterized by class imbalance: most samples are "minor" accident samples, and there are a large number of simple samples that are easy to classify, which play a dominant role in the convergence of the loss function, resulting in poor model recognition ability for "serious" accidents and low recall rate. Summary of the Invention

[0004] This application provides a method, system, and computer storage medium for predicting the severity of traffic accidents, in order to solve the problem that existing methods for predicting the severity of traffic accidents have poor ability to identify serious accidents.

[0005] On the one hand, embodiments of this application provide a method for predicting the severity of traffic accidents, including:

[0006] Obtain training feature data;

[0007] The random forest method is used to select training feature data;

[0008] A prediction network based on a lightweight gradient booster is established, with focus loss as the loss function;

[0009] The selected training feature data is input into the prediction network to obtain the corresponding training prediction results;

[0010] A loss function is used to determine the difference between the training prediction results and the target results;

[0011] The parameters of the prediction network are optimized and adjusted based on the differences using the Bayesian optimization method to obtain the prediction model;

[0012] Obtain the feature data to be predicted;

[0013] Input the feature data to be predicted into the prediction model to predict the severity of the traffic accident.

[0014] On the other hand, embodiments of this application also provide a traffic accident severity prediction system, including:

[0015] The training data acquisition module is used to acquire training feature data;

[0016] The data selection module is used to select training feature data using the random forest method;

[0017] The network building module is used to build a prediction network based on a lightweight gradient booster, using focus loss as the loss function.

[0018] The network training module is used to input the selected training feature data into the prediction network to obtain the corresponding training prediction results.

[0019] The difference determination module is used to determine the difference between the training prediction results and the target results using a loss function.

[0020] The parameter adjustment module is used to optimize and adjust the parameters of the prediction network based on the differences using the Bayesian optimization method to obtain the prediction model;

[0021] The module for acquiring data to be predicted is used to acquire feature data to be predicted.

[0022] The accident prediction module is used to input the feature data to be predicted into the prediction model to predict the severity of the traffic accident.

[0023] On the other hand, embodiments of this application also provide a computer storage medium storing a plurality of computer instructions for causing a computer to execute the above-described method.

[0024] The method, system, and computer storage medium for predicting the severity of traffic accidents disclosed in this application have the following advantages:

[0025] 1. The LightGBM model, which has a faster training speed, was selected for accident severity prediction. Focus loss was used as the loss function, and the classification threshold for separating positive and negative samples was adjusted. Finally, the Bayesian optimization algorithm was used to find the optimal values ​​of the model parameters, which improved the recall rate of the prediction model by 17.4%, thereby improving the ability to predict serious accidents.

[0026] 2. By selecting intuitive information from the accident scene as input data for the model, the rescue center can quickly obtain relevant information after an accident occurs, predict the severity of the accident, and promptly activate the corresponding level of emergency measures, which has certain practical application value. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 A flowchart illustrating a method for predicting the severity of traffic accidents provided in this application embodiment;

[0029] Figure 2 A flowchart of the histogram optimization algorithm provided in the embodiments of this application;

[0030] Figure 3 Schematic diagram of layer-by-layer growth and leaf-by-leaf growth strategies provided in the embodiments of this application;

[0031] Figure 4 The diagram showing the relationship between the α factor and the γ factor and the loss function is provided for the embodiments of this application;

[0032] Figure 5 A schematic diagram of population and accident numbers in major regions from the experimental data provided in the embodiments of this application;

[0033] Figure 6 Traffic accident distribution map in the experimental data provided in the embodiments of this application;

[0034] Figure 7 A joint distribution diagram of iteration count and error index provided for embodiments of this application;

[0035] Figure 8 Comparison chart of results from multiple existing prediction models provided for embodiments of this application;

[0036] Figure 9 A comparison chart of the results of the prediction model of this application and other prediction models provided for embodiments of this application. Detailed Implementation

[0037] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0038] In existing technologies, models such as random forests, Bayesian algorithms, and artificial neural networks have been used to predict the severity of road traffic accidents. Yan et al. proposed a traffic accident severity prediction model based on random forests and Bayesian optimization, examining how various influencing factors affect the severity of traffic accidents through a partial dependency graph, providing a reference for targeted traffic accident prevention. Dadashova et al. predicted the severity of traffic accidents using random forests and analyzed the main influencing factors related to accident severity. Manzoor et al. used an RCNN model combining random forests and convolutional neural networks to predict the severity of 4.2 million traffic accident data points in the United States. Although the accuracy was significantly improved, the training time was not advantageous. Ke et al. proposed a lightweight gradient boosting machine model based on gradient boosting decision trees, which has fast training speed and good predictive ability on large-scale datasets. To address the problem of class imbalance, Zheng et al. adopted an improved Borderline-SMOTE2 algorithm based on resampling technology. This algorithm reduces the impact of positive and negative sample imbalance on the model at the data level, but it can easily lead to data redundancy and increase model complexity. Wang Qingbin et al. designed a new loss function with learning sensitivity, which added learning weights to minority class accidents and reduced the impact of positive and negative sample imbalance on the model at the algorithm level, but failed to solve the problem of sample difficulty imbalance.

[0039] To address the problems of existing technologies, this application proposes a traffic accident severity prediction method based on an improved lightweight gradient booster to solve the class imbalance problem in traffic accident data. This method employs out-of-bag estimation using random forests for feature data selection, eliminating redundant features and reducing the subjectivity of the feature selection process. It also introduces a focus loss function to improve the loss function and adjusts the model's classification threshold to reduce the impact of class imbalance on model accuracy. Finally, it uses a tree-structured parzen estimator as a Bayesian optimization algorithm for the probabilistic surrogate model to find the optimal focus loss function parameters and classification threshold, further optimizing the model structure and improving generalization ability.

[0040] Figure 1 This is a flowchart illustrating a method for predicting the severity of a traffic accident, as provided in an embodiment of this application. This application provides a method for predicting the severity of a traffic accident, including:

[0041] Step 1: Obtain training feature data.

[0042] For example, after acquiring the training feature data, the training feature data is also preprocessed. The preprocessing includes: deleting feature data from the training feature data or the feature data to be predicted where the missing proportion exceeds a set value, such as 60%; and completing the feature data that still has missing features in the retained feature data.

[0043] Step 2: Select training feature data using the random forest method.

[0044] For example, step 2 specifically includes: using a portion of the training feature data to build a decision tree using the random forest method; recording the initial error rate of the remaining data in the training feature data, denoted as the initial out-of-bag error; adding interference noise to a random column of feature data in the remaining data and calculating the interference out-of-bag error; determining the average precision reduction rate based on the initial out-of-bag error and the interference out-of-bag error, and selecting training feature data based on the average precision reduction rate.

[0045] Training features in a training feature dataset are typically categorized into relevant, irrelevant, and redundant features. Only relevant features are beneficial to the learning model, while irrelevant and redundant features increase the risk of overfitting, reduce model accuracy, and lead to the curse of dimensionality. Therefore, selecting relevant features from all training feature data is crucial for improving the efficiency of learning algorithms. This application employs the random forest method for feature selection.

[0046] Random forests are classifiers based on ensemble learning, using multiple decision trees to train and predict feature data. They are often used for feature selection. When constructing decision trees, random forests randomly select features with replacement from the dataset. Therefore, according to sampling probability, approximately 36.8% of the features will not participate in the decision tree construction. These features are called out-of-bag (OABS) data and can be used as a validation set to evaluate the importance of the features. First, the initial error rate obtained from the OABS validation is recorded as the initial OABS error. Then, random noise is added to a column of features in the OABS data, and the OABS error is calculated again to obtain the noise OABS error. The mean precision degradation (MDA) is used as an indicator to calculate the importance of the features.

[0047]

[0048] In the formula: n is the number of decision trees; errOOB t This represents the initial out-of-bag error; errOOB' t This is to address the out-of-bag error. A larger MDA indicates a greater impact of the inserted noise on the model results, suggesting higher importance. Based on this, the importance of the feature data is ranked, and the optimal feature data is selected.

[0049] Step 3: Establish a prediction network based on a lightweight gradient booster, using focus loss as the loss function.

[0050] For example, traffic accident severity prediction typically involves processing large-sample, high-dimensional data. Decision tree models are computationally fast, their results are easily interpretable, and they exhibit strong robustness, making them well-suited for building accident severity prediction models. Lightweight Gradient Boosting Machine (LightGBM) is a distributed gradient boosting framework based on the decision tree algorithm. Compared to other gradient boosting models, LightGBM improves upon these with histogram algorithms, depth-constrained leaf-by-leaf growth strategies, and multi-threaded optimization. The histogram algorithm and depth-constrained leaf-by-leaf growth strategy significantly reduce algorithm complexity and memory consumption. The most important reason for LightGBM's superior performance is its use of histogram optimization algorithms. The basic idea of ​​histogram optimization is to discretize each feature data into k intervals using a bucketing method, corresponding to the k buckets of a histogram. The height of the bucket corresponds to the data value within the interval. For example, by changing the values ​​in the range [0, 2.5) to 0 and the values ​​in the range [2.5, 5) to 1, and discretizing the floating-point number into k integers, a histogram of width k can be created. This histogram can then replace the original data, reducing memory consumption and computational cost during training. The algorithm is as follows: Figure 2 As shown.

[0051] Decision trees have a tree-like structure, containing root nodes, leaf nodes, and non-leaf nodes. Nodes with multiple feature attributes can continuously split downwards. Traditional decision tree algorithms use a layer-by-layer growth strategy for splitting. This strategy scans all data and splits each splittable node in the layer downwards. This strategy generates a symmetrical tree, and each leaf node in a layer will have child nodes, resulting in additional depth layers. The LightGBM model, on the other hand, uses a leaf-by-leaf growth strategy, selecting only the leaf node with the maximum splitting gain for splitting. With the same number of splits, it has better accuracy than the layer-by-layer growth strategy. For small datasets, the layer-by-layer growth strategy performs better, while the leaf-by-leaf growth strategy is prone to overfitting. On larger datasets, the leaf-by-leaf growth strategy performs better, with a much faster computation speed than the layer-by-layer growth strategy. Furthermore, LightGBM avoids overfitting by limiting the maximum depth. The dataset used in this application is large-scale. Considering accuracy and training time, the LightGBM model using the histogram algorithm and the leaf-by-leaf growth strategy perfectly meets the requirements of this application. Comparison of layer-by-layer growth and leaf-by-leaf growth: Figure 3 As shown.

[0052] A loss function is used to determine the error between the output and a given target value, i.e., the target result corresponding to the feature function. In simpler terms, the loss function expresses how much the model's calculated output deviates from the target value, and its metric is directly related to the quality of the model's training. In binary classification tasks in machine learning, the commonly used loss function is the cross-entropy function, as shown in the following equation:

[0053]

[0054] In the formula: y∈{0,1} represents the target value; y′∈{0,1} represents the probability value output by the model. Because there are often more "minor" accident samples than "serious" accident samples in traffic accident data, and the cumulative loss from "minor" accidents is greater than that from "serious" accidents, the model learns more thoroughly from "minor" accident samples but lacks learning from "serious" samples that urgently require rescue, resulting in a higher prediction cost.

[0055] This application addresses the aforementioned problems by employing a focus loss method that includes a weighting factor and an exponential factor, both of which are optimized using Bayesian optimization. This application also improves the cross-entropy loss function, as shown in the following equation. The weighting factor α adjusts the weighting of positive and negative samples in the algorithm, thereby balancing the distribution of the loss function and reducing the impact of sample imbalance on model accuracy. Figure 4 As shown in 'a'.

[0056]

[0057] While the weighting factor α can address the class imbalance problem, it doesn't solve the imbalance between easy and hard samples. Therefore, this application adds a positive-zero exponential factor γ to focus the loss function on training on hard samples. Taking positive samples as an example, for easy samples, a smaller (1-y′)γ results in a smaller loss, while for hard samples, a larger (1-y′)γ results in a larger loss. Thus, during learning, the focus is more on hard samples with smaller output values ​​that are actually 1. Figure 4 As can be seen from equation b, as γ gradually increases, the proportion of difficult samples in the algorithm's loss value also gradually increases. The same logic applies to negative samples. The entire focal loss function is shown in the following equation:

[0058]

[0059] Step 4: Input the selected training feature data into the prediction network to obtain the corresponding training prediction results.

[0060] For example, after obtaining the training prediction results, the training prediction results are further classified according to a set classification threshold. Furthermore, after predicting the severity of a traffic accident, the severity of the traffic accident is also classified using the classification threshold. Specifically, the classification threshold is optimized using a Bayesian optimization method.

[0061] When using a machine learning model for prediction, the predicted value directly output by the model is actually a real number within the interval [0,1]. For example, if the prediction network returns a value of 0.995, it proves that the accident is highly likely to be a serious accident; if the actual predicted value is 0.002, then the accident should be a minor accident. To map the predicted value to a binary category, the prediction result needs to be compared with a predefined classification threshold T. If it is greater than the threshold, it is 1; otherwise, it is 0. The threshold is usually set to 0.5 by default. Therefore, the training prediction result of the standard LightGBM model is:

[0062]

[0063] In the formula, y pred For the final prediction result, y out To predict the network's output value. However, setting the threshold to 0.5 is clearly unreasonable when the training feature data in the training feature dataset is imbalanced. Therefore, this application adopts a moving threshold method, using Bayesian optimization to find the optimal threshold, thereby improving the predictive ability for severe accidents.

[0064] Step 5: Use a loss function to determine the difference between the training prediction result and the target result.

[0065] Step 6: Use the Bayesian optimization method to optimize and adjust the parameters of the prediction network according to the differences to obtain the prediction model.

[0066] For example, Bayesian optimization is a highly effective global optimization algorithm. Based on Bayes' theorem, it uses a surrogate function to fit the relationship between hyperparameters and model evaluation, selects the next evaluation point based on previous sampling results, and finally obtains the best hyperparameter combination. Compared with random search and grid search, Bayesian optimization requires fewer iterations, is faster, and is less prone to getting trapped in local optima. This method can be expressed as:

[0067] θ * =argmin θòΘ L

[0068] In the formula: θ represents the hyperparameters, including the weighting factor α, the exponential factor γ, and the threshold T; Θ represents the hyperparameter search space; θ * is the optimal parameter combination; L is the model's loss function.

[0069] Step 7: Obtain the feature data to be predicted.

[0070] For example, after obtaining the feature data to be predicted, it is also necessary to preprocess the feature data to be predicted. The preprocessing method is the same as that for the training feature data.

[0071] Step 8: Input the feature data to be predicted into the prediction model to predict the severity of the traffic accident.

[0072] For example, a random forest method is used to select the feature data to be predicted before inputting it into the prediction model.

[0073] This application also provides a traffic accident severity prediction system, the system comprising:

[0074] The training data acquisition module is used to acquire training feature data;

[0075] The data selection module is used to select training feature data using the random forest method;

[0076] The network building module is used to build a prediction network based on a lightweight gradient booster, using focus loss as the loss function.

[0077] The network training module is used to input the selected training feature data into the prediction network to obtain the corresponding training prediction results.

[0078] The difference determination module is used to determine the difference between the training prediction results and the target results using a loss function.

[0079] The parameter adjustment module is used to optimize and adjust the parameters of the prediction network based on the differences using the Bayesian optimization method to obtain the prediction model;

[0080] The module for acquiring data to be predicted is used to acquire feature data to be predicted.

[0081] The accident prediction module is used to input the feature data to be predicted into the prediction model to predict the severity of the traffic accident.

[0082] This application also provides a computer storage medium storing a plurality of computer instructions for causing a computer to execute the above-described method.

[0083] Experimental instructions

[0084] 1. Data Description

[0085] This application uses publicly available traffic accident data from the French Ministry of Transport for the period 2005-2016. This dataset records 839,985 traffic accidents, resulting in 1,876,005 injuries and fatalities, involving 1,048,576 vehicles. The traffic accident data includes 38 local characteristics, such as the administrative region where the accident occurred, the time of the accident, vehicle type, driver gender, use of safety equipment, lighting conditions, weather conditions, road conditions, and other data features. This application conducts a simple descriptive statistical analysis of the entire dataset from four aspects: people, vehicles, roads, and the environment. In the accident data set, 74% of the accident victims were drivers, 17% were passengers, and the rest were pedestrians; 68% of the drivers were male, and the rest were female; the most common type of vehicle involved in accidents was a car, accounting for 68%, followed by bicycles, accounting for about 6%; the most common road type involved in accidents was ordinary roads, accounting for about 55%, followed by provincial highways, accounting for about 33%; 81% of accidents occurred on sunny days, and 10% occurred in light rain; as for the severity of the accidents, about 76% were minor accidents with minor injuries or no injuries, and 24% were serious accidents with serious injuries or deaths.

[0086] 2. Data Reliability Analysis

[0087] Since this dataset has never been used for predicting the severity of traffic accidents, a reliability analysis was conducted before processing the data. A reasonable data distribution is a crucial indicator of data reliability; this application examines data reliability from three dimensions: spatial distribution, date distribution, and time distribution.

[0088] In terms of spatial dimension, this application first extracts the number of traffic accidents in various regions of France in 2016 based on the accident location information in the original dataset, and compares it with the population of each region in France in 2016, such as... Figure 5 As shown, except for the popular tourist area of ​​Provence-Alpes-Ville, the accident number trends in each region recorded in the dataset are basically consistent with the population trends in each region. There is no biased data beyond the 13 regions, proving that the accident dataset is reliable in terms of spatial dimension.

[0089] The "date" and "time" dimensions are also important dimensions for analyzing the reliability of datasets. In the "date" dimension, traffic accidents are first distributed by month... Figure 6 It's easy to see from data a that the number of accidents drops significantly in February and August, which aligns with the French tradition of taking holidays in February and August. Further analysis of traffic accidents by 30 days per month... Figure 6 As shown in Figure b, the accidents are evenly distributed from day 1 to day 30, which perfectly matches the actual situation. For the "time" dimension, the accident data is distributed across 24 hours of a day according to the time of occurrence, as shown below. Figure 6As shown in Figure c, accidents mostly occur during morning and evening rush hours, which is completely consistent with the travel characteristics of people on weekdays. Therefore, based on the above three dimensions, it can be inferred that the data is reliable.

[0090] 3. Data preprocessing and feature selection

[0091] Traffic accidents occur under specific traffic conditions due to a mismatch between factors such as people, vehicles, roads, and the environment. Therefore, determining the relevant variables of traffic accidents requires addressing these four aspects: people, vehicles, roads, and the environment. People include pedestrians and drivers; vehicles include motor vehicles and non-motor vehicles on the road; roads refer to road conditions; and the environment refers to both the natural and social environment. The goal of this application is to establish a model that can predict the severity of traffic accidents based on on-site information, providing reference suggestions for accident rescue organizations. Therefore, considering the four factors of people, vehicles, roads, and the environment, 38 relevant data features were screened. Only intuitive information obtainable from the scene by the person reporting the accident was retained. Features with a missing proportion greater than 60% were deleted. For features with a missing proportion less than 60%, the mode was used to complete the data, resulting in 14 relevant variables, as shown in Table 1. Finally, the random forest algorithm was used to rank the features by importance, and the three least important variables were removed, yielding the final selection results.

[0092] Table 1 Model Features

[0093]

[0094] 4. Experimental Setup

[0095] This application randomly divides the processed 839,985 instances into training and test sets at a ratio of 4:1. The hardware environment consists of a computer with 16GB of RAM, an AMD Ryzen 55600U processor running at 2.30GHz, 512GB of hard drive space, and Windows 10. The programming language and platform version is Python 3.8.5, and the main machine learning libraries are Scikit-learn 1.0.1 and LightGBM 3.3.2. The Bayesian optimization framework is built using Hyperopt 0.2.7. This application uses an improved LightGBM algorithm to predict the severity of traffic accidents. The model uses focus loss as the loss function and adjusts the classification threshold T, where α, γ, and T are derived from the Bayesian optimization algorithm. The probabilistic proxy model of the Bayesian optimization algorithm uses tree-structured probability estimation. The acquisition function uses the EI (expected improvement) function from the boosting-based strategy, with 200 iterations. The final optimization results are α = 0.63, γ = 1.57, and T = 0.49. Bayesian optimization process as follows Figure 7 As shown.

[0096] 5. Evaluation Indicators

[0097] The performance evaluation metrics for the model in this application are defined using the confusion matrix in Table 2. In the confusion matrix: TP represents the number of samples where the actual severity is "severe" and the model predicts it as "severe"; FN represents the number of samples where the actual severity is "severe" and the model predicts it as "mild"; FP represents the number of samples where the actual severity is "mild" and the model predicts it as "severe"; TN represents the number of samples where the actual severity is "mild" and the model predicts it as "mild".

[0098] Table 2 Confusion Matrix

[0099]

[0100] Based on the confusion matrix, recall, accuracy, and F1 score—common metrics in prediction models—were selected as the performance evaluation criteria for the model in this application. The calculation formulas are as follows:

[0101]

[0102]

[0103]

[0104] In the formula: recall rate represents the proportion of all serious accidents that are correctly predicted, accuracy rate represents the proportion of data that the model correctly predicts out of the total data, and F1 score is a comprehensive indicator that measures the accuracy of the binary classification model.

[0105] Furthermore, the AUC value, as the area under the ROC curve, is insensitive to sample balance and serves as a comprehensive representation of detection accuracy. This application uses the above four metrics to evaluate the model's performance from multiple perspectives. Among them, the recall rate, representing the model's ability to identify serious accidents, is the metric of primary concern in this application.

[0106] 6. Experimental Results

[0107] To demonstrate the effectiveness of the proposed method, the processed dataset was first imported into the standard LightGBM model for experimentation, and compared with logistic regression, naive bayes, random forest, KNN nearest neighbor algorithm, decision tree, AdaBoost, and GBDT algorithms. The prediction results of each model are shown in Table 3 and... Figure 8 As shown.

[0108] Table 3 Prediction results of each model

[0109]

[0110] Analysis of the prediction results of various models shows that the LightGBM model significantly outperforms prediction algorithms such as Naive Bayes and other ensemble models like Random Forest in all metrics. However, due to the imbalanced sample problem, even the best-performing standard LightGBM model does not achieve a recall rate of 70%. This means that out of 100 "serious" samples, only about 60 samples can be correctly predicted. In practical applications, this would result in approximately 40% of serious accidents being misclassified as minor accidents, affecting rescue efficiency and making the prediction cost too high. To better address the imbalanced sample problem and improve recall, an improved LightGBM algorithm with Focal Loss as the loss function was used, and key parameters were optimized using a Bayesian optimization algorithm. The results of comparing the improved LightGBM with the standard model are shown in Table 4. Figure 9 As shown.

[0111] Table 4 Prediction results of each model

[0112]

[0113]

[0114] Analysis of the prediction results shows that the Bayesian optimization algorithm outperforms random search, grid search, and manual parameter tuning. Although the accuracy is slightly reduced after introducing the Focal Loss function into the model, the ability to identify serious accidents is greatly improved. Most importantly, the recall rate is increased by 17.4%, which more effectively meets the needs of accident rescue centers for predicting the severity of traffic accidents.

[0115] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0116] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for predicting the severity of traffic accidents, characterized in that, include: Obtain training feature data; The training feature data is selected using the random forest method; A prediction network based on a lightweight gradient booster is established, with focus loss as the loss function; The selected training feature data is input into the prediction network to obtain the corresponding training prediction results; The loss function is used to determine the difference between the training prediction result and the target result; The parameters of the prediction network are optimized and adjusted based on the differences using the Bayesian optimization method to obtain the prediction model; Obtain the feature data to be predicted; The feature data to be predicted is input into the prediction model to predict the corresponding severity of the traffic accident. After obtaining the training prediction results, the training prediction results are further classified according to a set classification threshold. Moreover, after predicting the severity of the traffic accident, the severity of the traffic accident is further classified using the classification threshold. The classification threshold is optimized using a Bayesian optimization method. The focus loss includes a weighting factor and an exponential factor, both of which are optimized using a Bayesian optimization method.

2. The method for predicting the severity of a traffic accident according to claim 1, characterized in that, The step of selecting the training feature data using the random forest method includes: using a portion of the training feature data to build a decision tree in the random forest method; Record the initial error rate of the remaining data in the training feature data, and denote it as the initial out-of-bag error; Add interference noise to a random column of feature data in the remaining data, and calculate the interference out-of-bag error; The average accuracy decline rate is determined based on the initial out-of-bag error and the interference out-of-bag error, and the training feature data is selected based on the average accuracy decline rate.

3. The method for predicting the severity of traffic accidents according to claim 1, characterized in that, After acquiring the training feature data, the training feature data is preprocessed; after acquiring the feature data to be predicted, the feature data to be predicted is also preprocessed.

4. The method for predicting the severity of a traffic accident according to claim 3, characterized in that, The preprocessing of the training feature data or the feature data to be predicted includes: deleting feature data in the training feature data or the feature data to be predicted whose missing proportion exceeds a set value; Complete the missing feature data in the retained feature data.

5. The method for predicting the severity of a traffic accident according to claim 1, characterized in that, Before inputting the feature data to be predicted into the prediction model, a random forest method is used to select the feature data to be predicted.

6. A traffic accident severity prediction system, characterized in that, The system is used to perform the method according to any one of claims 1-5, the system comprising: a training data acquisition module, used to acquire training feature data; The data selection module is used to select the training feature data using the random forest method; The network building module is used to build a prediction network based on a lightweight gradient booster, using focus loss as the loss function. The network training module is used to input the selected training feature data into the prediction network to obtain the corresponding training prediction results; A difference determination module is used to determine the difference between the training prediction result and the target result using the loss function; The parameter adjustment module is used to optimize and adjust the parameters of the prediction network according to the differences using a Bayesian optimization method to obtain a prediction model; The module for acquiring data to be predicted is used to acquire feature data to be predicted. The accident prediction module is used to input the feature data to be predicted into the prediction model to predict the severity of the corresponding traffic accident.

7. A computer storage medium, characterized in that, The computer storage medium stores a plurality of computer instructions, which are used to cause the computer to perform the method described in any one of claims 1-5.