Traffic accident severity prediction method and system based on multi-stage fusion

Through a multi-stage fusion method, including the combination of data preprocessing, logistic regression and AdaBoost model, the problems of data imbalance and multi-source data integration in traffic accident severity prediction are solved, high-precision traffic accident severity prediction is achieved, and the scientific nature of traffic safety management and driver safety warnings is improved.

CN120296560BActive Publication Date: 2025-10-03CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510417958.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-10-03
Estimated Expiration
2045-04-03

AI Technical Summary

Technical Problem

Existing traffic accident severity prediction methods are difficult to effectively integrate multi-source heterogeneous data, suffer from data imbalance problems, and have imbalanced model complexity and generalization capabilities, resulting in insufficient prediction accuracy.

Method used

A multi-stage fusion method was adopted, including data collection and preprocessing, preliminary prediction and feature fusion of logistic regression model, secondary prediction of AdaBoost model, balancing data distribution through undersampling and oversampling, encoding conversion of categorical variables and standardization of numerical features, and feature selection combined with Pearson correlation coefficient analysis. Finally, the model performance was evaluated by ROC and PR curves.

Benefits of technology

It improves the accuracy and stability of traffic accident severity prediction, can better identify and learn the characteristic patterns of various types of accidents, reduces the impact of noise, and improves the generalization ability and prediction accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120296560B_ABST
    Figure CN120296560B_ABST
Patent Text Reader

Abstract

The present invention provides a traffic accident severity prediction method and system based on multi-stage fusion, which relates to the fields of traffic accident analysis and intelligent transportation. It includes: collecting multi-source data related to traffic accidents, converting the encoding of categorical variables and standardizing numerical features after cleaning and processing data imbalance; constructing a logistic regression model to make preliminary predictions and output the probability of the corresponding category, while using historical data to perform correlation analysis on the severity of the accident, selecting features with higher correlation and performing polynomial transformation, and fusing the transformed features and the probability of the preliminary prediction results into new features; using the AdaBoost model again to train the fused features, and then predicting the test set features to obtain the final fused prediction results; and finally evaluating and optimizing the entire model. The present invention integrates various data resources through a multi-stage fusion method. The fused model can integrate the advantages of a single model and has higher prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of traffic accident analysis and intelligent transportation technology, and in particular to a traffic accident severity prediction method and system based on multi-stage fusion. Background Art

[0002] The occurrence and severity of traffic accidents are influenced by a combination of complex factors. Geographically, traffic conditions vary significantly across terrains and regions, such as urban, rural, and mountainous roads, leading to varying accident probabilities and severity. Road conditions include road smoothness, width, curve curvature, and the availability of traffic signs. Environmental factors include severe weather conditions such as heavy rain, snow, fog, and strong winds, which can significantly reduce visibility and increase the difficulty of maneuvering. Vehicle driving conditions, including speed, acceleration, and steering, as well as driver behavior, such as fatigue, illegal driving, and distraction, are also important factors contributing to accidents and their severity. Furthermore, the volume and patterns of traffic flow also indirectly influence the frequency and severity of accidents.

[0003] Accurately predicting accident severity is a critical task in traffic accident research. Traditional prediction methods rely primarily on simple statistical analysis or single model architectures. However, the mechanisms of traffic accidents are extremely complex, influenced by the interplay of multiple factors. Faced with this complex interplay of factors, traditional methods struggle to fully capture the underlying patterns and characteristics within the data, resulting in predictions that fall short of meeting practical needs.

[0004] The rapid development of information technology and the advent of the big data era have brought new opportunities for traffic accident prediction. Machine learning technology, with its powerful data analysis and pattern recognition capabilities, has achieved remarkable results in multiple fields and provided new insights into traffic accident severity prediction. However, existing machine learning models still face numerous challenges when applied to traffic accident prediction.

[0005] First, traffic accident data is highly complex and diverse, encompassing a wide range of information, including accident time, location, vehicle model, speed, driving trajectory, weather conditions, and road conditions. This data varies significantly in format, scale, and nature, resulting in multi-source heterogeneous data. Existing models struggle to effectively integrate and mine the inherent connections between these different types of data, resulting in the waste of valuable information and severely impacting prediction accuracy.

