Imbalanced discrete data generation method fusing causal constraints and potential variables

By integrating causal constraints and latent variables into a VAE, and utilizing the WGAN-GP network to generate high-fidelity samples that conform to causal logic, the imbalance of traffic accident data is solved, thereby improving the accuracy of accident prediction and the effectiveness of road safety management.

CN121682014APending Publication Date: 2026-03-17XIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511574705.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing variational autoencoders (VAEs) do not fully consider causal relationships when generating traffic accident data, resulting in generated samples lacking real data logical connections. This fails to effectively solve the problem of data imbalance and affects the predictive performance of serious accidents.

Method used

By constructing a causal graph and adjacency matrix, integrating causal constraints with latent variables, optimizing the distribution of latent variables using the WGAN-GP network, and adding causal constraints to the VAE decoder, high-fidelity samples conforming to causal logic are generated.

Benefits of technology

It improves the quality and consistency of traffic accident datasets, enhances the accuracy and predictive precision of road safety management, and solves the problem of uneven data distribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121682014A_ABST
    Figure CN121682014A_ABST
Patent Text Reader

Abstract

The invention discloses an unbalanced discrete data generation method fusing causal constraints and potential variables, and the method comprises the steps: firstly collecting environmental factors and accident severity of a road traffic accident occurrence point, recording the environmental factors and accident severity as road traffic accident data D, building a causal graph G of the road traffic accident data D, and obtaining an adjacent matrix A; secondly, performing encoder mapping calculation on the original data feature X through a variational auto-encoder VAE to obtain a potential variable z; taking the potential variable z and the category label Y as the input of a WGAN-GP network generator to obtain a virtual potential variable, and distinguishing the potential variable z and the virtual potential variable in combination with the authenticity score Di output by a discriminator to obtain a high-fidelity potential variable; and finally, taking the high-fidelity potential variable as the input of a VAE decoder, and generating few-class sample synthesis data in combination with causal constraints. According to the invention, the urban traffic accident data monitoring quality can be improved, and the road safety management and decision-making accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of discrete data generation technology, specifically involving a method for generating unbalanced discrete data that integrates causal constraints and latent variables. Background Technology

[0002] To improve road traffic safety management, accurate prediction of traffic accident severity has become a key task. However, the historical accident data relied upon for such predictions typically consists of discrete integer samples with a highly imbalanced class distribution; for example, the number of samples of major or fatal accidents is significantly lower than that of general accidents. This discrete and skewed data structure makes it prone to overfitting the majority class when training models, thus degrading the predictive performance for severe accidents. This can lead to missed detections of high-risk scenarios in practical applications, potentially increasing the overall safety risk of the road system. Therefore, to improve the model's ability to identify severe accidents, effective equalization preprocessing of the input data is necessary before training.

[0003] Variational autoencoders (VAEs), as generative models, can generate new samples by learning the latent distribution of data, providing a certain approach to data imbalance. However, VAEs do not fully consider the causal relationships between data variables during the generation process, and the generated samples may lack the logical connections found in real data, failing to accurately reflect the underlying mechanisms of the data. Therefore, their effectiveness in addressing data imbalance is limited, and their consistency with the original data is poor. Thus, this invention proposes a method for generating imbalanced discrete data that integrates causal constraints and latent variables to improve the quality of traffic accident severity datasets. Summary of the Invention

[0004] The purpose of this invention is to provide a method for generating unbalanced discrete data that integrates causal constraints and latent variables, which helps to improve the quality of urban traffic accident data monitoring and thus enhance the accuracy of road safety management and decision-making.

[0005] The technical solution adopted in this invention is a method for generating unbalanced discrete data that integrates causal constraints and latent variables, specifically implemented according to the following steps: Step 1: Collect environmental factors and accident severity data at the location of the road traffic accident and record them as road traffic accident data D, thus establishing road traffic accident data. D Cause-and-effect diagram G The adjacency matrix is ​​obtained. A ; Step 2: Feature the raw data X The latent variables are obtained by calculating the encoder mapping of the variational autoencoder (VAE). z ; Step 3: Latent variablesz and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. ; Step 4: The high-fidelity latent variables from Step 3... As input to the VAE decoder, it is combined with causal constraints to generate synthetic data of minority class samples.

[0006] The invention is further characterized in that, Step 1 is implemented in the following steps: Step 1.1: Collect environmental factors and accident severity at the location of a road traffic accident using sensors or recorders, and record them as road traffic accident data D. Environmental factors of the traffic accident are represented by characteristics. X This indicates that the severity of the accident is categorized as a label. Y ,in It is a discrete integer sample feature. i =1,..., d , d This is the feature dimension, which is the sum of the number of environmental factors; Indicates the first i Environmental factors in traffic accidents i For environmental factors, Indicates the first i Environmental factors contributing to traffic accidents; Step 1.2: Establish road traffic accident data using the Peter-Clark algorithm. D Cause-and-effect diagram G Calculate the features of the original data X The latent causal graph DAG, i.e. ,in, For cause-and-effect diagrams, v It is a set of nodes. v i Data features representing the same dimension x i , E It is a set of directed edges. The existence of directions between nodes indicates causal influence between them. First, the data characteristics are determined by combining conditional independence relationships. X From the causal skeleton graph, we obtain the adjacency matrix A, that is, when any two nodes... If an edge exists, then the adjacency matrix... The corresponding element in is 1, which means that... AWhen [i,j]=1, there is an edge between the two nodes. Then, through different nodes V The structure is used to obtain data features by combining directional propagation rules. X The latent causal graph DAG, which orients the edge connections between nodes, is calculated using the following V-structure: For any three nodes Satisfying: 1) Node v i and v j There are edges and nodes. v k and v j There are edges ;2) v i and v k No edge ,at the same time, v j Not belonging to v i and v k Subsets S Inside Then the three nodes are V structure: ; Then, the nodes are directed to each other using the directed propagation rules, and the nodes are connected by edges. express right There is a causal relationship, and the nodes... This indicates that two nodes are adjacent but have no causal relationship.

[0007] Category labels in step 1 Y = {L1,L2,L3,L4}, where L1, L2, L3, and L4 represent four types of accident severity: minor accident, general accident, relatively serious accident, and severe accident, respectively. The specific orientation rules in step 1 are as follows: 1) If it exists ,and and If not adjacent, then orientation. ; 2) If it exists And there exists a directed path. Then the orientation ; 3) If a path exists as well as Then the orientation .

