A Method for Analyzing Influencing Factors of Traffic Accident Duration Based on the RSF Model
Through the data processing and analysis method based on the RSF model, the data requirements and low accuracy of rail traffic accident duration prediction are solved, and high-precision influencing factors identification and emergency response support are achieved.
Patent Information
- Application Number
- CN202111651228.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-12-30
AI Technical Summary
The prior art has high data requirements and low prediction accuracy in predicting rail transit accident duration, and it is difficult to effectively identify influencing factors, resulting in difficulty in making emergency response decisions.
The analysis method of influencing factors of traffic accident duration based on RSF model is used, including data preprocessing, construction of random survival forest model, C-index error rate optimization and variable importance analysis, to identify and calculate the importance of influencing factors.
It improves the prediction accuracy and applicability of the duration of rail transit accidents, can process censored data, identify multiple influencing factors, and provide rapid analysis and control suggestions.
Smart Images

Figure CN114372522B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rail transit, and particularly to a method for analyzing influencing factors of traffic accident duration based on the RSF model. Background Art
[0002] Rail transit has the advantages of large transportation capacity, high efficiency, energy conservation and environmental protection. With the continuous advancement of China's urbanization process, the rail transit network in urban areas has also developed significantly, and rail transit is gradually becoming the main mode of travel for urban residents. However, with the continuous development of rail transit, the frequency of rail traffic accidents is also increasing. Due to the characteristics of large passenger flow at stations during peak hours and high passenger density in trains for rail transit, once a rail transit interruption event occurs, it will lead to the interruption of the urban traffic system and form a large number of passenger delays, and even cause serious casualties. Around the world, rail transit operators and passengers are troubled by increasingly serious rail traffic accidents.
[0003] Therefore, the accurate prediction of rail traffic accident duration is crucial for emergency response decision-making. Regarding the research on accident duration, existing research mainly focuses on the prediction of urban road accidents, such as urban expressways and highways. There is relatively little research on rail traffic accident duration, and mainly uses parametric models with high data requirements and relatively low prediction accuracy. For accident data sets with censored data, existing methods have certain limitations in prediction accuracy.
[0004] In order to more accurately predict the rail traffic accident duration, it is necessary to accurately identify the risk factors affecting the rail traffic accident duration, and there is an urgent need to design an analysis method for accident duration influencing factors. Summary of the Invention
[0005] The purpose of the present invention is to provide a method for analyzing influencing factors of traffic accident duration based on the RSF model to overcome the defects of high data requirements and low prediction accuracy in the existing technologies.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] The present invention provides a method for analyzing influencing factors of traffic accident duration based on the RSF algorithm, and the method includes the following steps:
[0008] Step S1, obtain rail traffic accident data, and obtain the original data set after preprocessing;
[0009] Step S2, construct a random survival forest model based on accident duration;
[0010] Step S3: Select the optimal random survival forest model based on the prediction error rate obtained from the C-index;
[0011] Step S4: Determine the influencing factors of the duration of rail traffic accidents through the variable importance VIMP index and calculate the degree of importance.
[0012] Preferably, the specific content of step S1 is as follows:
[0013] Use a crawler algorithm to extract rail traffic accident data, including accident duration, accident type, accident section, and release information;
[0014] Extract text information from the rail traffic accident data, eliminate duplicate, missing, and abnormal data, and expand the accident data by adding route-related variables, environmental variables, station-related variables, accident-related variables, and accident type variables for analysis to obtain the original dataset D.
[0015] Preferably, step S2 includes the following sub-steps:
[0016] Step S21: Use the bootstrap method to separate the training dataset L and the test dataset L from the original dataset D ′ ;
[0017] Step S22: Construct a binary recursive survival tree, randomly select a predetermined number of features for splitting, compare different node splitting rules, and select the node splitting rule with the largest difference in survival values of child nodes for splitting, and grow the survival tree as much as possible until the number of samples in each terminal node is not less than the minimum default value;
[0018] Step S23: After generating a preset number of survival trees, use the Nelson-Aalen method to estimate the total cumulative risk of the random survival forest model.
[0019] Preferably, the original dataset D in step S21 is expressed as (X1, T1, δ1),…,(X n , T n , δ n ), where X represents the feature vector corresponding to the event influencing factor, T represents the duration of the event, and δ represents the censoring status.
[0020] Preferably, the different node splitting rules in step S22 include the Log-rank splitting method, the Log-rankscore splitting method, and the Random splitting method.
[0021] Preferably, the specific content of step S23 is as follows:
[0022] For the terminal node h, the CHF cumulative hazard function of the l-th tree is:
[0023]
[0024] Among them, is the CHF cumulative hazard function value of the l-th tree for the terminal node h; d l,h is the number of samples in the terminal node h where the accident duration is greater than t l,h , Y l,h is the number of samples in the terminal node h where an event occurs when the accident duration is greater than t l,h ;
[0025] Then the total cumulative risk for the samples of the entire random forest model is:
[0026]
[0027] Among them, L is the number of survival trees; x e is the sample of the entire random forest model.
[0028] Preferably, the step S3 is specifically: calculating the OOD prediction error using the C-index, calculating the prediction error rates of the random survival forest models constructed by different survival trees and splitting rules, and selecting the optimal random survival forest model.
[0029] Preferably, the process of calculating the OOD prediction error using the C-index is as follows:
[0030] Pair all the accident data {i, j}, and a total of n accidents generate a set Ω containing accident pairing data; * ;
[0031] Preprocess the set Ω * for censored data to obtain the set Ω for calculating the C-index;
[0032] Calculate the ratio of the number of pairings in the set Ω where the prediction results are sorted the same as the original data to the number of pairings in the set Ω to obtain the C-index value:
[0033]
[0034] Among them, I represents the judgment function, respectively represent the predicted survival probabilities for accidents i and j;
[0035] Then the OOD prediction error is 1 - C.
[0036] Preferably, the preprocessing of the set Ω * for censored data is specifically: excluding the pairings with the following characteristics from the set Ω * :
[0037] 1) Incidents with a duration less than the preset threshold during pairing are censored data;
[0038] 2) The accident durations in the pairing are the same (T i = T j ) and the censoring feature is not (δ i = 1, δ j = 0), (δ i = 0, δ j = 1), (δ i = 1, δ j = 1);
[0039] 3) All the accidents in the pairing are censored data where no accident has occurred.
[0040] Preferably, the step S4 is specifically as follows:
[0041] Step S41: During the significance test, by randomly permuting the values of the variables and comparing the prediction error with the original OOB prediction error, obtain the variable importance VIMP parameter for a specific variable x:
[0042]
[0043] where C x is the C-index parameter of the optimal random survival forest model; represents the C-index parameter of the randomly obtained random survival forest model when calculating the OOD prediction error using the test data and randomly allocating at all nodes split by the variable x;
[0044] Step S42: After obtaining the variable importance VIMP result, reconstruct the random survival forest model according to the magnitude of the VIMP value; delete the variables that have a negative contribution to the model prediction and reconstruct a new model; repeatedly iterate to obtain a prediction model with a VIMP value greater than 0;
[0045] Step S43: Set the VIMP significant variable reference value, and for the variables with significant influence, conduct descriptive and correlation statistics to identify the risk factors affecting the duration of rail transit accidents.
[0046] Compared with the prior art, the present invention has the following advantages:
[0047] 1) The random survival forest model adopted by the present invention combines the advantages of traditional parametric statistical methods and machine learning methods, can handle accident data sets with censored data, and has higher prediction accuracy and wider applicability compared with traditional statistical models;
[0048] 2) The present invention can comprehensively discuss the factors affecting the duration of rail traffic accidents, and can test various types of variables that may affect the severity and recovery speed of rail traffic accidents, such as the start and end locations of the accident, weather, location-related variables, and line-related variables; however, existing analysis methods are difficult to analyze these influencing factors;
[0049] 3) The method proposed by the present invention can quickly analyze the influence of various variables on the duration of rail traffic accidents, and provide suggestions for the formulation of control measures. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is the framework of the method for predicting the duration of rail traffic accidents based on random survival forests of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0052] Embodiment
[0053] As Figure 1 shown, this embodiment provides an analysis method for influencing factors of the duration of traffic accidents based on the RSF algorithm, and the method includes the following steps:
[0054] Step S1: Obtain rail traffic accident data, and obtain the original data set after preprocessing;
[0055] Step S2: Construct a random survival forest model based on the accident duration;
[0056] Step S3: Select the optimal random survival forest model based on the prediction error rate obtained by the C-index;
[0057] Step S4: Determine the influencing factors of the duration of rail traffic accidents through the variable importance VIMP index, and calculate the degree of importance.
[0058] Next, each step will be introduced in detail.
[0059] Step S1: Obtain rail traffic accident data
[0060] Extract rail traffic accident data through the crawler algorithm. The original data is unstructured data in the end, including information such as accident duration, accident type, accident section, release time, etc.;
[0061] The construction algorithm extracts text information from accident information, eliminates duplicate, missing, and abnormal data, and expands the accident data. Variables such as route-related variables, environmental variables, site-related variables, accident-related variables, and accident types are added for analysis, and duplicate, missing, and abnormal data are eliminated to obtain the original dataset D.
[0062] Step S2: Construct a random survival forest model
[0063] First, use the bootstrap method to separate the training dataset L and the test dataset (out-of-bag data) L from the original dataset D ′ . Let the original dataset D be represented as (X1, T1, δ1),…,(X n , T n , δ n ), where X represents the vector of relevant influencing factors (features) of the event, T represents the duration of the event, and δ represents the censoring status (δ = 0 indicates that the event has occurred, and δ = 1 indicates that the event has not occurred). Then, construct a binary recursive survival tree, randomly select a certain number of features for splitting, and compare the following three commonly used node splitting rules: Log-rank splitting method, Log-rank score splitting method, and Random splitting method. Finally, select the splitting method with the largest difference in survival values of the child nodes for splitting.
[0064] Arrange the accident duration t in ascending order (t1 < t2 < … < t m ), and the Log-rank splitting method determines the splitting rule according to the value of L(x, c). The rule for selecting the best splitting point c is as follows:
[0065]
[0066] where d i,j (d i = d i,1 + d i,2 ) is the number of samples with accident duration greater than t i in child node j (j = 1, 2). Y i,j (Y i = Y i,1 + Y i,2 ) is the number of samples with events occurring when the accident duration in child node j (j = 1, 2) is greater than t i . The split node can be divided into two parts: x ≤ c and x > c. The split is judged by the survival value |L(x, c)|. The larger the value of the survival value |L(x, c)|, the better the splitting effect.
[0067] Arrange the variable values x in ascending order (x1 ≤ x2 ≤ … ≤ x n) Coefficient α of the Log-rank score splitting method j is:
[0068]
[0069] where τ j represents the number of events {t: T k ≤ T t} with accident duration less than T, k} and s and s a represent the mean and variance of the sample respectively. n i,j represents the sample size of the child node (n i,j belongs to the child node of node n i in the binary tree, where n i = n i,1 + n i,2 ). Splitting is judged by the survival value |S(x, c)|. The larger the survival value |S(x, c)|, the better the splitting effect. The calculation formula of the survival value |S(x, c)| is as follows:
[0070]
[0071] The Random splitting method randomly selects a fixed number (nsplit) of splitting points and selects the best value among them. Splitting is judged by the survival value |R(x, c)|. The larger the value of the survival value |R(x, c)|, the better the splitting effect. The calculation formula of the survival value |R(x, c)| is as follows:
[0072] R(x, c) = Max{|L(x, c1)|,..., |L(x, c nsplit )|}
[0073] After determining the splitting rule, grow the survival tree as much as possible until the sample size of each terminal node is not lower than the minimum default value. After generating a sufficient number of survival trees, use the Nelson-Aalen method to estimate the total cumulative risk (Nelson-Aalen cumulative hazard function, CHF) of the random survival forest model.
[0074] For the terminal node h, the CHF cumulative hazard function of the l-th tree is:
[0075]
[0076] where, is the value of the CHF cumulative hazard function of the l-th tree for the terminal node h; d l,h is the number of samples with accident duration greater than t l,h in the terminal node h, Y l,hThe number of samples of the event occurring when the accident duration in the terminal node h is greater than t l,h ;
[0077] Then the total cumulative risk for the entire random forest model samples is:
[0078]
[0079] where L is the number of survival trees; x e is the sample of the entire random forest model.
[0080] Step S3: Calculate the prediction error rate
[0081] Use the test data (out-of-bag data) to calculate the accuracy of the model under different splitting methods. In this embodiment, the OOD prediction error is calculated using the C-index (C), and the OOD prediction error is defined as 1 - C. The C-index is a measure of the goodness of fit of a survival model and is used to calculate the difference between the predicted values and the actual values of the model in survival analysis. The steps for calculating the C-index of the railway accident duration are as follows:
[0082] 1) Pair all the accident data {i, j}, and a total of n accidents generate a set Ω containing * ;
[0083] 2) Exclude the pairs with the following characteristics from the set Ω * : 1) The accident with a shorter duration in the pair is censored data; 2) The accident durations in the pair are the same (T i = T j ) and the censoring characteristics are not (δ i = 1, δ j = 0), (δ i = 0, δ j = 1), (δ i = 1, δ j = 1); 3) Both accidents in the pair are censored data that did not occur;
[0084] 3) Finally, the set Ω for calculating the C-index is obtained, and the final value of the C-index is the ratio of the number of pairs with the same prediction result order as the original data in the set Ω to the number of pairs in the set Ω. The calculation formula of the C-index is as follows:
[0085]
[0086] where I represents the judgment function, respectively represent the predicted survival probabilities for accidents i and j. Finally, select the optimal model according to the prediction error rates of the models with different survival trees and different splitting rules.
[0087] Step S4. Calculate and analyze the importance of variables
[0088] Finally, the variable importance (VIMP) method is used to select and analyze the influencing factors for the duration of rail traffic accidents, and the importance degree is calculated. During the significance test, the values of the variables are randomly permuted, and the prediction error is compared with the original out-of-bag (OOB) prediction error. A higher VIMP value indicates that including this variable will improve the prediction accuracy of the model. A VIMP close to zero indicates that this variable makes no contribution to the prediction accuracy, while a negative value indicates that the prediction error will increase when this variable is added to the model. For a specific variable x, the calculation formula for VIMP is as follows:
[0089]
[0090] where C x is the C-index parameter of the optimal model, and represents the C-index parameter of the random forest obtained by random assignment among all the nodes split by x when calculating using the out-of-data (OOD) prediction error.
[0091] After obtaining the variable importance results, the model is reconstructed according to the magnitude of VIMP. Variables that have a negative contribution to the model prediction (VIMP < 0) are deleted, and a new model is reconstructed. After repeated iteration to obtain a model where all VIMP values are greater than 0, according to relevant research, VIMP = 0.002 is used as a reference for whether a variable is a significant variable. When the VIMP of a variable > 0.002, it is considered that this factor has a significant impact on the duration of rail traffic accidents. For the above variables with significant impacts, descriptive and correlation statistics are performed to identify the risk factors affecting the duration of rail traffic accidents, and relevant control suggestions are put forward.
[0092] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for analyzing the influencing factors of traffic accident duration based on the RSF algorithm, characterized in that, The method comprises the following steps: Step S1, obtaining rail transit accident data, and obtaining an original data set after preprocessing; Step S2, constructing an accident duration prediction model based on a random survival forest model; Step S3, selecting the optimal random survival forest model based on the prediction error rate obtained by C-index; Step S4, determining the influencing factors of the duration of rail transit accidents through the variable importance VIMP index, and calculating the importance; The step S3 specifically comprises: using C-index to calculate the OOB prediction error, calculating the prediction error rate of the random survival forest model constructed by different survival trees and splitting rules, and selecting the optimal random survival forest model; The C-index is used to calculate the OOB prediction error. The specific process is as follows: Pair all the accident data {i, j}, and a total of n accidents generate a set Ω containing accident pairing data * ; For the set Ω * Perform preprocessing on the censored data to obtain the set Ω for calculating the C-index; Calculate the ratio of the number of pairs in set Ω whose prediction results are ranked consistent with the original data to the number of pairs in set Ω to obtain the C-index value: where I represents a judgment function, represent the predicted survival probabilities for accidents i and j, respectively; Then the OOB prediction error is 1-C; The set Ω * The preprocessing for censored data is specifically as follows: From the set Ω * Exclude the pairs with the following characteristics: 1) Accidents whose duration in the pairing is less than the preset threshold are considered censored data; 2) The accident durations in the pair are the same (T i = T j ) and the censoring characteristics are not (δ i = 1, δ j = 0), (δ i = 0, δ j = 1), (δ i = 1, δ j = 1); 3) All the accidents in the pairing were censored data that did not occur; The step S4 is specifically as follows: Step S41: In the significance test process, by randomly permuting the value of the variable and comparing the prediction error with the original OOB prediction error, the variable importance VIMP parameter for the specific variable x is obtained: Among them, C x is the C-index parameter of the optimal random survival forest model; represents the C-index parameter of the random survival forest model randomly assigned when calculating the OOB prediction error using the test data among all the nodes split using the variable x; Step S42: after obtaining the variable importance VIMP result, reconstruct the random survival forest model according to the size of the VIMP value; delete the variables that have a negative contribution to the model prediction, and reconstruct a new model; repeatedly iterate to obtain a prediction model with VIMP values greater than 0; Step S43: Set the VIMP significant variable reference value, perform descriptive and correlation statistics on the variables with significant influence, and identify the risk factors that affect the duration of rail transit accidents.
2. The method for analyzing the influencing factors of the duration of a traffic accident based on the RSF algorithm according to claim 1, characterized in that, The step S1 is specifically as follows: Use crawler algorithms to extract rail transit accident data, including accident duration, accident type, accident section, and release information; Text information is extracted from rail transit accident data, and duplicate, missing and abnormal data are removed. The accident data is expanded, and route-related variables, environmental variables, station-related variables, accident-related variables and accident type variables are added for analysis to obtain the original data set D.
3. The method for analyzing influencing factors of traffic accident duration based on the RSF algorithm according to claim 1, wherein The step S2 comprises the following sub-steps: Step S21: Use the bootstrap method to separate the training dataset L and the test dataset L from the original dataset D ′ ; Step S22, construct a binary recursive survival tree, randomly select a predetermined number of features for splitting, and compare different node splitting rules, select the node splitting rule with the largest difference in child node survival value for splitting, and grow the survival tree as much as possible until the number of samples at each terminal node is not less than the minimum default value; Step S23: After generating a preset number of survival trees, the Nelson-Aalen method is used to estimate the total cumulative risk of the random survival forest model.
4. The method for analyzing the influencing factors of the duration of a traffic accident based on the RSF algorithm according to claim 3, wherein, In the original data set D in step S21, it is represented as (X1, T1, δ1),…,(X n , T n , δ n ), where X represents the feature vector corresponding to the event influencing factor, T represents the duration of the event, and δ represents the censoring status.
5. A method for analyzing the influencing factors of traffic accident duration based on the RSF algorithm according to claim 4, characterized in that, The different node splitting rules in step S22 include Log-rank splitting method, Log-rank score splitting method and Random splitting method.
6. The method for analyzing influencing factors of traffic accident duration based on the RSF algorithm according to claim 3, wherein The step S23 is specifically as follows: For the terminal node h, the CHF cumulative hazard function of the lth tree is: Among them, is the CHF cumulative hazard function value of the l-th tree for the terminal node h; d l,h is the number of samples with accident duration greater than t in the terminal node h l,h , Y l,h is the number of samples with events occurring when the accident duration is greater than t l,h in the terminal node h; Then the total cumulative risk for the entire random forest model sample is as follows: Among them, L is the number of survival trees; x e is the sample of the entire random forest model.