[0006] Secondly, data imbalance is a significant factor limiting the performance of existing models. In real-world traffic accident datasets, the distribution of accident severity is often extremely uneven. Minor accident samples often account for a high proportion, while moderate and severe accident samples are relatively rare. This severe data imbalance causes the model to over-focus on majority class samples during training, while lacking the ability to learn and identify minority class samples. When the model is applied to actual predictions, the prediction effect on minority class samples is poor, and it is unable to accurately identify and judge high-severity accidents, significantly reducing the model's reliability and effectiveness in predicting overall accident severity.

[0007] Furthermore, striking a balance between model complexity and generalization is a pressing challenge. Some models, in pursuit of higher fitting accuracy, employ overly complex structures. While these models perform well on training data, they are prone to overfitting when presented with new data, leading to a sharp decline in performance on test sets or in real-world applications. Conversely, some simple models, while capable of good generalization, have limited data learning and representation capabilities, failing to fully capture the complex characteristics and patterns in traffic accident data, resulting in prediction accuracy that fails to meet actual requirements.

[0008] Chinese patent document CN108710967A describes a method for predicting the severity of highway traffic accidents based on data fusion and support vector machines. Specifically, the method involves collecting multiple data types, then performing dimensionality reduction and normalization on the variable factors of the data samples. A traffic accident severity prediction model is then constructed using a support vector machine algorithm. The reduced dimensionality vectors containing the predicted accident variables are then incorporated into the prediction model for prediction. This method, based on data fusion and using support vector machines, predicts traffic accident severity. Accident severity often suffers from significant data imbalance and a wide range of influencing factors. However, this method does not address data imbalance or perform feature selection, and only performs a single prediction, making it susceptible to noise and a certain degree of overfitting.

[0009] In summary, given the high incidence of traffic accidents and the limitations of existing prediction methods, there is an urgent need for an innovative and efficient traffic accident severity prediction method. Summary of the Invention

[0010] The technical problem to be solved by the present invention is to provide a traffic accident severity prediction method and system based on multi-stage fusion in response to the shortcomings of the existing technology, which can achieve high-precision prediction of traffic accident severity.

[0011] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0012] In a first aspect, the present invention provides a traffic accident severity prediction method based on multi-stage fusion, comprising the following steps:

[0013] S1. Data collection and preprocessing: Collect multi-source data related to traffic accidents, clean it to remove duplicate and invalid data, balance the distribution of accident severity data using undersampling and oversampling, convert the encoding of categorical variables, and standardize numerical features to ensure that the data meets the model input requirements;

[0014] S2. Preliminary prediction and feature fusion: A logistic regression model is constructed to make preliminary predictions and output probability results. Historical data is used to perform correlation analysis on accident severity. Features with high correlation are selected for polynomial transformation, and the transformed features and the preliminary predicted probability results are fused into new features.

[0015] S3, Second prediction: Use the AdaBoost model to train the fused features again, and then predict the test set to obtain the final fusion prediction results;

[0016] S4. Result evaluation and model optimization: Use the accuracy, recall rate, and F1 value indicators to draw ROC and PR curves for the fused model to evaluate the prediction results.

[0017] Furthermore, the multi-source data related to traffic accidents include accident record data, weather condition data, and road monitoring data.

[0018] Furthermore, the accident record data includes the precise time of the accident, the precise location of the latitude and longitude coordinates, the exact model and license plate number of the vehicle involved, the specific circumstances of casualties, etc. Detailed accident records are generally obtained through cooperation with traffic management departments.

[0019] Furthermore, the weather condition data includes data such as temperature, humidity, wind speed, precipitation, visibility, etc. at the time of the accident, which are generally obtained through a professional data interface with the meteorological department.

[0020] Furthermore, the road monitoring data includes data such as the road surface condition and traffic flow of the road where the accident occurred, and is generally collected using monitoring equipment along the road.

[0021] Furthermore, balancing the distribution of accident severity data by undersampling and oversampling in step S1 specifically involves performing a comprehensive statistical analysis on the cleaned multi-source data related to traffic accidents, visually presenting the distribution of the number of samples in different severity categories through a bar chart or pie chart; if a serious imbalance in the data is found, performing the following processing:

[0022] For most categories of minor accident samples, undersampling is used to effectively reduce their absolute number in the dataset and reduce their dominant influence on model training;