[0008] Step 2 is implemented in the following steps: Step 2.1: The dimension of environmental factors in traffic accidents is d. This is achieved by analyzing the characteristics of the original data. X Perform embedding mapping to obtain the basic embedding mapping matrix. The calculation process is as follows Where W is the embedding matrix, the embedding matrix W is initialized using a uniform distribution, according to the... i Features x i The category index is used to extract the embedding matrix W row by row to obtain the first category index. i The basic embedding mapping matrix of each feature ; Step 2.2: To integrate the causal dependencies between variables into the original data features, the causal association information of the sample features is quantified using the adjacency matrix A to obtain the causal association embedding matrix. The calculation process is as follows: ,in, It is the first i Causal association embedding matrix of features, For the first i The basic embedding mapping matrix of each feature, A j,i Let be the adjacency matrix, representing the computation of the th adjacency matrix. j The first feature to the first i The causal influence of each characteristic; Step 2.3: Utilize a nonlinear activation function Perform a nonlinear mapping to embed causal relationships into the matrix. Mapping matrix with basic embedding Nonlinear calculations are performed to obtain the final causal perception embedding matrix. The calculation process is as follows: Where k and b are weight parameters, It is a non-linear activation function. For the first i The final causal perception embedding matrix of each feature; Step 2.4: First, sort by feature dimension d A multi-dimensional causal perception embedding matrix splicing ,Right now , Use the contact function to d A multi-dimensional causal perception embedding matrix Combination, making d A multi-dimensional causal perception embedding matrix Become a global feature ; Step 2.5: Combine a three-layer backpropagation neural network to analyze global features. A low-dimensional mapping is performed, where global features pass through the input layer, hidden layer, and output layer of the neural network, resulting in a global feature mapping. Mapping to latent variables z latent variables z The distribution is It follows a normal distribution. The mean is The variance is , For latent variables z distributed.

[0009] In step 3, the distribution of latent variables is optimized by introducing the WGAN-GP network. Adversarial generative training is run within the continuous latent space of the VAE, instead of directly manipulating discrete data. The generator obtains realistic latent vectors, and the VAE decoder converts these vectors into high-fidelity data samples. The WGAN-GP network consists of a generator, a discriminator, and a gradient penalty term. The generator's input is random noise, which is mapped to samples similar to the distribution of real data. The discriminator evaluates whether the input sample is real data or generated data. Finally, the gradient penalty term is used to solve the gradient vanishing / exploding problem. Step 3 is implemented in the following steps: Step 3.1: Given random noise By combining category labels Y With random noise Simultaneously, it serves as a conditional input to the WGAN-GP generator, generating pseudo-latent vectors. ,in, These are the parameters of the WGAN-GP generator, the process of which aims to generate virtual latent vectors indistinguishable from the latent variable z output by the VAE encoder. ; Step 3.2: Input the latent variable z and label Y into the discriminator and output the truth score. Used to distinguish between latent variable z and virtual latent vector Ultimately, high-fidelity latent variables were obtained. ,in, These are discriminator parameters; Step 4 is implemented in the following steps: Generate new samples using high-fidelity latent variables and causal constraints The details are as follows: Step 4.1: Convert the high-fidelity latent variables output by the WGAN-GP network. As input to the VAE decoder; Step 4.2: Add causal constraints to the VAE decoder ,in, As the parent node of the causal graph, Represents the parent node in the cause-effect graph right The impact; Step 4.3: Utilize high-fidelity latent variables Samples generated by causal constraints Through distribution The calculation process is as follows: (1) in, To integrate causal constraints with high-fidelity latent variables The generated sample distribution, The calculation process is as follows: (2) Among them, softmax For activation function, It is the normalized logarithmic value of the conditional probability.

[0010] final, To generate samples The distribution of the generated samples can be seen from formulas (1) and (2). The potential variables of the causal constraints and the mapping of real data are integrated. The causal graph is used to solve the discrete problem of road traffic accident data, and the generation technology is used to solve the problem of uneven distribution of road traffic accident data.

[0011] The beneficial effects of this invention are that it integrates causal constraints and latent variables to generate imbalanced discrete data. In order to improve the structural consistency of generated samples with the causal dependencies of real data, this invention utilizes causal graphs and causal constraints to generate samples in the VAE latent space and a generative adversarial training network. Causal constraints are integrated in the decoder to construct a causal consistent generation path. The mapping relationship between parent and child nodes in the causal graph is learned to ensure that the data generation process conforms to causal logic, solves the problem of imbalanced distribution of discrete traffic accident data, and improves the quality of traffic accident severity datasets. Attached Figure Description

[0012] Figure 1 This is the overall flowchart of the imbalanced discrete data generation method of the present invention, which integrates causal constraints and latent variables; Figure 2 This is the network structure diagram of the imbalanced discrete data generation method that integrates causal constraints and latent variables according to the present invention; Figure 3 This is an example sample of the T-SNE result generated by the imbalanced discrete data generation method of the present invention, which integrates causal constraints and latent variables. Figure 4This is an example of the traffic accident data prediction result generated after the generation of an instance sample of the imbalanced discrete data generation method that integrates causal constraints and latent variables according to the present invention. Detailed Implementation

[0013] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.

[0014] In solving the problem of traffic accident prediction, the collected accident samples are usually imbalanced and discrete data. Compared to ordinary accidents, serious accidents typically occur less frequently, but their fatality rate is much higher. Therefore, to further improve road safety, the key is to first improve the quality of accident samples, making the distribution of samples from different types of accidents more balanced. Based on this, training the accident prediction model using a neural network can produce more accurate prediction results. Therefore, to ensure road safety and reliability, this invention incorporates causal reasoning methods to achieve a balanced sample distribution, thereby improving the quality of accident samples. The main generation process is as follows: First, traffic accident samples are divided into feature... X and category labels Y And use PC algorithm to build data D Cause-and-effect diagram G The adjacency matrix is ​​obtained. A Secondly, combining the adjacency matrix A Features of the original data X The latent variables are obtained by calculating the encoder mapping of the VAE. z Then, the latent variables z and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. Finally, high-fidelity latent variables... As input to the VAE decoder, synthetic data of minority class samples is generated by incorporating causal constraints. Because this invention integrates causal reasoning, the generated samples are more consistent with real-world conditions, improving the quality of traffic accident data and thus enhancing road safety.

