Accident analysis method based on Bayesian theory
Patent Information
- Application Number
- CN202410044857.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-11
- Publication Date
- 2025-07-11
Smart Images

Figure CN120296406A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing and analysis, and in particular to an accident analysis method based on Bayesian theory. Background Art
[0002] Under the background of building a "powerful transportation country" and "low-carbon transportation", the use of new energy and clean energy transportation tools is actively advocated. At this time, electric bicycles have quickly become the first choice for people to travel due to their low cost, convenience, environmental friendliness and other advantages. However, the large-scale investment in electric bicycles also brings certain hidden dangers to road traffic safety. To ensure the safety of electric bicycle users, the research on electric bicycle accidents is of great significance to a certain extent.
[0003] At present, most scholars generally use the Bayesian network model based on the theory of probability to analyze accidents. The analysis results have a certain degree of credibility, providing theoretical reference and data support for the accident and safety analysis of electric bicycles in China. However, the analysis results still have relatively large deviations to a certain extent, and the accuracy of the analysis results needs to be further improved.
[0004] Therefore, the present invention proposes an accident analysis method based on Bayesian theory. Summary of the Invention
[0005] The purpose of the present invention is to address the deficiencies of the existing electric bicycle accident analysis model, aiming to propose an accident analysis method based on Bayesian theory to realize the analysis of electric bicycle traffic accidents, thereby improving the accuracy of the analysis model results and providing a theoretical basis for further research on electric bicycles.
[0006] To achieve the above purpose, the present invention adopts the following technical solutions:
[0007] An accident analysis method based on Bayesian theory, comprising the following steps:
[0008] S1: Data preprocessing, performing weakening processing on the data to eliminate the random interference of the data, so as to improve the prediction results and accuracy;
[0009] S2: Model establishment, establishing a data prediction model for data prediction;
[0010] S3: Model accuracy verification, verifying the accuracy of the established model to ensure the prediction accuracy.
[0011] Preferably: in the step S1, a variable weight weakening buffer operator is used to process the original data sequence, which includes the following steps:
[0012] S11: Establishing the original data sequence of the grey system;
[0013] S12: Let the parameter in the original data sequence of the grey system be as in Equation 1:
[0014] X (0) D = (X (0) (1)d, X (0) (2)d,..., X (0) (n)d) (1)
[0015] Where:
[0016]
[0017] S13: When X is a monotonically increasing sequence, a monotonically decreasing sequence, or an oscillating sequence, D is a weakening buffer operator.
[0018] Preferably: The model establishment process described in step S2 includes the following steps:
[0019] S21: Set the non - negative original sequence X (0) ;
[0020] S22: Accumulate the original sequence X (0) to obtain the first - order accumulated sequence (1 - AGo)X (1) ; Where:
[0021] X (1) = (X (1) (1), X (1) (2),..., X (1) (n)) (3)
[0022] Furthermore, Z (1) :
[0023] Z (1) = (Z (1) (1), Z (1) (2),..., Z (1) (n)) (4)
[0024] S23: Obtain the grey differential equation
[0025] X (0) (k)+aZ (1) (k)=b, k = 2, 3,..., n (5)
[0026] In the formula: a represents the development coefficient, b represents the grey action quantity, and Z (1) (k) represents the model background value;
[0027] S24: Set each parameter
[0028]
[0029] Therefore, the grey differential equation in step S23 can be expressed as Y=Bu, and the estimated values of parameters a and b are obtained by the least square method:
[0030]
[0031] Then the whitened differential equation is:
[0032]
[0033] S25: Under the initial conditions, solving the whitened differential equation, the general solution is:
[0034]
[0035] The general solution of the whitened differential equation is: let t = n-1, t = n, and substitute them into the corresponding equations to obtain
[0036]
[0037]
[0038] S26: Set weight coefficient Will Multiply them by Formula 10 and Formula 20 in step S25 respectively.
[0039] On both sides of formula 11, we get
[0040]
[0041]
[0042] S27: Add equation 12 and equation 13 in step S26 to obtain the initial condition C:
[0043]
[0044] S28: Then, by minimizing the error sum of the time response function as the objective function and performing the assignment process as shown in Equation 15, the expression of the initial condition C is obtained.
[0045]
[0046] Substituting into step S27, we get
[0047]
[0048] When g(c) reaches the minimum value, C can be obtained
[0049]
[0050] At this time, the weight coefficient can be obtained by combining the above formulas The expression is:
[0051]
[0052] The optimized time response function obtained is:
[0053]
[0054] The cumulative subtraction is restored to:
[0055]
[0056] S29: In Equation 20, let The initial value is 0, calculate the sum of squared errors of the model under this weight, then perform iteration, and finally select the value corresponding to the minimum sum of squared errors as the optimal weight coefficient, so as to calculate the new background value and initial conditions, and finally determine the model.
[0057] Preferably: In step S22, z (1) (k) is the background value; λ represents the weight coefficient, λ ∈ [0, 1].
[0058] Preferably: In step S25, the initial condition is: Substitute the weighted values of the last two components of the sequence into the fitting model to solve the initial condition.
[0059] Preferably: In step S26,
[0060] Preferably: In step S3, the items for model testing include residual test and posterior difference test.
[0061] Preferably: The residual test includes the following steps:
[0062] S31a: Calculate the residual according to formula 21;
[0063] ε (0) (k) = X (0) - X (0) (k) (21)
[0064] S32a: Then, calculate the error and average relative error respectively according to formulas 22 and 23;
[0065]
[0066]
[0067] In steps S31a and S32a, X (0) (k) represents the actual value, X (0) (k) represents the predicted value, k = 1, 2,..., n, δk ≤20%, δ k ≤10%.
[0068] Preferably: The posterior difference test includes the following steps:
[0069] S31b: First, calculate the mean of the original data by Equation 24; then calculate the variance, residual mean, and residual variance of the original data according to Equations 25 - 27 respectively;
[0070]
[0071]
[0072]
[0073]
[0074] S32b: Furthermore, calculate the posterior difference and the small error probability according to Equations 28 and 29 respectively;
[0075]
[0076]
[0077] In step S32b, c < 0.65, p > 0.7.
[0078] Preferably: In step S32b, c < 0.35, p > 0.95.
[0079] The beneficial effects of the present invention are as follows:
[0080] 1. Starting from the cause of the error in the Bayesian network model, the present invention optimizes and improves the traditional Bayesian network model by data preprocessing, improving the model background value and initial conditions, and result verification, thereby improving the accuracy of the results. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 It is a schematic flowchart of an accident analysis method based on Bayesian theory proposed by the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0082] In order to explain in detail the technical solutions disclosed by the present invention, the technical solutions and the accompanying drawings of the present invention will be further elaborated and explained in detail below in combination with the specific embodiments.
[0083] The present invention studies an accident analysis method for electric bicycles based on Bayesian theory. The method includes: preprocessing the collected data to eliminate data interference and improve the accuracy and reliability of the analysis results.
[0084] Example 1:
[0085] An accident analysis method based on Bayesian theory, which comprises the following steps:
[0086] S1: Data preprocessing, weakening the data to eliminate the random interference of the data, so as to improve the prediction result and accuracy;
[0087] S2: Model establishment, establishing a data prediction model for data prediction;
[0088] S3: Model accuracy test, testing the accuracy of the established model to ensure the prediction accuracy.
[0089] In the step S1, the variable weight weakening buffer operator is used to process the original data sequence, which comprises the following steps:
[0090] S11: Establishing the original data sequence of the grey system;
[0091] S12: Let the parameter in the original data sequence of the grey system be Equation 1:
[0092] X (0) D = (X (0) (1)d, X (0) (2)d,..., X (0) (n)d) (1)
[0093] Where:
[0094]
[0095] S13: When X is a monotonically increasing sequence, a monotonically decreasing sequence or an oscillating sequence, D is a weakening buffer operator.
[0096] 3. The accident analysis method based on Bayesian theory according to claim 1, wherein: the model establishment process in step S2 comprises the following steps:
[0097] S21: Setting the non - negative original sequence X (0) ;
[0098] S22: Accumulating the original sequence X (0) to obtain the first - order accumulated sequence (1 - AGO)X (1) ;
[0099] Where:
[0100] X (1) =(X (1) (1), X (1) (2),..., X (1) (n)) (3)
[0101] Furthermore, Z can be obtained. (1) :
[0102] Z (1) = (Z (1) (1), Z (1) (2), …, Z (1) (n)) (4)
[0103] S23: Obtain the grey differential equation
[0104] X (0) (k) + aZ (1) (k) = b, k = 2, 3, …, n (5)
[0105] Where: a represents the development coefficient, b represents the grey action quantity, and Z (1) (k) represents the model background value;
[0106] S24: Set each parameter
[0107]
[0108] Thus, the grey differential equation in step S23 can be expressed as Y = Bu, and the estimated values of parameters a and b are obtained by the least squares method:
[0109]
[0110] Then the whitenized differential equation is:
[0111]
[0112] S25: Under the initial conditions, solve the whitenized differential equation, and the general solution can be obtained as:
[0113]
[0114] Process the general solution of the whitenized differential equation: Let t = n - 1 and t = n respectively, and substitute them correspondingly, we get
[0115]
[0116]
[0117] S26: Set the weight coefficient , and multiply to both sides of formula 10 and formula
[0118] 11 in step S25 respectively, and we get
[0119]
[0120]
[0121] S27: Add equation 12 and equation 13 in step S26 to obtain the initial condition C:
[0122]
[0123] S28: Then, by minimizing the error sum of the time response function as the objective function and performing the assignment process as shown in Equation 15, the expression of the initial condition C is obtained.
[0124]
[0125] Substituting into step S27, we get
[0126]
[0127] When g(c) reaches the minimum value, C can be obtained
[0128]
[0129] At this time, the weight coefficient can be obtained by combining the above formulas The expression is:
[0130]
[0131] After optimization, the time response function is:
[0132]
[0133] The cumulative reduction is:
[0134]
[0135] S29: In formula 20, let the initial value of λ be 0, calculate the sum of squared errors of the model under this weight, and then iterate, and finally select the value corresponding to the minimum sum of squared errors as the optimal weight coefficient, so as to calculate the new background value and initial conditions, and finally determine the model.
[0136] In the step S22, z (1) (k) is the background value; λ represents the weight coefficient, λ∈[0,1].
[0137] In the step S25, the initial condition is: bringing the weighted values of the last two components of the sequence into the fitting model to solve the initial condition.
[0138] In the step S26,
[0139] In the step S3, the model testing items include residual test and posterior difference test.
[0140] The residual test includes the following steps:
[0141] S31a: Calculate the residual according to Formula 21;
[0142] ε (0) (k) = X (0) -X (0) (k) (21)
[0143] S32a: Then, calculate the error and the average relative error respectively according to Formulas 22 and 23;
[0144]
[0145]
[0146] In steps S31a and S32a, X (0) (k) represents the actual value, X (0) (k) represents the predicted value, k = 1, 2,..., n, δ k ≤20%, δ k ≤10%.
[0147] The posterior difference test includes the following steps:
[0148] S31b: First, calculate the mean value of the original data by Equation 24; then calculate the variance, the mean value of the residuals, and the residual variance of the original data according to Formulas 25 - 27 respectively;
[0149]
[0150]
[0151]
[0152]
[0153] S32b: Furthermore, calculate the posterior difference and the small error probability according to Formulas 28 and 29 respectively;
[0154]
[0155]
[0156] In step S32b, c < 0.65, p > 0.7.
[0157] Example 2:
[0158] An accident analysis method based on Bayesian theory, which includes the following steps:
[0159] S1: Data preprocessing, weakening the data to eliminate random interference in the data, so as to improve the prediction results and accuracy;
[0160] S2: Model establishment, establishing a data prediction model for data prediction;
[0161] S3: Model accuracy inspection, inspecting the accuracy of the established model to ensure the prediction accuracy.
[0162] In the step S1, the variable weight weakening buffer operator is used to process the original data sequence, which includes the following steps:
[0163] S11: Establishing the original data sequence of the grey system;
[0164] S12: Let the parameter in the original data sequence of the grey system be Equation 1:
[0165] X (0) D = (X (0) (1)d, X (0) (2)d,..., X (0) (n)d) (1)
[0166] Where:
[0167]
[0168] S13: When X is a monotonically increasing sequence, a monotonically decreasing sequence or an oscillating sequence, D is a weakening buffer operator.
[0169] 3. The accident analysis method based on Bayesian theory according to claim 1, wherein: in the model establishment process of step S2, it includes the following steps:
[0170] S21: Setting the non - negative original sequence X (0) ;
[0171] S22: Accumulating the original sequence X (0) to obtain the first - order accumulated sequence (1 - AGO)X (1) ;
[0172] Where:
[0173] X (1) =(X (1) (1), X (1) (2),..., X (1) (n)) (3)
[0174] Furthermore, Z (1) can be obtained:
[0175] Z (1) =(Z (1) (1), Z(1) (2), …, Z (1) (n)) (4)
[0176] S23: Obtain the grey differential equation
[0177] X (0) (k) + aZ (1) (k) = b, k = 2, 3, …, n (5)
[0178] Where: a represents the development coefficient, b represents the grey action quantity, and Z (1) (k) represents the model background value;
[0179] S24: Set each parameter
[0180]
[0181] Thus, the grey differential equation in step S23 can be expressed as Y = Bu, and the estimated values of parameters a and b are obtained by the least square method:
[0182]
[0183] Then the whitenized differential equation is:
[0184]
[0185] S25: Under the initial conditions, solve the whitenized differential equation, and the general solution can be obtained as:
[0186]
[0187] Process the general solution of the whitenized differential equation: Let t = n - 1 and t = n respectively, and substitute them correspondingly, we get
[0188]
[0189]
[0190] S26: Set the weight coefficient Multiply to both sides of formula 10 and formula
[0191] 11 in step S25 respectively, and we get
[0192]
[0193]
[0194] S27: Perform an addition operation on formula 12 and formula 13 in step S26, and the initial condition C can be obtained:
[0195]
[0196] S28: Next, taking the sum of squared errors of the time response function as the objective function and performing assignment processing as shown in Equation 15, the expression of the initial condition C is obtained.
[0197]
[0198] Substitute into what is obtained in step S27
[0199]
[0200] When g(c) reaches the minimum value, C can be obtained.
[0201]
[0202] At this time, by simultaneously solving the above equations, the weight coefficient can be obtained. The expression is:
[0203]
[0204] The optimized time response function is:
[0205]
[0206] Cumulative subtraction and restoration are:
[0207]
[0208] S29: In Equation 20, let the initial value of λ be 0, calculate the sum of squared errors of the model under this weight, and then perform iteration. Finally, select the value corresponding to the minimum sum of squared errors as the optimal weight coefficient, so as to calculate the new background value and initial conditions, and finally determine the model.
[0209] In the said step S22, z (1) (k) is the background value; λ represents the weight coefficient, λ ∈ [0, 1].
[0210] In the said step S25, the initial condition is: Substitute the weighted values of the last two components of the sequence into the fitting model to solve the initial condition.
[0211] In the said step S26,
[0212] In the said step S3, the items for model verification include residual verification and posterior difference verification.
[0213] The said residual verification includes the following steps:
[0214] S31a: Calculate the residual according to formula 21;
[0215] ε (0) (k) = X (0) -X (0) (k) (21)
[0216] S32a: Next, calculate the error and the average relative error respectively according to formulas 22 and 23;
[0217]
[0218]
[0219] In the steps of S31a and S32a, X (0) (k) represents the actual value, X (0) (k) represents the predicted value, k = 1, 2,..., n, δ k ≤ 20%, δ k ≤ 10%.
[0220] The posterior difference test includes the following steps:
[0221] S31b: First, calculate the mean of the original data from formula 24; then calculate the variance, the mean of the residuals, and the variance of the residuals according to formulas 25 - 27 respectively;
[0222]
[0223]
[0224]
[0225]
[0226] S32b: Furthermore, calculate the posterior difference and the small error probability according to formulas 28 and 29 respectively;
[0227]
[0228]
[0229] In the step of S32b, c is less than 0.35 and p > 0.95.
[0230] The present invention takes the cause of the error of the Bayesian network model as the starting point, and optimizes and improves the traditional Bayesian network model by means of data preprocessing, improvement of the model background value and initial conditions, and result inspection, thereby improving the accuracy of the result.
[0231] The above are only the preferred specific embodiments 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, according to the technical solution and inventive concept of the present invention, making equivalent substitutions or changes, shall be covered by the protection scope of the present invention patent.
Claims
1. An accident analysis method based on Bayesian theory, characterized in that: It includes the following steps: S1: Data preprocessing, weakening the data to eliminate the random interference of the data, so as to improve the prediction result and accuracy; S2: Model establishment, establishing a data prediction model for data prediction; S3: Model accuracy inspection, inspecting the accuracy of the established model to ensure the prediction accuracy.
2. The accident analysis method based on Bayesian theory according to claim 1, wherein: In the step S1, the variable weight weakening buffer operator is used to process the original data sequence, which includes the following steps: S11: Establish the original data sequence of the grey system; S12: Let the parameter in the original data sequence of the grey system be Equation 1: X (0) D = (X (0) (l)d, X (0) (2)d, …, X (0) (n)d) (1) Where: S13: When X is a monotonically increasing sequence, a monotonically decreasing sequence or an oscillating sequence, D is a weakening buffer operator.
3. The accident analysis method based on Bayesian theory according to claim 1, wherein: The model establishment process described in step S2 includes the following steps: S21: Set a non - negative original sequence X (0) ; S22: Accumulate the original sequence X (0) to obtain the first accumulated sequence (1-AGO)X (1) ; Where: X (1) = (X (1) (1), X (1) (2), …, X (1) (n) (3) Furthermore, Z can be obtained (1) : Z (1) = (Z (1) (1), Z (1) (2), …, Z (1) (n)) (4) S23: Obtain the grey differential equation X (0) (k)+aZ (1) (k) = b, k = 2, 3, …, n (5) where: a represents the development coefficient, b represents the grey action quantity, and Z (1) (k) represents the model background value; S24: Set each parameter Thus, the grey differential equation in step S23 can be expressed as Y = Bu, and the estimated values of parameters a and b are obtained by the least squares method: Then the whiting differential equation is: S25: Under the initial conditions, solve the whiting differential equation, and the general solution can be obtained as: Process the general solution of the whiting differential equation: Let t = n - 1 and t = n respectively, and substitute them correspondingly, we get S26: Set weight coefficients Multiply to both sides of Formula 10 and Formula 11 in Step S25 respectively, obtaining S27: Perform an addition operation on Equation 12 and Equation 13 in step S26 to obtain the initial condition C: S28: Then, with the objective of minimizing the sum of squared errors of the time response function and performing assignment processing as Equation 15, the expression of the initial condition C is obtained Substitute into what is obtained in step S27 When g(c) obtains the minimum value, C can be obtained At this time, the weight coefficient can be obtained by combining the above formulas The expression is: The optimized time response function is: Accumulative subtraction restoration is: S29: In Equation 20, let the initial value be 0, calculate the sum of squared errors of the model under this weight, then perform iteration, and finally select the value corresponding to the minimum sum of squared errors as the optimal weight coefficient, so as to calculate the new background value and initial conditions, and finally determine the model.
4. The accident analysis method based on Bayesian theory according to claim 3, characterized in that: In the step S22, z (1) (k) is the background value; λ represents the weight coefficient, and λ ∈ [0, 1].
5. The accident analysis method based on Bayesian theory according to claim 3, wherein: In the step S25, the initial condition is: Substitute the weighted values of the last two components of the sequence into the fitting model to solve the initial condition.
6. The accident analysis method based on Bayesian theory according to claim 3, characterized in that: In the step S26, 7. The accident analysis method based on Bayesian theory according to claim 3, characterized in that: In the step S3, the items for model inspection include residual inspection and posterior difference inspection.
8. The accident analysis method based on Bayesian theory according to claim 7, wherein: The residual inspection includes the following steps: S31a: Calculate the residual according to formula 21; ε (0) (k) = X (0) -X (0) (k) (21) S32a: Then, calculate the error and the average relative error respectively according to formula 22 and formula 23; In the steps S31a and S32a, X (0) (k) represents the actual value, X (0) (k) represents the predicted value, k = 1, 2,..., n, δ k ≤ 20%, δ k ≤ 10%.
9. The accident analysis method based on Bayesian theory according to claim 7, characterized in that: The posterior difference inspection includes the following steps: S31b: First calculate the mean value of the original data by formula 24; then calculate the variance of the original data, the mean value of the residual and the residual variance respectively according to formulas 25 - 27; S32b: Furthermore, calculate the posterior difference and the small error probability respectively according to formula 28 and formula 29; In the step S32b, c < 0.65, p > 0.
7.
10. The accident analysis method based on Bayesian theory according to claim 9, characterized in that: In the step S32b, c < 0.35, p > 0.95.