[0023] For the severe accident samples in the minority category, an oversampling algorithm is used to generate new synthetic samples in the feature space of the minority category samples to increase the number of samples.

[0024] This processing can achieve a relatively balanced distribution of samples of different severity in the dataset, ensuring that the model can fully learn the characteristic patterns of various types of accidents during training, and avoiding the model's insufficient recognition and prediction capabilities for minority samples due to data imbalance.

[0025] Furthermore, the categorical variable encoding conversion in step S1 refers to converting the categorical variable into a continuous integer encoding starting from 0. For example, "sunny" is encoded as 0, "rainy" is encoded as 1, "snowy" is encoded as 2, and so on. In this way, the model can correctly identify and utilize this categorical information when processing data, avoiding the impact of improper representation of categorical variables on prediction results.

[0026] Furthermore, the standardization process in step S1 is performed by calculating the mean and standard deviation of each numerical feature and converting them into the following formula:

[0027]

[0028] Where: X new is the standardized eigenvalue, x is the original eigenvalue, μ is the mean of the feature, and σ is the standard deviation.

[0029] After normalization, all numerical features will be converted to a standard normal distribution with a mean of 0 and a standard deviation of 1, making different features comparable in numerical scale. This avoids excessive attention or neglect of certain features during training due to large differences in feature dimensions, improves the efficiency and stability of model training, and helps the model converge to the optimal solution faster.

[0030] Furthermore, the logistic regression model in step S2 outputs the predicted probability using the One vs Rest strategy, creating K binary classification models, where K represents the number of accident severity categories, typically set to mild, moderate, and severe. Each model uses one category as the positive class and the remaining categories as the negative class, using a sigmoid function to represent them, i.e.:

[0031]

[0032] Where: σ(z) represents the sigmiod function, the output range is between 0 and 1, indicating the probability that the sample belongs to the positive class, and z is a linear combination, that is:

[0033] z=θ0+θ1x1+θ2x2+……+θ n x n =θ T x

[0034] θ is the parameter vector of the model, T represents the transpose, and n represents the number of features x.

[0035] Furthermore, the training goal of the logistic regression model in step S2 is to find the optimal parameter θ so that the likelihood function is maximized. The log-likelihood function is used in the solution of the present invention and is solved by an optimization algorithm such as gradient descent. The formula of the log-likelihood function L(θ) is:

[0036]

[0037] Where m is the number of samples, y (i) is the true label of the i-th sample, x (i) is the eigenvector of the i-th sample, σ(θ T x (i) ) is the probability that the i-th sample belongs to the positive class after being calculated by the sigmoid function.

[0038] Furthermore, in step S2, the absolute value of the Pearson correlation coefficient between each feature and the target variable "accident severity" is calculated through correlation analysis to screen out features with high correlation. The formula of the Pearson correlation coefficient (r) is:

[0039]

[0040] Among them, x i and y i are the i-th sample values ​​of feature x and target variable y, respectively. and are the means of feature x and target variable y respectively; n represents the number of features x and target variable y.

[0041] Then, the variables with higher correlation are transformed by quadratic polynomials to generate multiple new features, and the predicted probability output by the logistic regression model is incorporated as a new feature.

[0042] Furthermore, in step S3, AdaBoost iteratively trains multiple weak classifiers and combines them into a strong classifier. In each round of iteration, AdaBoost adjusts the weight of the sample according to the error rate of the classifier in the previous round. i The weight α of (x) t The calculation formula is:

[0043]

[0044] Among them, ∈ t is the error rate of the weak classifier in the tth iteration, and the sample weight update formula is:

[0045] ;

[0046] in, Represents x i The weight of the tth iteration, Represents x i The weight after the tth round of iteration update; h t (x i ) represents the prediction result of the weak learner; exp represents the exponential function, Z t Represents the normalization factor, which is used to ensure that the sum of all sample weights is 1.

[0047] Furthermore, the final model strong classifier H(x) in step S3 is:

[0048]

[0049] Where N is the number of weak classifiers, that is, the total number of iterations of the AdaBoost algorithm, and sign is the sign function, which outputs 1 when the input value is greater than 0 and -1 when it is less than 0.

[0050] In a second aspect, the present invention further provides a traffic accident severity prediction system based on multi-stage fusion, comprising a processor and a memory, wherein the memory stores computer program code instructions;