[0015] This invention integrates causal constraints and latent variables to generate imbalanced discrete data. The flowchart is as follows: Figure 1 As shown, please follow these steps: Step 1: Collect environmental factors and accident severity data at the location of the road traffic accident and record them as road traffic accident data D, thus establishing road traffic accident data. D Cause-and-effect diagram GThe adjacency matrix is ​​obtained. A ; Step 1 is implemented in the following steps: Step 1.1: Collect environmental factors and accident severity at the location of a road traffic accident using sensors or recorders, and record them as road traffic accident data D. Environmental factors of the traffic accident are represented by characteristics. X This indicates that the severity of the accident is categorized as a label. Y ,in It is a discrete integer sample feature. i =1,..., d , d This is the feature dimension, which is the sum of the number of environmental factors; Indicates the first i Environmental factors in traffic accidents i For environmental factors, Indicates the first i Environmental factors contributing to traffic accidents; Step 1.2: Use the Peter-Clark algorithm (PC) to establish road traffic accident data. D Cause-and-effect diagram G Calculate the features of the original data X The latent causal graph DAG, i.e. ,in, For cause-and-effect diagrams, v It is a set of nodes. v i Data features representing the same dimension x i , E It is a set of directed edges. The existence of directions between nodes indicates causal influence between them. First, the data characteristics are determined by combining conditional independence relationships. X From the causal skeleton graph, we obtain the adjacency matrix A, that is, when any two nodes... If an edge exists, then the adjacency matrix... The corresponding element in is 1, which means that... A When [i,j]=1, there is an edge between the two nodes. Then, through different nodes V The structure is used to obtain data features by combining directional propagation rules. X The latent causal graph DAG, which orients the edge connections between nodes, is calculated using the following V-structure: For any three nodes Satisfying: 1) Node v i and v j There are edges and nodes. v k andv j There are edges ;2) v i and v k No edge ,at the same time, v j Not belonging to v i and v k Subsets S Inside Then the three nodes are V structure: ; Then, the nodes are directed to each other using the directed propagation rules, and the nodes are connected by edges. express right There is a causal relationship, and the nodes... This indicates that two nodes are adjacent but have no causal relationship. The specific orientation rules are as follows: 1) If it exists ,and and If not adjacent, then orientation. ; 2) If it exists And there exists a directed path. Then the orientation ; 3) If a path exists as well as Then the orientation .

[0016] Category labels in step 1 Y = {L1,L2,L3,L4}, where L1, L2, L3, and L4 represent four types of accident severity: minor accident, general accident, relatively serious accident, and severe accident, respectively. Step 2: Feature the raw data X The latent variables are obtained by calculating the encoder mapping of the variational autoencoder (VAE). z ; Step 2 is implemented in the following steps: Step 2.1: The dimension of environmental factors in traffic accidents is d. To improve computational efficiency, this invention uses features of the original data... X Perform embedding mapping to obtain the basic embedding mapping matrix. The calculation process is as follows Where W is the embedding matrix, the embedding matrix W is initialized using a uniform distribution, according to the... i Features xi The category index is used to extract the embedding matrix W row by row to obtain the first category index. i The basic embedding mapping matrix of each feature ; Step 2.2: To integrate the causal dependencies between variables into the original data features, the causal association information of the sample features is quantified using the adjacency matrix A to obtain the causal association embedding matrix. The calculation process is as follows: ,in, It is the first i Causal association embedding matrix of features, For the first i The basic embedding mapping matrix of each feature, A j,i Let be the adjacency matrix, representing the computation of the th adjacency matrix. j The first feature to the first i The causal influence of each characteristic; Step 2.3: Utilize a nonlinear activation function Perform a nonlinear mapping to embed causal relationships into the matrix. Mapping matrix with basic embedding Nonlinear calculations are performed to obtain the final causal perception embedding matrix. The calculation process is as follows: Where k and b are weight parameters, It is a non-linear activation function. For the first i The final causal perception embedding matrix of each feature; Step 2.4: VAE has a powerful encoding and decoding framework that can map input samples into a latent low-dimensional space, improving sample computation efficiency, and then outputting the results through the decoder. First, it maps the input samples according to the feature dimension... d A multi-dimensional causal perception embedding matrix splicing ,Right now , Use the contact function to d A multi-dimensional causal perception embedding matrix Combination, making d A multi-dimensional causal perception embedding matrix Become a global feature ; Step 2.5: Combine a three-layer backpropagation neural network to analyze global features. A low-dimensional mapping is performed, where global features pass through the input layer, hidden layer, and output layer of the neural network, resulting in a global feature mapping. Mapping to latent variables z latent variables z The distribution is It follows a normal distribution. The mean is The variance is , For latent variables z distributed.

[0017] Step 3: Latent variables z and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. ; Step 3 is implemented in the following steps: Considering that GAN networks can obtain relatively accurate generated data through adversarial generative training, this invention introduces a WGAN-GP network to optimize the distribution of latent variables in order to improve the quality of generated samples. Adversarial generative training is run within the continuous latent space of the VAE, rather than directly manipulating discrete data. The generator obtains realistic latent vectors, and the VAE decoder converts these vectors into high-fidelity data samples. The WGAN-GP network consists of a generator, a discriminator, and a gradient penalty term. The generator's input is random noise, which is mapped to samples similar to the distribution of real data. The discriminator evaluates whether the input sample is real or generated data, and finally, the gradient penalty term is used to solve the gradient vanishing / exploding problem. Step 3.1: Given random noise To improve the effectiveness of the generated data, this invention combines category labels. Y With random noise Simultaneously, it serves as a conditional input to the WGAN-GP generator, generating pseudo-latent vectors. ,in, These are the parameters of the WGAN-GP generator, the process of which aims to generate virtual latent vectors indistinguishable from the latent variable z output by the VAE encoder. ; Step 3.2: Input the latent variable z and label Y into the discriminator and output the truth score. Used to distinguish between latent variable z and virtual latent vector Ultimately, high-fidelity latent variables were obtained. ,in, These are discriminator parameters; Step 4: The high-fidelity latent variables from Step 3... As input to the VAE decoder, it is combined with causal constraints to generate synthetic data of minority class samples.

