Traffic accident severity prediction method and related device
By acquiring a road traffic accident dataset, identifying influencing factors, and optimizing hyperparameters using a combination of association rule mining algorithms and neural network models, the problem of inaccurate prediction of traffic accident severity was solved, achieving more accurate predictions.
Patent Information
- Application Number
- CN202511866434.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-03-17
AI Technical Summary
Existing technologies are not comprehensive enough in analyzing the causes of traffic accident severity, and the application of machine learning methods is not effective enough, resulting in inaccurate predictions.
By acquiring a road traffic accident dataset, influencing factors are identified, association rule mining algorithms are used to determine association rules, and a combined model of multilayer perceptron neural network and random forest neural network is constructed to optimize hyperparameters and improve prediction accuracy.
It enables a more comprehensive analysis and more accurate prediction of the severity of traffic accidents, improving the accuracy of the prediction model.
Smart Images

Figure CN121682609A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic safety technology, and in particular to a method and related device for predicting the severity of traffic accidents. Background Technology
[0002] Since the beginning of the 21st century, the transportation industry has gradually become an important engine for social and economic development. However, with the popularization of transportation tools and the acceleration of urbanization, the incidence of traffic accidents has been rising year by year, bringing huge economic burdens and psychological pressure to society.
[0003] In the current technology, the analysis of the causes of accident severity only focuses on some aspects of people, vehicles, roads, and environment. There is little research on comprehensive statistical analysis of these four aspects, and most of it only stays at the level of simple statistical analysis. There is little in-depth analysis of the relationship between various aspects and traffic accidents. In terms of accident severity prediction, although many studies have adopted machine learning methods, there is little research on how to effectively combine traditional machine learning models and neural network models to give full play to their respective advantages, resulting in insufficient accuracy in predicting the severity of traffic accidents.
[0004] This shows that existing technologies are not comprehensive enough in analyzing the causes of traffic accident severity, and the application of machine learning methods is not effective enough, resulting in inaccurate predictions of traffic accident severity. Summary of the Invention
[0005] In view of this, it is necessary to provide a method and related device for predicting the severity of traffic accidents, so as to solve the problem that the existing technology does not provide a comprehensive analysis of the causes of traffic accident severity and the application of machine learning methods is not effective enough, resulting in inaccurate prediction of the severity of traffic accidents.
[0006] To address the aforementioned problems, in a first aspect, the present invention provides a method for predicting the severity of traffic accidents, comprising: Obtain a road traffic accident dataset and determine the factors influencing the severity of traffic accidents based on the dataset. Association rule mining algorithms were used to determine the association rules between each influencing factor and the severity of the accident; The hyperparameters of the preset traffic accident severity prediction model are optimized using a preset optimization algorithm, and the optimized traffic accident severity prediction model is combined with association rules to predict the severity of road traffic accidents.
[0007] In one possible implementation, a road traffic accident dataset is acquired, and factors influencing the severity of traffic accidents are determined based on the road traffic accident dataset, including: Obtain a road traffic accident dataset, preprocess the data in the road traffic accident dataset, remove abnormal data and convert the format to obtain a standard road traffic accident dataset. Spatiotemporal feature analysis was performed on a standard traffic accident dataset to determine the spatiotemporal influencing factors of traffic accident severity. Non-spatiotemporal feature analysis was performed on standard traffic accident datasets to determine the non-spatiotemporal influencing factors of traffic accident severity.
[0008] In one possible implementation, an association rule mining algorithm is used to determine the association rules between each influencing factor and the severity of the accident, including: The support, confidence, and lift of each influencing factor were determined using an association rule mining algorithm. Support represents the probability of an influencing factor occurring in a road traffic accident. Confidence represents the probability of a second influencing factor occurring given that the first influencing factor occurs in a road traffic accident. Lift represents the ratio of the probability of both the first and second influencing factors occurring in a road traffic accident to the probability of only the second influencing factor occurring. Association rules between each influencing factor and the severity of the accident are determined based on support, confidence, and lift.
[0009] In one possible implementation, a preset optimization algorithm is used to optimize the hyperparameters of a preset traffic accident severity prediction model, including: Constructing multilayer perceptron neural networks and random forest neural networks; The hyperparameters of the multilayer perceptron neural network and the random forest neural network are optimized using a preset optimization algorithm, and the combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on the error rates of the multilayer perceptron neural network and the random forest neural network. A traffic accident severity prediction model is obtained by combining multilayer perceptron neural networks and random forest neural networks based on combined weights.
[0010] In one possible implementation, a preset optimization algorithm is used to optimize the hyperparameters of the multilayer perceptron neural network and the random forest neural network, including: Chaotic mapping is used to generate the initial population of hyperparameters for multilayer perceptron neural networks and random forest neural networks; When the random number of the population update is less than the preset threshold, a Gaussian random walk is used to update the initial population.
[0011] In one possible implementation, the combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on the error rates of the multilayer perceptron neural network and the random forest neural network, including: Determine the first prediction error of the multilayer perceptron neural network for the severity of traffic accidents and the second prediction error of the random forest neural network for the severity of traffic accidents; The combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on the ratio of the relative difference between the first prediction error and the second prediction error.
[0012] In one possible implementation, the combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on the ratio of the relative difference between the first prediction error and the second prediction error, including: When the ratio of the relative difference between the first prediction error and the second prediction error is greater than the preset difference ratio threshold, the combined weight of the neural network model corresponding to the larger of the first prediction error and the second prediction error is 0, and the combined weight of the neural network model corresponding to the smaller of the first prediction error and the second prediction error is 1. When the relative difference ratio between the first prediction error and the second prediction error is less than or equal to a preset difference ratio threshold, the combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on the ratio of the first prediction error and the second prediction error to the sum of the first prediction error and the second prediction error.
[0013] Secondly, the present invention also provides a traffic accident severity prediction device, comprising: The influencing factor determination module is used to acquire road traffic accident datasets and determine the influencing factors of the severity of traffic accidents based on the road traffic accident datasets. The association rule determination module is used to determine the association rules between each influencing factor and the severity of the accident using association rule mining algorithms; The model prediction module is used to optimize the hyperparameters of the preset traffic accident severity prediction model using a preset optimization algorithm, and then use the optimized traffic accident severity prediction model in combination with association rules to predict the severity of road traffic accidents.
[0014] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein, Memory, used to store programs; The processor, coupled to the memory, is used to execute a program stored in the memory to implement the steps in the traffic accident severity prediction method of any of the above embodiments.
[0015] Fourthly, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instructions, which, when executed by a processor, can implement the steps in the traffic accident severity prediction method of any of the above embodiments.
[0016] The beneficial effects of this invention are as follows: The traffic accident severity prediction method provided by this invention acquires a road traffic accident dataset, determines the influencing factors of traffic accident severity based on the dataset, and uses an association rule mining algorithm to determine the association rules between each influencing factor and the severity of the accident. By extracting the influencing factors that affect the severity of road traffic accidents from the road traffic accident dataset and using an association rule mining algorithm to determine the association rules between each influencing factor and the severity of the accident, different influencing factors can be analyzed in combination, resulting in a more comprehensive analysis of the influencing factors. Furthermore, a preset optimization algorithm is used to optimize the hyperparameters of the preset traffic accident severity prediction model, and the optimized traffic accident severity prediction model is used in conjunction with association rules to predict the severity of road traffic accidents. This parameter optimization further improves the prediction accuracy of the traffic accident severity prediction model. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating a method for predicting the severity of traffic accidents provided in an embodiment of the present invention; Figure 2 A flowchart illustrating a method for determining influencing factors provided in an embodiment of the present invention; Figure 3 A flowchart illustrating an association rule determination method provided in an embodiment of the present invention; Figure 4 A flowchart illustrating a model optimization method provided in an embodiment of the present invention; Figure 5 This is a flowchart illustrating a hyperparameter optimization method provided in an embodiment of the present invention. Figure 6 A flowchart illustrating a method for determining combined weights provided in an embodiment of the present invention; Figure 7 A flowchart illustrating a model combination method provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the structure of a traffic accident severity prediction device provided in an embodiment of the present invention; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0019] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0020] In the description of the embodiments of the present invention, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0021] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.
[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0023] A specific embodiment of the present invention, such as Figure 1 As shown, a method for predicting the severity of traffic accidents is disclosed, including: S101, Obtain the road traffic accident dataset, and determine the influencing factors of the severity of traffic accidents based on the road traffic accident dataset.
[0024] In this embodiment of the invention, the road traffic accident dataset can be found through a professional database. To ensure the accuracy of the dataset, road traffic accident datasets from the same region in recent years can be searched and analyzed to determine the influencing factors that affect the severity of traffic accidents. Optionally, the influencing factors are designed to include four aspects: people, vehicles, roads, and the environment. Therefore, the collected traffic accident dataset should include the accident location, time, vehicle information, and information on the persons involved.
[0025] S102, use association rule mining algorithm to determine the association rules between each influencing factor and the severity of the accident.
[0026] In this embodiment of the invention, because there are multiple factors influencing the severity of traffic accidents, it is necessary to determine the association rules between each influencing factor and the severity of the accident in order to understand the complex relationship between these factors and the severity of the accident. Specifically, this can be achieved by statistically analyzing the frequency of occurrence of different influencing factors in each traffic accident, and then determining the association rules between each influencing factor and the severity of the accident based on the relationship between the frequency of occurrence of each influencing factor in different road traffic accidents and the relationship between the occurrence of each influencing factor and the severity of the accident. The specific method for determining the association rules will be described in detail later in this invention.
[0027] S103, the hyperparameters of the preset traffic accident severity prediction model are optimized using a preset optimization algorithm, and the optimized traffic accident severity prediction model is combined with association rules to predict the severity of road traffic accidents.
[0028] In this embodiment of the invention, when predicting the severity of road traffic accidents, a traffic accident severity prediction model can be used. Specifically, after constructing the traffic accident severity prediction model, a preset optimization algorithm can be used to optimize the hyperparameters of the model, and the severity of the traffic accident can be predicted using the optimized model. The specific construction and optimization methods of the traffic accident severity prediction model will be described in detail later in this invention.
[0029] This invention provides a method for predicting the severity of traffic accidents. It acquires a road traffic accident dataset, identifies influencing factors on the severity of accidents based on this dataset, and uses an association rule mining algorithm to determine the association rules between each influencing factor and the severity of the accident. By extracting influencing factors from the road traffic accident dataset that affect the severity of road traffic accidents and using an association rule mining algorithm to determine the association rules between each influencing factor and the severity of the accident, it is possible to combine and analyze different influencing factors, resulting in a more comprehensive analysis. Furthermore, a preset optimization algorithm is used to optimize the hyperparameters of a preset traffic accident severity prediction model. The optimized traffic accident severity prediction model, combined with association rules, is then used to predict the severity of road traffic accidents, further improving the prediction accuracy of the traffic accident severity prediction model.
[0030] In some possible embodiments of the present invention, such as Figure 2 As shown, a road traffic accident dataset is obtained, and based on this dataset, the influencing factors of traffic accident severity are determined, including: S201, Obtain the road traffic accident dataset, preprocess the data in the road traffic accident dataset, remove abnormal data and convert the format to obtain the standard road traffic accident dataset. S202, perform spatiotemporal feature analysis on standard traffic accident datasets to determine the spatiotemporal influencing factors of traffic accident severity; S203 performs non-spatiotemporal feature analysis on standard traffic accident datasets to determine the non-spatiotemporal influencing factors of traffic accident severity.
[0031] In this embodiment of the invention, after obtaining the road traffic accident dataset, it is necessary to preprocess the dataset. Data preprocessing refers to filtering and purifying noisy, incomplete, and inconsistent "dirty data." Specifically, the accident information, vehicle information, and casualty information files can be integrated to obtain an integrated file, which facilitates subsequent analysis. The generated file is then filtered, and attribute columns that may contain duplicate information are deleted. During data collection, issues such as data duplication, missing data, and anomalies may occur. Therefore, cleaning this "dirty data" is necessary. Removing duplicate data can significantly improve the accuracy and efficiency of data mining. During accident collection, there may be instances where accident codes differ but attributes are the same. Therefore, by comparing each accident data entry with the remaining data one by one, duplicate records representing the same accident are identified and eliminated to ensure the uniqueness of the accident dataset, thereby optimizing the analysis results. Data loss not only causes the system to lose a large amount of valuable information but may also disrupt the data mining process, thus reducing the reliability of the results. Therefore, missing data must be processed, and corresponding processing methods are adopted according to different missing rates. For data with a missing rate of over 30%, the column data is usually directly deleted. For data with a missing value rate below 1%, rows containing missing values are directly deleted. For data with a missing value rate in the middle range, methods such as mode imputation, mean imputation, and K-nearest neighbor imputation are selected based on the specific situation. Data anomalies are points in the sample that are significantly far away from other samples, also known as outliers. Since this traffic accident dataset is a large-scale, multidimensional dataset, the Z-score detection method has good flexibility and adaptability compared to other detection methods, and can detect outliers more quickly and effectively. Furthermore, to facilitate subsequent analysis of influencing factors and severity prediction, continuous attributes need to be discretized. Data discretization is mainly divided into two categories: one is to divide some continuous data evenly into several intervals according to the data range, with each interval having the same width; the other is to use clustering methods to group data points into discrete categories.
[0032] In this embodiment of the invention, after preprocessing the traffic accident dataset, it is necessary to extract influencing factors. Factors affecting traffic safety are complex, diverse, and wide-ranging. The spatiotemporal distribution characteristics of road traffic accidents are one of the important factors, and the analysis of temporal distribution characteristics is of significant research importance in road traffic accident analysis. Statistical analysis of the distribution of road traffic accidents in different months, weeks, and hours can reveal peak and trough periods of accident occurrence, providing a strong basis for accident prevention and management. Since the number of accidents varies depending on their severity, and this section focuses on analyzing the temporal characteristics of accidents, the frequency of accidents of different severity levels here refers to the number of accidents of a certain severity level divided by the total number of accidents of that severity level within that time period. Furthermore, because the traffic accident dataset is too large, directly plotting all accident data on the same scatter plot may result in an overly dense image, making it difficult to distinguish the severity of different accidents. Therefore, accident data of different severity levels can be displayed separately to more intuitively analyze and understand the geographical distribution of different types of accidents. In addition, influencing factors also include non-temporal and spatial factors. Specifically, traffic safety is mainly affected by four aspects: people, vehicles, roads, and the environment. Among these, human factors have the highest impact on accidents. Although accidents caused by roads and vehicles themselves are relatively few, their overall impact on accidents is still significant. Based on accident statistics, due to technological limitations, it is difficult to obtain data on the physiological and psychological changes of drivers at the moment before an accident; questionnaire surveys and statistical data are subject to the influence of the respondents' subjective will. Therefore, the analysis focuses on three aspects: age, gender, and vehicle behavior. Regarding vehicle factors, as a tool for carrying and protecting occupants, the type, driving status, technical performance, and maintenance condition of vehicles are all closely related to the severity of accidents. Vehicle condition attributes mainly include vehicle type and vehicle driving status. Road surface conditions and infrastructure are objective factors affecting the formation of traffic accidents. Factors related to roads are extracted from the collected accident dataset for analysis, including speed limits, intersections, intersection control, vehicle positions at intersections, pedestrian crossing physical settings, and road surface conditions. Environmental factors are a significant contributor to traffic accidents, including weather conditions and terrain. Analyzing these environmental factors allows for the implementation of measures to reduce the occurrence and severity of accidents, including those related to lighting and weather conditions.
[0033] This invention analyzes a road traffic accident dataset to extract factors that significantly influence the severity of road traffic accidents, facilitating subsequent analysis.
[0034] In some possible embodiments of the present invention, such as Figure 3As shown, association rule mining algorithms are used to determine the association rules between each influencing factor and the severity of the accident, including: S301, The association rule mining algorithm is used to determine the support, confidence and lift of each influencing factor. The support represents the probability of the influencing factor occurring in a road traffic accident. The confidence represents the probability of the second influencing factor occurring given that the first influencing factor occurs in a road traffic accident. The lift represents the ratio of the probability of the first influencing factor and the second influencing factor occurring simultaneously to the probability of the second influencing factor occurring alone in a road traffic accident. S302, determine the association rules between each influencing factor and the severity of the accident based on support, confidence and lift.
[0035] In this embodiment of the invention, the association rule mining algorithm used is an improved version of the Apriori algorithm. Association rule mining is a data mining method that extracts potential correlations between different attributes in a dataset. Its main function is to mine frequent itemsets and generate association rules. It can quickly and deeply mine hidden connections between data samples and can be used to study the correlations between various influencing factors of road traffic accidents.
[0036] In an embodiment of the present invention, it is set that For traffic accident datasets, Let m be a specific accident in dataset D, and m be the total number of accidents in the traffic accident dataset. , Assuming A and B are two traffic accidents in a dataset D, and their intersection is empty, the association rule is defined as follows: A represents the preceding item of the rule, and B represents the following item of the rule. After finding the frequent itemsets, rule metrics are needed for filtering and ranking, so the rule metrics used are very important.
[0037] (1) Support, which indicates the probability that the severity of an accident affects the occurrence of a set of indicator items in all transactions of the accident database.
[0038]
[0039] in, This indicates the level of support for A. This indicates the frequency with which the severity of the accident affects the index item set A. This represents the total number of transactions in the incident data transaction set.
[0040]
[0041] in, This indicates the level of support for A and B in the same incident. The support indicates the number of times that the influencing indicator itemsets A and B appear in the same itemset. The higher the support, the more frequently the rule appears. Itemets with support greater than the support threshold are called frequent itemsets.
[0042] (2) Confidence level, which indicates the probability that if the severity of the accident affects the occurrence of indicator item A, then the severity of the accident also affects the occurrence of indicator item B.
[0043]
[0044] Among them, the confidence level reveals the causal relationship between influencing factors and severity. The higher the confidence level, the greater the likelihood that the antecedent will trigger the consequent.
[0045] (3) Lifting degree, the increase in the probability of the occurrence of the indicator item A due to the severity of the accident on the probability of the occurrence of the indicator item B, that is, the ratio of the probability that the accident data transaction set contains both itemsets A and B to the probability that it contains only itemset B.
[0046]
[0047] Lift reflects the correlation between the preceding and following terms of an association rule. A lift greater than 1 indicates a higher positive correlation, while a lower lift indicates a higher negative correlation. A lift of 1 indicates no correlation.
[0048] Traditional Apriori algorithms are only suitable for unidimensional data models and struggle to handle traffic accident data containing multidimensional attributes such as people, vehicles, roads, and the environment. When applying Apriori to mine association rules related to the severity of traffic accidents, all attributes need to be normalized to the same dimension. However, this normalization may reduce the efficiency of frequent itemset searches and lead to meaningless output. To make Apriori algorithms more applicable to such multidimensional traffic accident data models, this application proposes targeted constraint improvements, mainly in the following two aspects: Constraint 1: When searching for the most frequent itemset, if an itemset does not contain an incident severity attribute, then that itemset is deleted.
[0049] Constraint 2: In the generated association rules, the right side must be the accident level attribute, and the left side must be other factors that affect the severity of the accident. This ensures the interpretability of the association rules.
[0050] Furthermore, in real-world accident datasets, the sample size varies significantly depending on the severity of the accident. Directly applying a uniform minimum support threshold and a preset minimum confidence threshold may lead to the neglect of some rare but crucial association rules. Therefore, this paper sets different minimum support thresholds and preset minimum confidence thresholds for different accident severity attributes. This avoids ignoring some key association rules, improves the algorithm's efficiency, and makes the analysis results more comprehensive and accurate.
[0051] The embodiments of the present invention use an improved association rule mining algorithm to mine the association rules between various influencing factors, thus providing a more comprehensive consideration of the influencing factors.
[0052] In some possible embodiments of the present invention, such as Figure 4 As shown, a preset optimization algorithm is used to optimize the hyperparameters of a preset traffic accident severity prediction model, including: S401, construct a multilayer perceptron neural network and a random forest neural network; S402, the hyperparameters of the multilayer perceptron neural network and the random forest neural network are optimized using a preset optimization algorithm, and the combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on the error rates of the multilayer perceptron neural network and the random forest neural network. S403, based on the combination of multilayer perceptron neural network and random forest neural network with combined weights, obtains a traffic accident severity prediction model.
[0053] In some possible embodiments of this invention, a random forest is used as the base model. To further enhance prediction performance, a multilayer perceptron (MLP) neural network is introduced, constructing an MLP-RF combined model. Since traffic accident severity prediction involves numerous influencing factors, combining MLP and RF fully leverages the advantages of MLP in handling nonlinear relationships and the advantages of RF in high-dimensional classification tasks. To further optimize model performance, an improved HOA heuristic algorithm (GHOA) is employed to optimize the hyperparameters of MLP and RF, constructing a GHOA-MLP-RF model. This improves the ability to predict accident severity, aids in optimizing decision-making and resource allocation, and ultimately enhances road traffic safety.
[0054] In this embodiment of the invention, in the Multilayer Perceptron (MLP), information propagates from the input layer through the hidden layers to the output layer; this information flow is called forward propagation. During forward propagation, neurons receive weighted inputs from neurons in the previous layer. The output of each layer depends on the output of the previous layer and is transformed by weights and activation functions. The training process of the MLP model adjusts the weights by calculating the error between the predicted output and the true label. The performance of the MLP largely depends on the model's hyperparameter settings. Therefore, correctly selecting and optimizing these hyperparameters is crucial for obtaining excellent model performance. Thus, a preset optimization algorithm is used to optimize the hyperparameters of the MLP and the Random Forest neural network, and the combined weights of the MLP and the Random Forest neural network are determined based on their error rates. Based on these combined weights, the MLP and the Random Forest neural network are combined to obtain a traffic accident severity prediction model.
[0055] Furthermore, such as Figure 5 As shown, the hyperparameters of the multilayer perceptron neural network and the random forest neural network are optimized using a preset optimization algorithm, including: S501 uses chaotic mapping to generate the initial population of hyperparameters for multilayer perceptron neural networks and random forest neural networks. S502, when the random number of the population update is less than the preset threshold, a Gaussian random walk is used to update the initial population.
[0056] In some possible embodiments of this invention, assuming the learning rate and number of hidden layer neurons in the MLP, and the number of trees and maximum depth in the RF need to be optimized, then each individual in the population is a combination of hyperparameters. A chaotic mapping is introduced to generate a more representative initial population. This allows for better coverage of the search space. Here, the Chebyshev mapping, a nonlinear chaotic mapping, is used, with the following formula:
[0057]
[0058] in, The first in the initial population i The individual in the first j The solution of dimension, and The upper and lower bounds of the solution, This is the current state. This is the previous state.
[0059] Furthermore, a Gaussian walk improvement is added to the mapping. During each population update, if the random number is less than 0.3, a Gaussian random walk is performed; otherwise, the original update strategy is followed. Gaussian walks help the population escape local optima and increase its global search capability. The formula for updating the population using a Gaussian random walk is typically expressed as:
[0060] in, This represents the updated value of the i-th individual in the j-th dimension. This represents the current value of the i-th individual in the j-th dimension. It is the step size factor, which controls the step size of the Gaussian random walk. This represents a standard normally distributed random variable with a mean of 0 and a variance of 1.
[0061] The embodiments of the present invention optimize the hyperparameters of multilayer perceptron neural networks and random forest neural networks using the above-described optimization algorithm, thereby improving the accuracy of the models.
[0062] In some possible embodiments of the present invention, such as Figure 6 As shown, the combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on their error rates, including: S601, determine the first prediction error of the multilayer perceptron neural network for the severity of a traffic accident and the second prediction error of the random forest neural network for the severity of a traffic accident; S602, determine the combined weights of the multilayer perceptron neural network and the random forest neural network based on the relative difference ratio between the first prediction error and the second prediction error.
[0063] In this embodiment of the invention, the traffic accident severity prediction model is a combination of a multilayer perceptron neural network (MLPF) and a random forest neural network (RFR). To improve the accuracy of this combination model in predicting the severity of traffic accidents, it is necessary to determine the combined weights of the MPF and RFR. Specifically, the combined weights can be determined by the first prediction error of the MPF and the second prediction error of the RFR.
[0064] Furthermore, such as Figure 7 As shown, the combined weights of the multilayer perceptron neural network and the random forest neural network are determined based on the ratio of the relative difference between the first prediction error and the second prediction error, including: S701, when the relative difference ratio between the first prediction error and the second prediction error is greater than the preset difference ratio threshold, the combined weight of the neural network model corresponding to the larger of the first prediction error and the second prediction error is 0, and the combined weight of the neural network model corresponding to the smaller of the first prediction error and the second prediction error is 1. S702, when the relative difference ratio between the first prediction error and the second prediction error is less than or equal to a preset difference ratio threshold, the combined weights of the multilayer perceptron neural network and the random forest neural network are determined according to the ratio of the first prediction error and the second prediction error to the sum of the first prediction error and the second prediction error.
[0065] In this embodiment of the invention, a pre-defined traffic accident dataset is predicted using a multilayer perceptron neural network with hyperparameter optimization and a random forest neural network. The prediction error of each model is calculated, and the features of the validation set are set as follows. The actual value is After validation, the model predictions can be obtained as follows: as well as The errors between them can be obtained as follows: and Then there is
[0066]
[0067] The weights for combining can be determined by the error in the validation set.
[0068]
[0069] If the two algorithms differ significantly on the validation set, the combined effect should be somewhere in between. In this case, the algorithm with the best performance can be chosen as the final model. Therefore, a threshold can be defined. If the following condition is met, i.e., the ratio of the relative differences between the two algorithms is greater than a threshold, then they will not be combined:
[0070] if Then there is , ; if Then there is , ; After processing the test set, the predicted values on the test set are as follows: as well as The prediction result obtained after model integration is: :
[0071] Based on the above combined weights, a multilayer perceptron neural network and a random forest neural network are combined to obtain a traffic accident severity prediction model. This model can be used to predict the severity of traffic accidents.
[0072] This invention combines MLP and RF for prediction and introduces the GHOA improved hiking optimization algorithm to optimize the hyperparameters of the two models, MLP and RF respectively. The algorithm simulates the process of a hiker exploring the terrain and finally determines the optimal combination of hyperparameters to improve the model prediction accuracy.
[0073] To better implement the traffic accident severity prediction method in this embodiment of the invention, based on the traffic accident severity prediction method, correspondingly, as follows: Figure 8 As shown, this embodiment of the invention also provides a traffic accident severity prediction device, the traffic accident severity prediction device 800 comprising: The influencing factor determination module 801 is used to acquire a road traffic accident dataset and determine the influencing factors of the severity of traffic accidents based on the road traffic accident dataset. The association rule determination module 802 is used to determine the association rules between each influencing factor and the severity of the accident using an association rule mining algorithm; The model prediction module 803 is used to optimize the hyperparameters of the preset traffic accident severity prediction model using a preset optimization algorithm, and to predict the severity of road traffic accidents by combining the optimized traffic accident severity prediction model with association rules.
[0074] The traffic accident severity prediction device 800 provided in the above embodiments can realize the technical solutions described in the above traffic accident severity prediction method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above traffic accident severity prediction method embodiments, and will not be repeated here.
[0075] like Figure 9 As shown, the present invention also provides an electronic device 900. The electronic device 900 includes a processor 901, a memory 902, and a display 903. Figure 9 Only some components of the electronic device 900 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0076] In some embodiments, processor 901 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in memory 902 or process data, such as the traffic accident severity prediction method of the present invention.
[0077] In some embodiments, processor 901 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 901 may be local or remote. In some embodiments, processor 901 may be implemented on a cloud platform. In some embodiments, the cloud platform may include private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, internal cloud, multi-cloud, etc., or any combination thereof.
[0078] In some embodiments, memory 902 may be an internal storage unit of electronic device 900, such as a hard disk or memory of electronic device 900. In other embodiments, memory 902 may also be an external storage device of electronic device 900, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 900.
[0079] Furthermore, the memory 902 may include both internal storage units of the electronic device 900 and external storage devices. The memory 902 is used to store application software and various types of data installed on the electronic device 900.
[0080] In some embodiments, display 903 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 903 is used to display information from electronic device 900 and to display a visual user interface. Components 901-903 of electronic device 900 communicate with each other via a system bus.
[0081] In some embodiments, when processor 901 executes a traffic accident severity prediction program in memory 902, the following steps may be implemented: Obtain a road traffic accident dataset and determine the factors influencing the severity of traffic accidents based on the dataset. Association rule mining algorithms were used to determine the association rules between each influencing factor and the severity of the accident; The hyperparameters of the preset traffic accident severity prediction model are optimized using a preset optimization algorithm, and the optimized traffic accident severity prediction model is combined with association rules to predict the severity of road traffic accidents.
[0082] It should be understood that when the processor 901 executes the traffic accident severity prediction program in the memory 902, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.
[0083] Furthermore, this embodiment of the invention does not specifically limit the type of electronic device 900 mentioned. Electronic device 900 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the invention, electronic device 900 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0084] Accordingly, this application also provides a computer-readable storage medium for storing computer-readable programs or instructions. When the programs or instructions are executed by a processor, they can implement the steps or functions of the traffic accident severity prediction methods provided in the above-described method embodiments.
[0085] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0086] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method of predicting the severity of a traffic accident, characterized in that, The method comprises the following steps: obtaining a road traffic accident dataset, determining the influence factors of traffic accident severity based on the road traffic accident dataset; determining the association rules between each influence factor and accident severity by using an association rule mining algorithm; optimizing the hyperparameters of a preset traffic accident severity prediction model by using a preset optimization algorithm, and predicting the severity of road traffic accidents by using the optimized traffic accident severity prediction model combined with the association rules.
2. The traffic accident severity prediction method according to claim 1, characterized in that, The method comprises the following steps: obtaining a road traffic accident dataset, and preprocessing the data in the road traffic accident dataset to eliminate abnormal data and convert the format, thereby obtaining a standard road traffic accident dataset; performing spatiotemporal feature analysis on the standard traffic accident dataset to determine the spatiotemporal influence factors of traffic accident severity; performing non-spatiotemporal feature analysis on the standard traffic accident dataset to determine the non-spatiotemporal influence factors of traffic accident severity.
3. The traffic accident severity prediction method according to claim 2, characterized in that, The method comprises the following steps: determining the support, confidence and lift of each influence factor by using an association rule mining algorithm, wherein the support represents the probability of the influence factor appearing in a road traffic accident, the confidence represents the probability of a second influence factor appearing in a road traffic accident under the premise that a first influence factor appears in the road traffic accident, and the lift represents the ratio of the probability of a first influence factor and a second influence factor appearing in a road traffic accident to the probability of only the second influence factor appearing in the road traffic accident; determining the association rules between each influence factor and accident severity based on the support, confidence and lift.
4. The traffic accident severity prediction method according to claim 3, characterized in that, The method comprises the following steps: constructing a multilayer perceptron neural network and a random forest neural network; optimizing the hyperparameters of the multilayer perceptron neural network and the random forest neural network by using a preset optimization algorithm, and determining the combination weight of the multilayer perceptron neural network and the random forest neural network based on the error rate of the multilayer perceptron neural network and the random forest neural network; combining the multilayer perceptron neural network and the random forest neural network based on the combination weight to obtain a traffic accident severity prediction model.
5. The traffic accident severity prediction method according to claim 4, characterized in that, The method comprises the following steps: generating an initial population of hyperparameters of the multilayer perceptron neural network and the random forest neural network by using a chaotic mapping; updating the initial population by using a Gaussian random walk when the random number of population update is less than a preset threshold.
6. The traffic accident severity prediction method according to claim 4, characterized in that, The method comprises the following steps: determining a first prediction error of the traffic accident severity by the multilayer perceptron neural network and a second prediction error of the traffic accident severity by the random forest neural network; determining a combination weight of the multilayer perceptron neural network and the random forest neural network based on a relative difference ratio of the first prediction error and the second prediction error.
7. The traffic accident severity prediction method according to claim 6, characterized in that, The determining of the combination weight of the multilayer perceptron neural network and the random forest neural network based on the relative difference ratio of the first prediction error and the second prediction error comprises: when the relative difference ratio of the first prediction error and the second prediction error is greater than a preset difference ratio threshold, the combination weight of the neural network model corresponding to the greater one of the first prediction error and the second prediction error is 0, and the combination weight of the neural network model corresponding to the smaller one of the first prediction error and the second prediction error is 1; when the relative difference ratio of the first prediction error and the second prediction error is less than or equal to the preset difference ratio threshold, the combination weight of the multilayer perceptron neural network and the random forest neural network is determined according to a ratio of the first prediction error and the second prediction error to a sum of the first prediction error and the second prediction error.
8. A traffic accident severity prediction device characterized by comprising: comprise: an influence factor determination module configured to obtain a road traffic accident data set and determine influence factors of traffic accident severity based on the road traffic accident data set; an association rule determination module configured to determine association rules between each of the influence factors and the accident severity by using an association rule mining algorithm; a model prediction module configured to optimize hyperparameters of a preset traffic accident severity prediction model by using a preset optimization algorithm, and predict the road traffic accident severity by using the optimized traffic accident severity prediction model in combination with the association rules.
9. An electronic device, comprising: comprise a memory and a processor, wherein the memory is configured to store a program; the processor, coupled with the memory, is configured to execute the program stored in the memory to implement the steps in the traffic accident severity prediction method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, a computer readable program or instruction for storing, which can implement the steps in the traffic accident severity prediction method of any one of claims 1 to 7 when executed by a processor.