[0051] When the computer program code instructions are called by the processor, the processor is caused to execute the traffic accident severity prediction method based on multi-stage fusion as described above.

[0052] Beneficial effects of the present invention:

[0053] The traffic accident severity prediction method provided by the present invention first removes duplicate and invalid data from the collected multi-source data related to traffic accidents through cleaning; balances the distribution of accident severity data by undersampling and oversampling; and converts the encoding of categorical variables and standardizes numerical features so that the data meets the model input requirements. The processing of data imbalance can ensure that the model can fully learn the characteristic patterns of various types of accidents during the training process, avoiding the model's insufficient recognition and prediction capabilities for minority class samples due to data imbalance, thereby ensuring the accuracy of model predictions; the encoding conversion of categorical variables enables the model to correctly identify and utilize these classification information when processing data, avoiding the impact of improper representation of categorical variables on prediction results; and the standardization of numerical features makes different features comparable in numerical scale, avoiding excessive attention or neglect of certain features during the training process due to large differences in feature dimensions, improving the efficiency and stability of model training, and helping the model converge to the optimal solution more quickly. A logistic regression model is then constructed to perform preliminary predictions and output the corresponding category probabilities. Historical data is also used to perform a correlation analysis on accident severity. Features with high correlations are selected and polynomial transformations are performed. The transformed features and the preliminary predicted probabilities are then fused into new features. The fused features are then trained using the AdaBoost model. Predictions are then made on the test set features to obtain the final fused prediction results. Finally, the entire model is evaluated and optimized.

[0054] In the prediction of the severity of traffic accidents, due to the large number of data types and the large amount of data, if data imbalance processing, feature selection and other operations are not performed, a single model prediction is directly performed, which is prone to overfitting of a single severity. At the same time, a single prediction model is greatly affected by noise data and is difficult to identify the correlation between multiple features. Therefore, a single logistic regression model is easily affected by noise data. The solution of the present invention first performs data imbalance and data cleaning on the collected multi-source data related to traffic accidents, and then constructs a logistic regression model for preliminary prediction. At the same time, the features with higher correlation are selected and polynomial transformation is performed. The features obtained and the probability of the preliminary prediction results are fused into new features and input into a secondary prediction model. The secondary prediction model uses the AdaBoost model to train the fused features, and then predicts the test set features to obtain the final fused prediction results. The secondary iteration of AdaBoost can further reduce the noise impact of the single logistic regression model prediction due to the large number of data types and large data volume. The present invention effectively integrates various data resources through a multi-stage fusion method. The fused model effectively integrates the advantages of a single model, which improves the accuracy of the prediction compared to a single model.

[0055] The present invention can overcome the shortcomings of existing technologies and achieve high-precision prediction of the severity of traffic accidents, providing strong technical support for traffic management departments to formulate scientific and reasonable traffic policies, optimize traffic resource allocation, and provide drivers with timely and accurate safety warnings, thereby improving the overall traffic safety level and reducing the losses caused by traffic accidents. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0057] Figure 1 A schematic diagram of the basic flow of the traffic accident severity prediction method based on multi-stage fusion provided in Example 1 of the present invention.

[0058] Figure 2 Schematic diagram of the structure of the logistic regression model of an embodiment of the present invention.

[0059] Figure 3 Schematic diagram of the structure of the AdaBoost model in an embodiment of the present invention.

[0060] Figure 4 The figure is an ROC curve diagram for evaluating the prediction results of the embodiment of the present invention.

[0061] Figure 5 PR curve diagram for evaluating the prediction results of the embodiment of the present invention. DETAILED DESCRIPTION

[0062] The invention will be further described below with reference to the embodiments and drawings, but they are not intended to limit the scope of the invention.

[0063] Example 1

[0064] like Figure 1 As shown, this embodiment provides a traffic accident severity prediction method based on multi-stage fusion, including the following steps:

[0065] S1. Data collection and preprocessing: Collect multi-source data related to traffic accidents, clean it to remove duplicate and invalid data, balance the distribution of accident severity data using undersampling and oversampling, convert the encoding of categorical variables, and standardize numerical features to ensure that the data meets the model input requirements. The details are as follows:

[0066] By cooperating with the traffic management department, we obtain detailed accident records, which include the precise time of the accident, the precise location of the longitude and latitude coordinates, the exact models and license plate numbers of the vehicles involved, the specific circumstances of casualties, etc.; with the help of professional data interfaces with the meteorological department, we obtain weather conditions such as temperature, humidity, wind speed, precipitation, visibility, etc. at the time of the accident; and use monitoring equipment beside the road to collect information such as road surface conditions and traffic flow.

[0067] Table 1 Data collection and classification

[0068]

[0069] Because the data collection process is susceptible to interference from various factors, some data may be missing, erroneous, or invalid. For example, vehicle sensors may transmit erroneous data or interrupt data transmission due to severe weather, electromagnetic interference, or equipment failure, resulting in the loss of certain key data points. Manual records kept by traffic management departments may contain typos or incomplete information entry. Data formats and standards may also differ from data source to data source. For example, vehicle sensor data may use a specific binary encoding format, while meteorological department data may be a text-based report. All of these require unified processing. Therefore, in some embodiments of the present invention, a comprehensive data cleansing operation is first performed on the collected data. The data is strictly screened based on its inherent logical relationships and reasonable range. For duplicate data records, deduplication can be performed based on the data's unique identifier, such as a combination of the accident number, vehicle chassis number, and timestamp.

[0070] After completing the data cleaning, the data imbalance problem needs to be further addressed. First, a comprehensive statistical analysis of the accident severity data is performed, and a bar chart or pie chart is drawn to intuitively present the distribution of the number of samples of different severity categories. If it is found that the data is seriously imbalanced, for example, in one embodiment of the present invention, the proportion of minor accident samples is too high, such as more than 90% in some embodiments, while the proportion of severe accident samples is relatively rare, such as less than 5% in some embodiments, then corresponding measures need to be taken. For minor accident samples of most categories, an undersampling method can be used to effectively reduce their absolute number in the data set and reduce their dominant influence on model training; for severe accident samples of a minority category, an oversampling algorithm can be used to generate new synthetic samples in the feature space of minority class samples, increase their sample number, and make samples of different severity achieve a relatively balanced distribution in the data set, ensuring that the model can fully learn the characteristic patterns of various types of accidents during the training process, and avoid the model's insufficient recognition and prediction capabilities for minority class samples due to data imbalance.

[0071] Then, we perform encoding conversion on categorical variables. For example, road type (freeways, urban main roads, rural roads, etc.) and weather conditions (sunny, rainy, snowy, foggy, etc.) are converted to continuous integer codes starting at 0. For example, "sunny" is coded as 0, "rainy" as 1, "snowy" as 2, and so on. This allows the model to correctly identify and utilize this categorical information when processing the data, preventing predictions from being affected by improper representation of categorical variables.

[0072] Finally, the numerical features are standardized. For example, the distance information of the latitude and longitude coordinates of the accident site, the vehicle speed, acceleration value, the temperature and humidity value at the time of the accident, etc. By calculating the mean and standard deviation of each numerical feature, the conversion formula is:

[0073]

[0074] where X new is the normalized eigenvalue, x is the original eigenvalue, μ is the mean of the feature, and σ is the standard deviation. After normalization, all numerical features are converted to a standard normal distribution with a mean of 0 and a standard deviation of 1. This makes different features comparable in numerical scale, avoiding excessive focus or neglect of certain features during training due to large differences in feature dimensions. This improves the efficiency and stability of model training and helps the model converge to the optimal solution more quickly.

[0075] S2. Preliminary prediction and feature fusion: A logistic regression model is constructed to make preliminary predictions and output probability results. At the same time, historical data is used to perform correlation analysis on accident severity. Features with high correlation are selected for polynomial transformation. The transformed features and the probability of the preliminary prediction results are fused into new features. The details are as follows:

[0076] S201. Model construction

[0077] In this stage, the logistic regression model is used for preliminary prediction. Logistic regression is a commonly used linear classification model. When dealing with multi-classification problems, the One-vs-Rest (OvR) strategy is used here. The model structure is as follows: Figure 2 As shown in the figure, for the traffic accident severity prediction problem, assuming that there are K categories of accident severity, K binary classification models will be constructed. Each binary classification model takes one category as the positive class and the remaining K-1 categories as the negative class, and uses the sigmoid function to represent it, that is:

[0078]