[0018] Step 4 is implemented in the following steps: Generate new samples using high-fidelity latent variables and causal constraints The details are as follows: Step 4.1: Convert the high-fidelity latent variables output by the WGAN-GP network. As input to the VAE decoder; Step 4.2: To ensure that the generated features conform to the causal dependencies of the causal graph, causal constraints are added to the VAE decoder. ,in, As the parent node of the causal graph, Represents the parent node in the cause-effect graph right The impact; Step 4.3: Utilize high-fidelity latent variables Samples generated by causal constraints Through distribution The calculation process is as follows: (1) in, To integrate causal constraints with high-fidelity latent variables The generated sample distribution, The calculation process is as follows: (2) Among them, softmax For activation function, It is the normalized logarithmic value of the conditional probability.

[0019] final, To generate samples The distribution of the generated samples, as seen in formulas (1) and (2), reveals the latent variables that integrate causal constraints and real data mapping. The causal graph is used to address the discreteness of road traffic accident data, and the generation technology solves the problem of uneven distribution of road traffic accident data. Therefore, this invention can solve the problem of uneven discrete distribution of road traffic accident data, obtain new accident generation data of different types, simulate the causal effects of policy intervention, conduct in-depth research on rare but serious accident types, and achieve data-driven precision traffic safety management.

[0020] Example 1 This invention integrates causal constraints and latent variables to generate imbalanced discrete data. The flowchart is as follows: Figure 1 As shown, please follow these steps: Step 1: Collect environmental factors and accident severity data at the location of the road traffic accident and record them as road traffic accident data D, thus establishing road traffic accident data. DCause-and-effect diagram G The adjacency matrix is ​​obtained. A ; Step 2: Feature the raw data X The latent variables are obtained by calculating the encoder mapping of the variational autoencoder (VAE). z ; Step 3: Latent variables z and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. ; Step 4: The high-fidelity latent variables from Step 3... As input to the VAE decoder, it is combined with causal constraints to generate synthetic data of minority class samples.

[0021] Example 2 This invention integrates causal constraints and latent variables to generate imbalanced discrete data. The flowchart is as follows: Figure 1 As shown, please follow these steps: Step 1: Collect environmental factors and accident severity data at the location of the road traffic accident and record them as road traffic accident data D, thus establishing road traffic accident data. D Cause-and-effect diagram G The adjacency matrix is ​​obtained. A ; Step 1 is implemented in the following steps: Step 1.1: Collect environmental factors and accident severity at the location of a road traffic accident using sensors or recorders, and record them as road traffic accident data D. Environmental factors of the traffic accident are represented by characteristics. X This indicates that the severity of the accident is categorized as a label. Y ,in It is a discrete integer sample feature. i =1,..., d , d This is the feature dimension, which is the sum of the number of environmental factors; Indicates the first i Environmental factors in traffic accidents i For environmental factors, Indicates the first i Environmental factors contributing to traffic accidents; Step 1.2: Use the Peter-Clark algorithm (PC) to establish road traffic accident data. D Cause-and-effect diagramG Calculate the features of the original data X The latent causal graph DAG, i.e. ,in, For cause-and-effect diagrams, v It is a set of nodes. v i Data features representing the same dimension x i , E It is a set of directed edges. The existence of directions between nodes indicates causal influence between them. First, the data characteristics are determined by combining conditional independence relationships. X From the causal skeleton graph, we obtain the adjacency matrix A, that is, when any two nodes... If an edge exists, then the adjacency matrix... The corresponding element in is 1, which means that... A When [i,j]=1, there is an edge between the two nodes. Then, through different nodes V The structure is used to obtain data features by combining directional propagation rules. X The latent causal graph DAG, which orients the edge connections between nodes, is calculated using the following V-structure: For any three nodes Satisfying: 1) Node v i and v j There are edges and nodes. v k and v j There are edges ;2) v i and v k No edge ,at the same time, v j Not belonging to v i and v k Subsets S Inside Then the three nodes are V structure: ; Then, the nodes are directed to each other using the directed propagation rules, and the nodes are connected by edges. express right There is a causal relationship, and the nodes... This indicates that two nodes are adjacent but have no causal relationship. The specific orientation rules are as follows: 1) If it exists ,and and If not adjacent, then orientation. ; 2) If it exists And there exists a directed path. Then the orientation ; 3) If a path exists as well as Then the orientation .

[0022] Step 2: Feature the raw data X The latent variables are obtained by calculating the encoder mapping of the variational autoencoder (VAE). z ; Step 3: Latent variables z and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. ; Step 4: The high-fidelity latent variables from Step 3... As input to the VAE decoder, it is combined with causal constraints to generate synthetic data of minority class samples.

[0023] Example 3 This invention integrates causal constraints and latent variables to generate imbalanced discrete data. The flowchart is as follows: Figure 1 As shown, please follow these steps: Step 1: Collect environmental factors and accident severity data at the location of the road traffic accident and record them as road traffic accident data D, thus establishing road traffic accident data. D Cause-and-effect diagram G The adjacency matrix is ​​obtained. A ; Step 1 is implemented in the following steps: Step 1.1: Collect environmental factors and accident severity at the location of a road traffic accident using sensors or recorders, and record them as road traffic accident data D. Environmental factors of the traffic accident are represented by characteristics. X This indicates that the severity of the accident is categorized as a label. Y ,in It is a discrete integer sample feature. i =1,..., d , d This is the feature dimension, which is the sum of the number of environmental factors; Indicates the firsti Environmental factors in traffic accidents i For environmental factors, Indicates the first i Environmental factors contributing to traffic accidents; Step 1.2: Use the Peter-Clark algorithm (PC) to establish road traffic accident data. D Cause-and-effect diagram G Calculate the features of the original data X The latent causal graph DAG, i.e. ,in, For cause-and-effect diagrams, v It is a set of nodes. v i Data features representing the same dimension x i , E It is a set of directed edges. The existence of directions between nodes indicates causal influence between them. First, the data characteristics are determined by combining conditional independence relationships. X From the causal skeleton graph, we obtain the adjacency matrix A, that is, when any two nodes... If an edge exists, then the adjacency matrix... The corresponding element in is 1, which means that... A When [i,j]=1, there is an edge between the two nodes. Then, through different nodes V The structure is used to obtain data features by combining directional propagation rules. X The latent causal graph DAG, which orients the edge connections between nodes, is calculated using the following V-structure: For any three nodes Satisfying: 1) Node v i and v j There are edges and nodes. v k and v j There are edges ;2) v i and v k No edge ,at the same time, v j Not belonging to v i and v k Subsets S Inside Then the three nodes are V structure: ; Then, the nodes are directed to each other using the directed propagation rules, and the nodes are connected by edges. express right There is a causal relationship, and the nodes... This indicates that two nodes are adjacent but have no causal relationship. The specific orientation rules are as follows: 1) If it exists ,and and If not adjacent, then orientation. ; 2) If it exists And there exists a directed path. Then the orientation ; 3) If a path exists as well as Then the orientation .

[0024] Category labels in step 1 Y = {L1,L2,L3,L4}, where L1, L2, L3, and L4 represent four types of accident severity: minor accident, general accident, relatively serious accident, and severe accident, respectively. Step 2: Feature the raw data X The latent variables are obtained by calculating the encoder mapping of the variational autoencoder (VAE). z ; Step 2 is implemented in the following steps: Step 2.1: The dimension of environmental factors in traffic accidents is d. To improve computational efficiency, this invention uses features of the original data... X Perform embedding mapping to obtain the basic embedding mapping matrix. The calculation process is as follows Where W is the embedding matrix, the embedding matrix W is initialized using a uniform distribution, according to the... i Features x i The category index is used to extract the embedding matrix W row by row to obtain the first category index. i The basic embedding mapping matrix of each feature ; Step 2.2: To integrate the causal dependencies between variables into the original data features, the causal association information of the sample features is quantified using the adjacency matrix A to obtain the causal association embedding matrix. The calculation process is as follows: ,in, It is the first i Causal association embedding matrix of features, For the first i The basic embedding mapping matrix of each feature,A j,i Let be the adjacency matrix, representing the computation of the th adjacency matrix. j The first feature to the first i The causal influence of each characteristic; Step 2.3: Utilize a nonlinear activation function Perform a nonlinear mapping to embed causal relationships into the matrix. Mapping matrix with basic embedding Nonlinear calculations are performed to obtain the final causal perception embedding matrix. The calculation process is as follows: Where k and b are weight parameters, It is a non-linear activation function. For the first i The final causal perception embedding matrix of each feature; Step 2.4: VAE has a powerful encoding and decoding framework that can map input samples into a latent low-dimensional space, improving sample computation efficiency, and then outputting the results through the decoder. First, it maps the input samples according to the feature dimension... d A multi-dimensional causal perception embedding matrix splicing ,Right now , Use the contact function to d A multi-dimensional causal perception embedding matrix Combination, making d A multi-dimensional causal perception embedding matrix Become a global feature ; Step 2.5: Combine a three-layer backpropagation neural network to analyze global features. A low-dimensional mapping is performed, where global features pass through the input layer, hidden layer, and output layer of the neural network, resulting in a global feature mapping. Mapping to latent variables z latent variables z The distribution is It follows a normal distribution. The mean is The variance is , For latent variables z distributed.

[0025] Step 3: Latent variables z and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. ; Step 4: The high-fidelity latent variables from Step 3... As input to the VAE decoder, it is combined with causal constraints to generate synthetic data of minority class samples.

[0026] Example 4 This invention integrates causal constraints and latent variables to generate imbalanced discrete data. The flowchart is as follows: Figure 1 As shown, please follow these steps: Step 1: Collect environmental factors and accident severity data at the location of the road traffic accident and record them as road traffic accident data D, thus establishing road traffic accident data. D Cause-and-effect diagram G The adjacency matrix is ​​obtained. A ; Step 1 is implemented in the following steps: Step 1.1: Collect environmental factors and accident severity at the location of a road traffic accident using sensors or recorders, and record them as road traffic accident data D. Environmental factors of the traffic accident are represented by characteristics. X This indicates that the severity of the accident is categorized as a label. Y ,in It is a discrete integer sample feature. i =1,..., d , d This is the feature dimension, which is the sum of the number of environmental factors; Indicates the first i Environmental factors in traffic accidents i For environmental factors, Indicates the first i Environmental factors contributing to traffic accidents; Step 1.2: Use the Peter-Clark algorithm (PC) to establish road traffic accident data. D Cause-and-effect diagram G Calculate the features of the original data X The latent causal graph DAG, i.e. ,in, For cause-and-effect diagrams, v It is a set of nodes. v i Data features representing the same dimension x i , E It is a set of directed edges. The existence of directions between nodes indicates causal influence between them. First, the data characteristics are determined by combining conditional independence relationships. X From the causal skeleton graph, we obtain the adjacency matrix A, that is, when any two nodes... If an edge exists, then the adjacency matrix... The corresponding element in is 1, which means that... A When [i,j]=1, there is an edge between the two nodes. Then, through different nodes V The structure is used to obtain data features by combining directional propagation rules. X The latent causal graph DAG, which orients the edge connections between nodes, is calculated using the following V-structure: For any three nodes Satisfying: 1) Node v i and v j There are edges and nodes. v k and v j There are edges ;2) v i and v k No edge ,at the same time, v j Not belonging to v i and v k Subsets S Inside Then the three nodes are V structure: ; Then, the nodes are directed to each other using the directed propagation rules, and the nodes are connected by edges. express right There is a causal relationship, and the nodes... This indicates that two nodes are adjacent but have no causal relationship. The specific orientation rules are as follows: 1) If it exists ,and and If not adjacent, then orientation. ; 2) If it exists And there exists a directed path. Then the orientation ; 3) If a path exists as well as Then the orientation .