[0079] Where: σ(z) represents the sigmiod function, the output range is between 0 and 1, indicating the probability that the sample belongs to the positive class, and z is a linear combination, that is:

[0080] z=θ0+θ1x1+θ2x2+……+θ n x n =θ T x

[0081] θ is the parameter vector of the model, T represents the transpose, and n represents the number of features x.

[0082] S202. Data preparation and input

[0083] Input the preprocessed data (including cleaned, balanced, encoded, and standardized traffic accident data) into the logistic regression model. The feature dimensions and format of the preprocessed data must match the input requirements of the logistic regression model. For example, if the data has n features after processing, the input vector dimension of each sample when inputting into the logistic regression model is n.

[0084] S203, Model Training

[0085] The logistic regression model is trained using the training dataset. The training goal of the logistic regression model is to find the optimal parameter θ so that the likelihood function is maximized. The log-likelihood function is usually used and solved by optimization algorithms such as gradient descent. The formula for the log-likelihood function L(θ) is:

[0086]

[0087] Where m is the number of samples, y (i) is the true label of the i-th sample, x (i) is the eigenvector of the i-th sample, σ(θ T x (i) ) is the probability that the i-th sample belongs to the positive class after being calculated by the sigmoid function.

[0088] S204. Correlation analysis and feature fusion

[0089] A logistic regression model is used to make preliminary predictions and output probability results. At the same time, historical data is used to perform correlation analysis on accident severity. The Pearson correlation coefficient is used to select features with high correlation and perform polynomial transformation. The formula for the Pearson correlation coefficient r is:

[0090]

[0091] Among them, x i and y i are the i-th sample values ​​of feature x and target variable y, respectively. and are the means of feature x and target variable y respectively; n represents the number of features x and target variable y;

[0092] Then, the variables with higher correlation are transformed by quadratic polynomials to generate multiple new features, and the predicted probability output by the logistic regression model is incorporated as a new feature.

[0093] S3. Select the AdaBoost model for secondary prediction: Use the AdaBoost model again to train the fused features, and then predict the test set to obtain the final fusion prediction results, as follows:

[0094] S301. Model selection and construction

[0095] The AdaBoost model is selected as the secondary prediction model. AdaBoost iteratively trains multiple weak classifiers and combines them into a strong classifier. The model structure is as follows Figure 3 In each iteration, AdaBoost adjusts the weight of the sample according to the error rate of the previous round of classifiers. The weak classifier h of the tth iteration i The weight α of (x) t The calculation formula is:

[0096]

[0097] Among them, ∈ t is the error rate of the weak classifier in the tth iteration, and the sample weight update formula is:

[0098] ;

[0099] in, Represents x i The weight of the tth iteration, Represents x i The weight after the tth round of iteration update; h t (x i ) represents the prediction result of the weak learner; exp represents the exponential function, Z t Represents the normalization factor, which is used to ensure that the sum of all sample weights is 1.

[0100] S302. Data preparation and input

[0101] The dataset, with the newly added features after the initial prediction, is fed into the AdaBoost model as input. This data now includes variables highly correlated with accident severity after polynomial transformation and the probability of the results predicted by the logistic regression model. The data has richer dimensions and feature information, helping the AdaBoost model learn more complex patterns and relationships.

[0102] S303, Model Training

[0103] The fused features are used to train the AdaBoost model. During the training process, AdaBoost iteratively trains multiple weak classifiers and combines them into a strong classifier. The final model strong classifier H(x) is:

[0104]

[0105] Where N is the number of weak classifiers, that is, the total number of iterations of the AdaBoost algorithm, and sign is the sign function, which outputs 1 when the input value is greater than 0 and -1 when it is less than 0.

[0106] S4. Result evaluation and model optimization: Compare the accuracy, recall, F1 value index, ROC, and PR curves of the independent logistic regression model, AdaBoost model, and the fusion model to evaluate the prediction results, as follows:

[0107] Comprehensively evaluate the prediction results and use indicators such as accuracy, recall, and F1 value to measure model performance. The accuracy calculation formula is:

[0108]

[0109] The calculation formula for recall rate (for a certain category) is:

[0110]

[0111] The formula for calculating the F1 value is:

[0112]