[0027] Category labels in step 1 Y = {L1,L2,L3,L4}, where L1, L2, L3, and L4 represent four types of accident severity: minor accident, general accident, relatively serious accident, and severe accident, respectively. Step 2: Feature the raw data X The latent variables are obtained by calculating the encoder mapping of the variational autoencoder (VAE). z ; Step 2 is implemented in the following steps: Step 2.1: The dimension of environmental factors in traffic accidents is d. To improve computational efficiency, this invention uses features of the original data... X Perform embedding mapping to obtain the basic embedding mapping matrix. The calculation process is as follows Where W is the embedding matrix, the embedding matrix W is initialized using a uniform distribution, according to the... i Features x i The category index is used to extract the embedding matrix W row by row to obtain the first category index. i The basic embedding mapping matrix of each feature ; Step 2.2: To integrate the causal dependencies between variables into the original data features, the causal association information of the sample features is quantified using the adjacency matrix A to obtain the causal association embedding matrix. The calculation process is as follows: ,in, It is the first i Causal association embedding matrix of features, For the first i The basic embedding mapping matrix of each feature, A j,i Let be the adjacency matrix, representing the computation of the th adjacency matrix. j The first feature to the first i The causal influence of each characteristic; Step 2.3: Utilize a nonlinear activation function Perform a nonlinear mapping to embed causal relationships into the matrix. Mapping matrix with basic embedding Nonlinear calculations are performed to obtain the final causal perception embedding matrix. The calculation process is as follows: Where k and b are weight parameters, It is a non-linear activation function. For the first i The final causal perception embedding matrix of each feature; Step 2.4: VAE has a powerful encoding and decoding framework that can map input samples into a latent low-dimensional space, improving sample computation efficiency, and then outputting the results through the decoder. First, it maps the input samples according to the feature dimension... d A multi-dimensional causal perception embedding matrix splicing ,Right now ,Use the contact function to d A multi-dimensional causal perception embedding matrix Combination, making d A multi-dimensional causal perception embedding matrix Become a global feature ; Step 2.5: Combine a three-layer backpropagation neural network to analyze global features. A low-dimensional mapping is performed, where global features pass through the input layer, hidden layer, and output layer of the neural network, resulting in a global feature mapping. Mapping to latent variables z latent variables z The distribution is It follows a normal distribution. The mean is The variance is , For latent variables z distributed.

[0028] Step 3: Latent variables z and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. ; Step 3 is implemented in the following steps: Considering that GAN networks can obtain relatively accurate generated data through adversarial generative training, this invention introduces a WGAN-GP network to optimize the distribution of latent variables in order to improve the quality of generated samples. Adversarial generative training is run within the continuous latent space of the VAE, rather than directly manipulating discrete data. The generator obtains realistic latent vectors, and the VAE decoder converts these vectors into high-fidelity data samples. The WGAN-GP network consists of a generator, a discriminator, and a gradient penalty term. The generator's input is random noise, which is mapped to samples similar to the distribution of real data. The discriminator evaluates whether the input sample is real or generated data, and finally, the gradient penalty term is used to solve the gradient vanishing / exploding problem. Step 3.1: Given random noise To improve the effectiveness of the generated data, this invention combines category labels. Y With random noise Simultaneously, it serves as a conditional input to the WGAN-GP generator, generating pseudo-latent vectors. ,in, These are the parameters of the WGAN-GP generator, the process of which aims to generate virtual latent vectors indistinguishable from the latent variable z output by the VAE encoder. ; Step 3.2: Input the latent variable z and label Y into the discriminator and output the truth score. Used to distinguish between latent variable z and virtual latent vector Ultimately, high-fidelity latent variables were obtained. ,in, These are discriminator parameters; Step 4: The high-fidelity latent variables from Step 3... As input to the VAE decoder, it is combined with causal constraints to generate synthetic data of minority class samples.

[0029] Example 5 This invention integrates causal constraints and latent variables to generate imbalanced discrete data. The flowchart is as follows: Figure 1 As shown, please follow these steps: Step 1: Collect environmental factors and accident severity data at the location of the road traffic accident and record them as road traffic accident data D, thus establishing road traffic accident data. D Cause-and-effect diagram G The adjacency matrix is ​​obtained. A ; Step 1 is implemented in the following steps: Step 1.1: Collect environmental factors and accident severity at the location of a road traffic accident using sensors or recorders, and record them as road traffic accident data D. Environmental factors of the traffic accident are represented by characteristics. X This indicates that the severity of the accident is categorized as a label. Y ,in It is a discrete integer sample feature. i =1,..., d , d This is the feature dimension, which is the sum of the number of environmental factors; Indicates the first i Environmental factors in traffic accidents i For environmental factors, Indicates the first i Environmental factors contributing to traffic accidents; Step 1.2: Use the Peter-Clark algorithm (PC) to establish road traffic accident data. D Cause-and-effect diagram G Calculate the features of the original data X The latent causal graph DAG, i.e. ,in, For cause-and-effect diagrams, v It is a set of nodes.v i Data features representing the same dimension x i , E It is a set of directed edges. The existence of directions between nodes indicates causal influence between them. First, the data characteristics are determined by combining conditional independence relationships. X From the causal skeleton graph, we obtain the adjacency matrix A, that is, when any two nodes... If an edge exists, then the adjacency matrix... The corresponding element in is 1, which means that... A When [i,j]=1, there is an edge between the two nodes. Then, through different nodes V The structure is used to obtain data features by combining directional propagation rules. X The latent causal graph DAG, which orients the edge connections between nodes, is calculated using the following V-structure: For any three nodes Satisfying: 1) Node v i and v j There are edges and nodes. v k and v j There are edges ;2) v i and v k No edge ,at the same time, v j Not belonging to v i and v k Subsets S Inside Then the three nodes are V structure: ; Then, the nodes are directed to each other using the directed propagation rules, and the nodes are connected by edges. express right There is a causal relationship, and the nodes... This indicates that two nodes are adjacent but have no causal relationship. The specific orientation rules are as follows: 1) If it exists ,and and If not adjacent, then orientation. ; 2) If it exists And there exists a directed path. Then the orientation ; 3) If a path exists as well as Then the orientation .