[0113] Where TP represents a true positive, TN represents a true negative, FP represents a false positive, and FN represents a false negative. Precision represents accuracy. By plotting the ROC curve, with the false positive rate as the horizontal axis and the true positive rate as the vertical axis, we can visually demonstrate the classification performance of the model at different thresholds. By plotting the PR curve, with the recall rate as the horizontal axis and the precision as the vertical axis, we can evaluate the accuracy of the model at different recall levels. By selecting key features of the combined model and adding a certain multiple (0.8-1.2 times) of noise points to these features, we can visually observe the fluctuations in the model's accuracy and evaluate the model's stability.

[0114] Example 2

[0115] Based on the same inventive concept, this embodiment is a system embodiment corresponding to the above-mentioned method embodiment 1, and can be implemented in conjunction with the above-mentioned embodiment 1.

[0116] This embodiment provides a traffic accident severity prediction system based on multi-stage fusion, including a processor and a memory, wherein the memory stores computer program code instructions; when the computer program code instructions are called by the processor, the processor executes the steps of the traffic accident severity prediction method based on multi-stage fusion as described in Example 1 above.

[0117] The relevant technical details mentioned in the above embodiment 1 are still valid in this embodiment, and the repeated parts are not repeated here.

[0118] In order to verify the feasibility and effect of the solution of the present invention, the following application examples are given to further illustrate it.

[0119] Example 3: Application Example

[0120] First, relevant data on road traffic accidents in the United States from January 15, 2016 to January 1, 2022 are collected, including multiple factors such as the location of the accident, driving time, vehicles involved in the accident, temperature, wind chill index, humidity, air pressure, visibility, wind direction, wind speed, precipitation, etc. The collected data are pre-processed by encoding, normalization, undersampling, oversampling, etc. according to the method of the above embodiment 1. The original data is first preliminarily predicted by the logistic regression model for the severity of the accident. The absolute value of the Pearson correlation coefficient between each feature and the target variable "accident severity" is calculated based on historical data. The features with higher correlation are selected, and the preliminary predicted results are fused as the fused features. Finally, the AdaBoost model is used for secondary prediction. The fused model is evaluated according to the method of the above embodiment 1, and the results of the fused model are compared with those of the individual models (logistic regression, AdaBoost, KNN, SVM, and naive Bayes). The results are as follows: Figure 2 shown.

[0121] Table 2 Model effect comparison table

[0122]

[0123] From the data in Table 2 above, it can be seen that the accuracy, recall, F1 value and overall accuracy of the fused model of the present invention are improved compared with the individual models. The ROC curve and PR curve of the fused model are as follows: Figure 4 and Figure 5 As shown, Figure 4 The AUC (Area Under Curve) in the ROC curve refers to the area under the ROC curve and the coordinate axis. The closer the AUC is to 1.0, the higher the authenticity of the method. Figure 5In the PR curve, AP refers to the area under the PR curve and the coordinate axis. Generally, the higher the AP value, the better. The results show that the performance of the fused model of the present invention is significantly improved compared with the performance of the individual models.

[0124] Obviously, the above embodiments are merely preferred examples of the present invention and are not intended to limit the implementation methods. Those skilled in the art will readily appreciate that other variations or modifications based on the above descriptions are possible. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.

Claims

1. A traffic accident severity prediction method based on multi-stage fusion, characterized in that: The steps include: S1. Data collection and preprocessing: Collect multi-source data related to traffic accidents, clean it to remove duplicate and invalid data, balance the distribution of accident severity data using undersampling and oversampling, convert the encoding of categorical variables, and standardize numerical features to ensure that the data meets the model input requirements; S2. Preliminary prediction and feature fusion: A logistic regression model is constructed to make preliminary predictions and output probability results. Historical data is used to perform correlation analysis on accident severity. Features with high correlation are selected for polynomial transformation, and the transformed features and the preliminary predicted probability results are fused into new features. The logistic regression model outputs the predicted probability using the One vs Rest strategy, which creates K binary classification models, where K represents the number of accident severity categories. Each model uses one category as the positive class and the remaining categories as the negative class, represented by the sigmoid function, that is: ; in: Represents the sigmiod function, the output range is between 0 and 1, indicating the probability that the sample belongs to the positive class, is a linear combination, namely: ; is the parameter vector of the model, represents transpose, Representative characteristics the number of S3, Second prediction: Use the AdaBoost model to train the fused features again, and then predict the test set to obtain the final fusion prediction results; AdaBoost trains multiple weak classifiers iteratively and combines them into a strong classifier. In each round of iteration, AdaBoost adjusts the weight of the sample according to the error rate of the previous round of classifiers. Iterative weak classifier Weight The calculation formula is: ; in, It is The error rate of the weak classifier after round iteration, the sample weight update formula is: ; ; in, represent No. The weight of the round iteration, represent No. The weight after round iterative update; and Characteristics and the target variable No. Sample values; Represents the prediction result of the weak learner; represents the exponential function, Represents the normalization factor, which is used to ensure that the sum of all sample weights is 1; S4. Result evaluation and model optimization: Use the accuracy, recall rate, and F1 value indicators to draw ROC and PR curves for the fused model to evaluate the prediction results.