[0030] Category labels in step 1 Y = {L1,L2,L3,L4}, where L1, L2, L3, and L4 represent four types of accident severity: minor accident, general accident, relatively serious accident, and severe accident, respectively. Step 2: Feature the raw data X The latent variables are obtained by calculating the encoder mapping of the variational autoencoder (VAE). z ; Step 2 is implemented in the following steps: Step 2.1: The dimension of environmental factors in traffic accidents is d. To improve computational efficiency, this invention uses features of the original data... X Perform embedding mapping to obtain the basic embedding mapping matrix. The calculation process is as follows Where W is the embedding matrix, the embedding matrix W is initialized using a uniform distribution, according to the... i Features x i The category index is used to extract the embedding matrix W row by row to obtain the first category index. i The basic embedding mapping matrix of each feature ; Step 2.2: To integrate the causal dependencies between variables into the original data features, the causal association information of the sample features is quantified using the adjacency matrix A to obtain the causal association embedding matrix. The calculation process is as follows: ,in, It is the first i Causal association embedding matrix of features, For the first i The basic embedding mapping matrix of each feature, A j,i Let be the adjacency matrix, representing the computation of the th adjacency matrix. j The first feature to the first i The causal influence of each characteristic; Step 2.3: Utilize a nonlinear activation function Perform a nonlinear mapping to embed causal relationships into the matrix. Mapping matrix with basic embedding Nonlinear calculations are performed to obtain the final causal perception embedding matrix. The calculation process is as follows: Where k and b are weight parameters, It is a non-linear activation function. For the first i The final causal perception embedding matrix of each feature; Step 2.4: VAE has a powerful encoding and decoding framework that can map input samples into a latent low-dimensional space, improving sample computation efficiency, and then outputting the results through the decoder. First, it maps the input samples according to the feature dimension... d A multi-dimensional causal perception embedding matrix splicing ,Right now , Use the contact function to d A multi-dimensional causal perception embedding matrix Combination, making d A multi-dimensional causal perception embedding matrix Become a global feature ; Step 2.5: Combine a three-layer backpropagation neural network to analyze global features. A low-dimensional mapping is performed, where global features pass through the input layer, hidden layer, and output layer of the neural network, resulting in a global feature mapping. Mapping to latent variables z latent variables z The distribution is It follows a normal distribution. The mean is The variance is , For latent variables z distributed.

[0031] Step 3: Latent variables z and category labels Y As input to the WGAN-GP network generator, virtual latent variables are obtained. Then, combined with the discriminator, the authenticity score is output. Di Distinguishing latent variables z and dummy latent variables High-fidelity latent variables were obtained. ; Step 3.1: Given random noise To improve the effectiveness of the generated data, this invention combines category labels. Y With random noise Simultaneously, it serves as a conditional input to the WGAN-GP generator, generating pseudo-latent vectors. ,in, These are the parameters of the WGAN-GP generator, the process of which aims to generate virtual latent vectors indistinguishable from the latent variable z output by the VAE encoder. ; Step 3.2: Input the latent variable z and label Y into the discriminator and output the truth score. Used to distinguish between latent variable z and virtual latent vector Ultimately, high-fidelity latent variables were obtained. ,in, These are discriminator parameters; Step 4: The high-fidelity latent variables from Step 3... As input to the VAE decoder, it is combined with causal constraints to generate synthetic data of minority class samples.

[0032] Step 4 is implemented in the following steps: Generate new samples using high-fidelity latent variables and causal constraints The details are as follows: Step 4.1: Convert the high-fidelity latent variables output by the WGAN-GP network. As input to the VAE decoder; Step 4.2: To ensure that the generated features conform to the causal dependencies of the causal graph, causal constraints are added to the VAE decoder. ,in, As the parent node of the causal graph, Represents the parent node in the cause-effect graph right The impact; Step 4.3: Utilize high-fidelity latent variables Samples generated by causal constraints Through distribution The calculation process is as follows: (1) in, To integrate causal constraints with high-fidelity latent variables The generated sample distribution, The calculation process is as follows: (2) Among them, softmax For activation function, It is the normalized logarithmic value of the conditional probability.

[0033] final, To generate samples The distribution of the generated samples can be seen from formulas (1) and (2). The potential variables of the causal constraints and the mapping of real data are integrated. The causal graph is used to solve the discrete problem of road traffic accident data, and the generation technology is used to solve the problem of uneven distribution of road traffic accident data.

[0034] Example 6 To verify the feasibility of this invention, it is further described in conjunction with the embodiments and accompanying drawings. The traffic accident data selected in this study is real data from Chili town, Monroe County, New York, downloaded from the U.S. government website. The accident severity in this data is categorized into four levels: general accidents, major accidents, serious accidents, and catastrophic accidents. The imbalance rate is 180.625 (the ratio of general accident samples to catastrophic accident samples), clearly indicating an extremely imbalanced and representative accident sample. This sample contains multiple features, such as light intensity, road type, and weather conditions. This invention uses the distribution mapping results of T-SNE as an example to explain the effectiveness of the method of this invention.

[0035] Accident samples were generated using Python software. The accident data for Chili town is 1112 in size, and the data characteristics are as follows. X There are 10 dimensions in total, namely, d =10, representing: accident time, accident date, day of the week, light intensity, collision type, road conditions, weather conditions, road surface conditions, pedestrian status, number of vehicles involved in the accident, and accident severity category. Y =4, representing minor accidents, general accidents, serious accidents, and catastrophic accidents respectively. The imbalance rate (ratio of minor accident samples to catastrophic accident samples) is 180.625, as shown in... Figure 2 The network framework shown yields the following results: Figure 3 The T-SNE generation results shown are as follows: Figure 3 The left image shows the mapping of different categories of samples from the original data into a two-dimensional space. Different categories correspond to different colors. The left image clearly shows that the number of light-colored category 3 samples is very small (the proportion of catastrophic accidents is extremely small), indicating the imbalanced distribution of the original data. The right image shows the distribution of different categories of generated samples in two-dimensional space. Clearly, the proportion of category 3 has gradually increased, resolving the imbalanced distribution problem of the original data. At the same time, it did not affect the number of original multi-class samples (category 0). A convolutional neural network is used to verify accident prediction on the enhanced data, such as... Figure 4 As shown, Figure 4 The method includes a confusion matrix and an ROC curve. A larger diagonal line in the confusion matrix indicates a better prediction result; a ROC curve closer to the top left corner also indicates a better prediction result. Experimental results show that the method of this invention can enhance the data features corresponding to different categories and further improve the accuracy of accident prediction, effectively improving the quality of discrete imbalanced data.

Claims

1. A method of generating unbalanced discrete data that fuse causal constraints with latent variables, characterized in that, The step 1 is implemented specifically according to the following steps: Step 1, collect the environmental factors of the road traffic accident occurrence point and the accident severity, and record as road traffic accident data D, establish the road traffic accident data D Causal diagram G , get the adjacency matrix A ; Step 2, Feature the raw data X Through mapping calculations, get latent variables z ; Step 3, combine discriminator output authenticity score Di Discriminating latent variables z And virtual latent variables , resulting in high-fidelity latent variables ; Step 4, high-fidelity latent variables As input to the VAE decoder, the few-shot sample synthesis data is generated in conjunction with the causal constraints.

2. The method of claim 1, wherein the unbalanced discrete data generation method fuses the causal constraints and the latent variables. The step 1 is implemented specifically according to the following steps: Step 1.1, Collecting the environmental factors of the road traffic accident occurrence point and the severity of the accident by sensors or recorders, and recording as road traffic accident data D, the traffic accident environmental factors are represented by features X , and the severity of the accident is a category label Y , where is a discrete integer sample feature, i = 1, …, d , d is the feature dimension, that is, the total number of environmental factors; represents the i environmental factor of the traffic accident, i is the number of environmental factors, represents the i environmental factor of the traffic accident; Step 1.2: Establish road traffic accident data using the Peter-Clark algorithm. D Cause-and-effect diagram G Calculate the features of the original data X The latent causal graph DAG, i.e. ,in, For cause-and-effect diagrams, v It is a set of nodes. v i Data features representing the same dimension x i , E It is a set of directed edges. The existence of directions between nodes indicates causal influence between them. First, the data characteristics are determined by combining conditional independence relationships. X From the causal skeleton graph, we obtain the adjacency matrix A, that is, when any two nodes... If an edge exists, then the adjacency matrix... The corresponding element in is 1, which means that... A When [i,j]=1, there is an edge between the two nodes. Then, through different nodes V The structure is used to obtain data features by combining directional propagation rules. X The latent causal graph DAG, which orients the edge connections between nodes, is calculated using the following V-structure: For any three nodes , satisfying: 1) nodes v i and v j exist edges, nodes v k and v j exist edges ; 2) v i and v k do not exist edges , and, v j do not belong to v i and v k constitute a subset S , then the three nodes are V structure: ;​ Then, the nodes are oriented between each other by the oriented propagation rule, and the node edges are connected denotes has a causal influence on the node has a causal influence on the node denotes that the two nodes are adjacent but have no causal influence.

3. The method of claim 2, wherein, The category label in step 1 Y = {L1, L2, L3, L4}, L1, L2, L3, L4 represent four types of accident severity respectively: minor accident, general accident, heavier accident, serious accident.

4. The method of claim 3, wherein, The orientation rule in the step 1 is specifically as follows: 1) if there is , and is not adjacent to , then orient ; 2) if exists , and there exists a directed path , then orient ; 3) If there is a path and then orient .

5. The method of claim 4, wherein the unbalanced discrete data generation method fuses the causal constraints and the latent variables. The step 2 is implemented specifically according to the following steps: Step 2.1, the traffic accident environmental factor dimension is d, the original data characteristics are embedded and mapped to obtain a basic embedding mapping matrix X , the calculation process is , wherein W is an embedding matrix, the embedding matrix W is initialized by using a uniform distribution, according to a category index of the first i characteristic x i , the embedding matrix W is extracted by rows to obtain a basic embedding mapping matrix i of the first characteristic ;​ Step 2.2: To integrate the causal dependencies between variables into the original data features, the causal association information of the sample features is quantified using the adjacency matrix A to obtain the causal association embedding matrix. The calculation process is as follows: ,in, It is the first i Causal association embedding matrix of features, For the first i The basic embedding mapping matrix of each feature, A j,i Let be the adjacency matrix, representing the computation of the th adjacency matrix. j The first feature to the first i The causal influence of each characteristic; Step 2.

3. Utilizing a non-linear activation function performing a non-linear mapping to embed the causal associations into a matrix with the base embedding mapping matrix performing a non-linear computation to obtain a final causal-aware embedding matrix , the computation process is: where k and b are weight parameters, is a non-linear activation function, is the final causal-aware embedding matrix for the i th feature; Step 2.

4. Concatenate the causal-aware embedding matrices of the individual dimensions first by feature dimension d i.e. , d d ;​​​​​​​ Step 2.

5. Mapping global features into latent variables with a three-layer backpropagation neural network z z z ​​​​​​​​​ 6. The method of claim 5, wherein the unbalanced discrete data generation method fuses the causal constraints and the latent variables. In the step 3, the latent variable distribution is optimized by introducing a WGAN-GP network, and the adversarial generation training is run in the continuous latent space of the VAE, instead of directly operating on discrete data, so as to obtain realistic latent vectors by using the generator, and the decoder of the VAE converts the vectors into high-fidelity data samples, the WGAN-GP network is composed of a generator, a discriminator and a gradient penalty term, the input of the generator is random noise, and the random noise is mapped into samples similar to the real data distribution; the discriminator evaluates the authenticity of the input sample as real data or generated data, and finally the gradient penalty term is used to solve the gradient vanishing / explosion problem.

7. The method of claim 6, wherein the unbalanced discrete data generation method fuses the causal constraints and the latent variables. The step 3 is implemented specifically according to the following steps: Step 3.1, Given random noise by combining the class label Y with the random noise as a conditional input to the WGAN-GP generator, generating pseudo-latent vectors where, is the parameter of the WGAN-GP generator, the process aims to generate virtual latent vectors indistinguishable from the latent variable z output by the VAE encoder ; Step 3.2, input latent variable z and label Y into the discriminator, output authenticity score to distinguish latent variable z from virtual latent vector to obtain high-fidelity latent variable wherein, is the discriminator parameter.

8. The method of claim 7, wherein the unbalanced discrete data generation method fuses the causal constraints and the latent variables. The step 4 is implemented specifically according to the following steps: Generating new samples with high fidelity latent variables and causal constraints , as follows: Step 4.1, high-fidelity latent variable output by the WGAN-GP network as input to the VAE decoder; Step 4.

2. Incorporating causal constraints in the VAE decoder where, is the causal graph parent node, represents the causal graph parent node influence on . Step 4.3, Utilizing High Fidelity Latent Variables Generating samples with causal constraints , by distribution representations, the computational process is as follows: (1) wherein, to fuse causal constraints with high-fidelity latent variables of the generated sample distribution, The computational procedure is as follows: (2) where softmax is an activation function, is the normalized conditional probability log value, Finally, To generate samples of the distribution, from formulas (1) and (2), it can be seen that the generated samples integrate the potential variables of causal constraints and real data mapping, use the causal diagram to solve the discrete problem of road traffic accident data, and use the generation technology to solve the problem of uneven distribution of road traffic accident data.