2. The traffic accident severity prediction method based on multi-stage fusion according to claim 1 is characterized in that: The multi-source data related to traffic accidents include accident record data, weather condition data, and road monitoring data; The accident record data includes the precise time of the accident, the precise location of the latitude and longitude coordinates, the exact model and license plate number of the vehicle involved, and the specific circumstances of the casualties; The weather condition data includes the temperature, humidity, wind speed, precipitation, and visibility at the time of the accident; The road monitoring data includes the road surface condition and traffic flow of the road where the accident occurred.

3. The traffic accident severity prediction method based on multi-stage fusion according to claim 1 is characterized in that: Balancing the distribution of accident severity data using undersampling and oversampling in step S1 specifically involves performing a comprehensive statistical analysis on the cleaned multi-source data related to traffic accidents, visually presenting the distribution of the number of samples in different severity categories through bar charts or pie charts; if a serious imbalance in the data is found, the following processing is performed: For most categories of minor accident samples, undersampling is used to effectively reduce their absolute number in the dataset and reduce their dominant influence on model training; For the severe accident samples in the minority category, an oversampling algorithm is used to generate new synthetic samples in the feature space of the minority category samples to increase the number of samples; The categorical variable encoding conversion in step S1 refers to converting the categorical variable into a continuous integer encoding starting from 0.

4. The traffic accident severity prediction method based on multi-stage fusion according to claim 1 is characterized in that: The standardization process in step S1 is performed by calculating the mean and standard deviation of each numerical feature and converting them into the following formula: ; in: is the normalized eigenvalue, is the original eigenvalue, is the mean of the feature, is the standard deviation.

5. The traffic accident severity prediction method based on multi-stage fusion according to claim 1 is characterized in that: The training goal of the logistic regression model in step S2 is to find the optimal parameters , so that the log-likelihood function is maximized and solved by the gradient descent optimization algorithm; the log-likelihood function The formula is: ; in, is the sample size, It is The true labels of samples, It is The feature vector of the sample, It is The probability that a sample belongs to the positive class after being calculated by the sigmoid function.

6. The traffic accident severity prediction method based on multi-stage fusion according to claim 1 is characterized in that: In step S2, the absolute value of the Pearson correlation coefficient between each feature and the target variable "accident severity" is calculated through correlation analysis to screen out features with high correlation; the Pearson correlation coefficient The formula is: ; in, and Characteristics and the target variable No. Sample values, and Characteristics and the target variable The mean of Representative characteristics and the target variable the number of Then, the variables with higher correlation are transformed by quadratic polynomials to generate multiple new features, and the predicted probability output by the logistic regression model is incorporated as a new feature.

7. The traffic accident severity prediction method based on multi-stage fusion according to claim 1 is characterized in that: Step S3 final model strong classifier for: ; in, is the number of weak classifiers, that is, the total number of iterations of the AdaBoost algorithm. sign is the sign function, which outputs 1 when the input value is greater than 0 and -1 when it is less than 0.

8. A traffic accident severity prediction system based on multi-stage fusion, characterized in that: comprising a processor and a memory, wherein the memory has computer program code instructions stored thereon; When the computer program code instructions are called by the processor, the processor is caused to execute the traffic accident severity prediction method based on multi-stage fusion as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data fusion and support vector machine-based highway traffic accident severity prediction method

    CN108710967A

  • Traffic accident severity prediction method and system and computer storage medium

    CN116128108A

  • Marine traffic accident severity prediction method based on feature engineering

    CN119250257A