Train delay data generation method based on improved CTGAN
By improving the CTGAN model and combining it with the Transformer and CNN structures, high-quality and diverse train delay data is generated, solving the data scarcity problem and improving the effectiveness of train operation analysis and prediction.
Patent Information
- Application Number
- CN202510653355.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2045-05-21
AI Technical Summary
Train delay data is scarce, and existing technologies make it difficult to generate high-quality and diverse delay data, which affects the effectiveness of data-driven train operation analysis and prediction.
The improved CTGAN model is used, combined with the Transformer encoding layer and CNN structure, to capture the spatiotemporal feature relationships of train delay data and generate high-quality delay data.
The generated delay data is highly realistic and diverse, and can effectively expand the data set and enhance the data support capabilities for train delay prediction and scheduling optimization.
Smart Images

Figure CN120409277B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of railway traffic dispatching and relates to a method for generating train delay data based on an improved CTGAN. Background Art
[0002] With the rapid development of high-speed railways, the application of train operation data is becoming increasingly widespread. Train delay data, as a key piece of operational data, is of great value for train operation analysis, scheduling optimization, and improving service quality. However, in actual operations, trains generally run on time, and delay data is relatively scarce, especially data on significant delays. This data scarcity limits the performance of data-driven train delay analysis and application models.
[0003] To address the problem of scarce train delay data, the following methods are commonly used in existing technologies:
[0004] 1. Data augmentation techniques: For example, this approach increases the amount of data by performing operations such as translation, scaling, and noise addition on existing delay data. However, this method generates data with limited diversity and is unable to capture the distribution characteristics of real delay data.
[0005] 2. Simulation model generation: By building a train operation simulation model, we can simulate delays in different operation scenarios. However, simulation models have difficulty accurately modeling complex operating environments, and data authenticity cannot be guaranteed.
[0006] 3. Traditional statistical methods: Statistical models (such as Gaussian mixture models and hidden Markov models) are used to learn the distribution of latent data and generate synthetic data. However, traditional statistical models have limited ability to model high-dimensional and complex distributed data, resulting in low-quality data.
[0007] In recent years, generative adversarial networks (GANs), as powerful deep generative models, have achieved remarkable results in fields such as images and text. GAN models are capable of learning the complex distribution of real-world data and generating high-quality synthetic data. Conditional Tabular Generative Adversarial Networks (CTGANs), a variant of GANs, are specifically designed to process tabular data and effectively capture the mixed distribution of discrete and continuous variables in tabular data. However, for train delay data, which involves temporal correlations and complex operational scenario constraints, the generator in traditional CTGANs uses only convolutional neural networks, which are insufficient for processing complex spatiotemporal mixed data sequences. Considering improving the generator structure to incorporate a network that is adept at processing complex relational sequences as the underlying architecture for generating train delay data, it is possible to consider implementing this architecture. Summary of the Invention
[0008] The purpose of this paper is to overcome the shortcomings of the existing train delay data generation methods in the art and propose an improved train delay data generation method based on CTGAN. The method aims to generate high-quality train delay data based on different train operation scenarios, thereby solving the problem of train delay data scarcity and providing data support for subsequent data-driven train delay prediction.
[0009] The present invention is achieved by the following technical solutions:
[0010] S100: Collects raw train delay data, extracts arrival delay time series for multiple consecutive stations, calculates delay increments for adjacent stations, constructs operational scenario features, and designs input data formats that include discrete conditional columns and continuous variables.
[0011] S200: Build an improved CTGAN model by adding a Transformer encoding layer to the CNN model. Use the self-attention mechanism to capture the spatiotemporal relationship between train arrival delay time series and operational scenario features. Configure training parameters and train the model.
[0012] S300: Use the trained model to generate delay increment features and initial station data to reconstruct the complete delay time series;
[0013] S400: Verify the quality of synthetic data through statistical similarity, distribution similarity and prediction effect.
[0014] Furthermore, the step S100 includes:
[0015] Step S110: Extract the arrival delay time series data of each train at multiple consecutive stations on a line. Select the arrival delay time of the 1st, 2nd, 3rd, 4th, 5th, and 6th stations that the train passes through in sequence as the original features.
[0016] Step S120: Calculate the incremental delay time of the train between adjacent stations, retain the initial station delay time (1 station delay) and incremental features, and remove the original station data to reduce redundancy.
[0017] Step S130: Using train operation knowledge rules and combining with the original train feature data, construct operation scenario feature indicators such as whether the train delay is propagated, the degree of train delay and the train delay starting interval.
[0018] Step S140: Design the model input data format. Train operation scenario characteristics (whether train delays are propagated, the degree of train delays, and the starting interval of train delays) are one-hot encoded as discrete conditional columns to ensure that the model can distinguish different scenario categories. The initial station delay time (1 station delay) and incremental features are input into the CTGAN model as continuous variables.
[0019] Further, the step S200 comprises:
[0020] Step S210: Add the Transformer structure to the traditional discriminator network structure CNN (Convolutional Neural Network) of the CTGAN model to form an improved CTGAN model. The self-attention mechanism in the Transformer better understands the spatio-temporal relationship between the late departure time continuous variable and the scene feature discrete variable in the train late departure data, so that the improved generator network is used to generate train late departure data, and the discriminator network is used to distinguish between real data and data generated by the generator. The generator and the discriminator work together to make the generated data continuously approach the real data.
[0021] Step S220: Configure the training parameters of the improved CTGAN model according to the train late departure input data features, including the generator type, the learning rate, the number of training epochs, the batch size, etc.
[0022] Step S230: Use the train late departure input data prepared in step S130, encode the scene feature data as discrete variables, and train the CTGAN model. In the training process, the generator network and the discriminator network are mutually opposed, and the model parameters are continuously optimized. After reaching the maximum number of training epochs, stop.
[0023] Further, the step S300 comprises:
[0024] Step S310: Use the trained improved CTGAN model to randomly generate a specified number of synthetic late departure increment feature data, as well as the late departure time data of the first station and the running scene feature data.
[0025] Step S320: Reconstruct the original late departure data from the increment feature data. According to the generated late departure time of the first station and the late departure increment data of the subsequent stations, the late departure time of the subsequent stations is calculated by station-by-station back calculation.
[0026] Step S330: Save the reconstructed synthetic late departure data as a file in a specified format.
[0027] Further, the step S400 comprises:
[0028] Step S410: Calculate the statistical similarity score of the index evaluation model. Measure the similarity of the synthetic data and the real data in statistical characteristics such as mean and variance.
[0029] Step S420: Calculate the similarity score of the distribution of the synthetic data and the real data.
[0030] Step S430: Design an experiment to verify the practicality of the generated data. The generated data and real data are used as training sets to train the train delay prediction model. A test set is randomly selected from 15% of the original train data by month. The delay prediction performance of the fused data and the original data used as the training set is compared.
[0031] The present invention also discloses a train delay data generation system, which is based on the above method and is characterized by comprising:
[0032] Data preprocessing module: used to extract site delay time, calculate incremental features, construct scenario features, and encode them;
[0033] Improved CTGAN model module: including adding Transformer generator and CNN discriminator, and configuring training parameters;
[0034] Data generation module: reconstructs the complete delay sequence based on the model output;
[0035] Quality assessment module: Verify the statistical, distribution characteristics and predictive practicality of synthetic data.
[0036] The present invention also discloses a non-volatile storage medium, characterized in that the non-volatile storage medium includes a stored program, wherein when the program is run, it controls the device where the non-volatile storage medium is located to execute the above method.
[0037] The present invention also discloses an electronic device, characterized in that it includes a processor and a memory; the memory stores computer-readable instructions, and the processor is used to run the computer-readable instructions, wherein the computer-readable instructions execute the above method when running.
[0038] Beneficial effects:
[0039] 1. High-quality data generation: The improved CTGAN model can effectively learn the interrelationships and complex distribution characteristics of train delay data, generating high-quality, highly realistic synthetic delay data that better reflects the logical relationships, statistical characteristics, and distribution patterns of real delay data.
[0040] 2. Diversified data generation: The generation mechanism of the GAN model ensures that the synthetic data has good diversity. It can generate synthetic data covering a wider data space and richer late-night scenarios, overcoming the problem of data homogeneity generated by traditional data augmentation methods.
[0041] 3. Application of incremental and scenario features: By constructing and utilizing features such as delay increments and operational scenarios, the improved CTGAN model can better capture the propagation and evolution of train delays between stations. The generated synthetic data has stronger correlation between stations and is more consistent with the characteristics of actual train delays.
[0042] 4. Alleviating data scarcity: The method of the present invention can effectively generate a large amount of synthetic delay data under different operating scenarios, significantly expanding the size of the dataset, alleviating the problem of train delay data scarcity, and providing powerful data for subsequent data-driven applications such as train operation analysis, delay prediction, and scheduling optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a flow chart of train delay data generation and processing based on the improved CTGAN provided by the present invention;
[0044] Figure 2 This is a comparison of the distribution of delays greater than 5 minutes at the terminal station between the original data and the generated data provided by the present invention.
[0045] Figure 3 This is the case of late prediction using fused generated data.
[0046] Figure 4 This is the delayed prediction using the original data. DETAILED DESCRIPTION
[0047] A train delay data generation method based on an improved CTGAN includes the following steps:
[0048] Step S100: Collect the original train delay data, extract relevant features related to the delay, and design the delay input form.
[0049] Step S110: Extract the arrival delay time series data of each train at multiple consecutive stations on a line. Select the arrival delay time of the 1st, 2nd, 3rd, 4th, 5th, and 6th stations that the train passes through in sequence as the original features.
[0050] Step S120: Calculate the delay time increment of the train between adjacent stations according to formula (1), retain the initial station delay time (1 station delay) and increment characteristics, and remove the original station data to reduce redundancy.
[0051] (1)
[0052] in, 、 Respectively represent the train in 、 The station is late, Indicates the Station and The delay increment of the station.
[0053] Step S130: Using train operation knowledge rules and combining with the original train feature data, construct operation scenario feature indicators such as whether the train delay is propagated, the degree of train delay, and the train delay starting interval. The specific knowledge rules are as follows:
[0054] (1) Whether the delay is propagated: After a station is delayed, if the delay time of the next station is greater than that of the current station, it is considered that the delay has propagated and is marked as 1, otherwise it is marked as 0.
[0055] (2) Delay degree: It is divided into different degrees according to the delay time at the terminal. When the delay time is less than 15 minutes, the delay degree is marked as 1; when the delay time is between 15 and 30 minutes, the delay degree is marked as 2; when the delay time is more than 30 minutes, the delay degree is marked as 3.
[0056] (3) The delay interval, that is, the location where the first arrival delay occurs. There are 6 stations along the line. Excluding the departure station, there are 5 stations that handle arrival services. When the first arrival delay occurs at the second station, it is considered to have occurred in the first interval and the delay is marked as 1. Similarly, the values are 1-5.
[0057] Step S140: Design the model input data format. Train operation scenario characteristics (whether train delays are propagated, the degree of train delays, and the starting interval of train delays) are one-hot encoded as discrete conditional columns to ensure that the model can distinguish different scenario categories. The initial station delay time (1 station delay) and incremental features are input into the CTGAN model as continuous variables.
[0058] Among them, One-Hot encoding is a method used to convert discrete categorical variables into numerical form. Its specific calculation formula is as follows:
[0059] Assume that the discrete variable X has N categories and define its One-Hot encoding vector for:
[0060] (2)
[0061] in: Representative categories, is a binary vector of length N, only when Belong to category When, index For example, the delay degree is divided into 3 categories according to the time, and the one-hot codes corresponding to categories 1, 2, and 3 are , , .
[0062] Step S200: Build an improved CTGAN model, add a Transformer encoding layer based on CNN, use the self-attention mechanism to capture the spatiotemporal feature relationship between the train arrival delay time series and the operation scene characteristics, configure training parameters and train the model.
[0063] Step S210: constructing an improved CTGAN model, where the CTGAN model includes a generator network and a discriminator network.
[0064] Improved generator structure: The generator network adds a Transformer to the original CNN convolutional structure to generate train delay data, enhancing its learning of the temporal and logical relevance of train delay feature data. The specific structure is as follows:
[0065] (1) Input layer: Receives the concatenated input of the noise vector and the condition vector, with the input dimension input_dim being 9 (including the initial delay, incremental delay features, and operating scenario condition columns);
[0066] (2) CNN feature extraction layer: extract local features through a multi-layer fully connected network. The number of convolutional layers is 3, the convolution kernel size is (256, 256), and the activation function is ReLU;
[0067] (3) Transformer encoding layer: Use the multi-head self-attention mechanism to capture the long-term dependencies of incremental features and the logical correlation between scene features. Set the number of layers to 2 and the number of heads (num_heads) to 8 to enhance the ability to model spatiotemporal mixed sequences.
[0068] (4) Output layer: Use the Tanh function to generate synthetic data with the same dimension as the input.
[0069] The discriminator network distinguishes between real data and data generated by the generator. The two models work together to ensure that the generated data approximates real data. The discriminator network uses the original convolutional structure, a four-layer fully connected network, a ReLU activation function, and a Sigmoid output layer.
[0070] In addition, the loss function of CTGAN is designed. The loss function of CTGAN introduces conditional constraints and feature encoding optimization based on the traditional GAN. It is specifically divided into the loss of the generator (G) and the discriminator (D).
[0071] (1) Discriminator loss calculation: (2)
[0072] Where, It represents the discriminator losses, Indicates expectation, represents a generator, represents the real delay data set, represents the real delayed data sample, Represents the generation of a data set, Indicates the generation of late data samples, Indicates the operating scenario conditions. Representation Discriminator In the conditions For real delay data The output, Representation Discriminator For the generator In the conditions Generate late data The output, Represents real delay data samples Follow real delay data In the conditions The distribution under , Indicates the generation of late data samples Obey the generated late data In the conditions The distribution under .in Represents the discriminant output of the discriminant for the real delay data Expected value after taking logarithm . It is a number between (0, 1). If the output is 1, it means that the discriminator believes that the input data must be real data, so the discriminant output for real data is The closer to 1, the better; Is a number between (0, 1). Ideally, the discriminator's judgment on the data generated by the generator should be 0, indicating that it believes that the generated data must be false data. Therefore represents the probability that the discriminator thinks the generated data is fake data. It represents the expectation of the logarithm of the probability that the discriminator believes that the generated data is fake data. The goal of the discriminator is to maximize the ability to distinguish between real data and generated data, so it hopes to maximize the discriminant output of real data. and minimize the discriminant output for the generated data . Loss function The design is to achieve this goal. The smaller the loss function, the stronger the discriminator's ability.
[0073] (2) Generator loss calculation: (3)
[0074] The role of the generator is to generate data that is as realistic as possible to deceive the discriminator, so it hopes that the discriminator will generate data for it. The discriminant output of Closer to 1.
[0075] Where, Represents a generator losses, represents the coding loss, is the weighted coefficient, discriminant output is a number between (0, 1), when The closer it is to 1, The smaller it is, the better it is designed as part of the loss function; and Represents the weighted coding loss, which also needs to be minimized by the generator to ensure that the generated data is similar to the real data in terms of discrete feature distribution, where It is a coding loss for discrete features such as whether the delay is propagated, the delay interval, and the degree of delay. The cross entropy constraint is used to ensure the consistency between the generated data and the real data in the discrete distribution.
[0076] Step S220: Configure the training parameters of the CTGAN model according to the train delay input data. In order to balance the capabilities of the generator and the adversary, the generator learning rate is set to 3*10 -4 , the discriminator learning rate is set to 2*10 -4 ; The number of training epochs is set to 800; The batch size is set to 64; In addition, to prevent data overfitting, the random activation rate (dropout) is set to 0.1.
[0077] Step S230: Use the training data prepared in step S100 to train the CTGAN model. During the training process, the generator network and the discriminator network compete with each other, continuously optimizing the model parameters, and stopping after reaching the maximum number of training rounds.
[0078] S300: Use the trained model to generate delay increment features and initial station data to reconstruct the complete delay time series;
[0079] Step S310: Using the trained CTGAN model, randomly generate a specified number of synthetic delay increment feature data, as well as the delay time data and operation scenario feature information of the first station.
[0080] Step S320: Reconstruct the original delay data from the incremental features. Based on the generated delay time of the first station and the incremental delay data of subsequent stations, the delay time of subsequent stations is calculated station by station according to formula (4).
[0081] (4)
[0082] in, 、 Respectively represent the train in 、 The station is late, Indicates the Station and The delay increment of the station.
[0083] Step S330: Save the reconstructed synthetic delay data as a file in a specified format.
[0084] S400: Verify the quality of synthetic data through statistical similarity, distribution similarity and prediction effect.
[0085] Step S410: Design an indicator to evaluate the statistical similarity of the model. This indicator measures the similarity between the synthetic data and the real data in terms of statistical characteristics such as mean and variance. The specific indicator calculation formula is as follows:
[0086] (5)
[0087] in, represents the statistical similarity score of the synthetic data, and Represents real data and synthetic data No. Item statistics (such as mean, variance, median, quantile, etc.); N is the total number of statistics. When mean, variance, median, and 25% quantile are selected, N=4. The closer it is to 1, the closer the statistical characteristics of the synthetic data are to the real data.
[0088] Step S420: Design an evaluation metric to verify the similarity between the synthetic data and the real data distribution. The specific scoring metric (KS Complement) is calculated as shown in formula (6):
[0089] (6)
[0090] Where D is the Kolmogorov-Smirnov statistic, which is defined as the maximum absolute difference between the cumulative distribution function (CDF) of the real data and the synthetic data. The specific calculation of D is as follows:
[0091] (7)
[0092] Where, Represents the observed values of all late data variables After calculating the distribution, we take the maximum value, that is, we find the maximum difference between the CDFs of the two distributions. and Represents real data and synthetic data The cumulative distribution function of KS Complement is closer to 1, which indicates that the distribution of synthetic data is more consistent with that of real data.
[0093] Step S430: Verify the practicality of the generated data. The generated data and real data are used as training sets to train the train delay prediction model. A test set is randomly selected from 15% of the original train data by month. The delay prediction results using the fused data and the original data as training sets are compared to verify the applicability of the synthetic data in real-world data-driven models.
[0094] The present invention also provides an embodiment for exemplarily illustrating the process and results of applying the method provided by the present invention to generate delay data. The specific steps are as follows:
[0095] A method for generating train delay data based on an improved CTGAN is characterized by comprising the following steps:
[0096] S100: Collects raw train delay data, extracts arrival delay time series for multiple consecutive stations, calculates delay increments for adjacent stations, constructs operational scenario features, and designs input data formats that include discrete conditional columns and continuous variables.
[0097] Step S110: Collect 1598 arrival delay time series data of each train at 6 stations along the Beijing-Tianjin Intercity Line in a certain year as raw features. The specific data format example is as follows:
[0098] Table 1 Example of original train delay time information
[0099]
[0100] Step S120: Calculate the delay time increment of the train between adjacent stations according to formula (1), retain the initial station delay time (1 station delay) and increment characteristics, and remove the original station data to reduce redundancy.
[0101] (1)
[0102] The delay increment information features calculated based on the example data in Table 1 are shown in Table 2:
[0103] Table 2 Example of train incremental delay time information
[0104]
[0105] Step S130: Using train operation knowledge rules and combining with the original train feature data, construct operation scenario feature indicators such as whether the train delay is propagated, the degree of train delay, and the train delay starting interval. The specific knowledge rules are as follows:
[0106] (4) Whether the delay is propagated: After a station is delayed, if the delay time of the next station is greater than that of the current station, it is considered that the delay has propagated and is marked as 1, otherwise it is marked as 0.
[0107] (5) Delay degree: It is divided into different degrees according to the delay time at the terminal. When the delay time is less than 15 minutes, the delay degree is marked as 1; when the delay time is between 15 and 30 minutes, the delay degree is marked as 2; when the delay time is more than 30 minutes, the delay degree is marked as 3.
[0108] (6) The delay interval, that is, the location where the first arrival delay occurs. There are 6 stations along the line. Excluding the departure station, there are 5 stations that handle arrival services. When the first arrival delay occurs at the second station, it is considered to have occurred in the first interval and the delay is marked as 1. Similarly, the values are 1-5.
[0109] The delay scene features calculated based on the example data in Table 1 are shown in Table 3:
[0110] Table 3. Example of train delay scenario features
[0111]
[0112] Step S140: Design the model input data format. Train operation scenario features (whether train delays are propagated, the degree of delay, and the delay originating interval) are one-hot encoded as discrete conditional columns to ensure the model can distinguish between different scenario categories. Initial station delay time (1-station delay) and incremental features are input into the CTGAN model as continuous variables. The one-hot encoding of the delay scenario features calculated based on the example data in Table 1 is shown in Table 4:
[0113] Table 4. One-hot encoding examples of train delay scene features
[0114]
[0115] S200: Build an improved CTGAN model by adding a Transformer encoding layer to the CNN model. Use the self-attention mechanism to capture the spatiotemporal relationship between train arrival delay time series and operational scenario features. Configure training parameters and train the model.
[0116] Step S210: A Transformer structure is added to the traditional discriminator network structure CNN (convolutional neural network) of the generative adversarial model (CTGAN) to form an improved CTGAN model. The self-attention mechanism in the Transformer is used to better understand the spatiotemporal relationship between the continuous variables of the delay time of each station and the discrete variables of the scene features in the train delay data. The improved generator network is used to generate train delay data, and the discriminator network is used to distinguish between real data and data generated by the generator. The generator and discriminator work together to make the generated data continuously approach the real data.
[0117] Step S220: Improve the training parameters of the CTGAN model based on the train delay input data features. In order to balance the capabilities of the generator and the adversary, the generator learning rate is set to 3*10 -4 , the discriminator learning rate is set to 2*10 -4 ; The number of training epochs is set to 800; The batch size is set to 64; In addition, to prevent data overfitting, the random activation rate (dropout) is set to 0.1.
[0118] Step S230: Using the train delay input data prepared in Step S130, the scene feature data is one-hot encoded as discrete variable conditions to train the CTGAN model. During training, the generator network and the discriminator network compete with each other, continuously optimizing model parameters. Training stops after reaching the maximum number of rounds. The generator loss function value is -0.27, and the discriminator loss function value is 0.2.
[0119] S300: Use the trained model to generate delay increment features and initial station data to reconstruct the complete delay time series;
[0120] Step S310: Using the trained improved CTGAN model, generate the same amount of synthetic delay incremental feature data as the original data, as well as the delay time data and operation scenario feature data of the first station.
[0121] Step S320: Reconstructing the original delay data from the incremental features. Based on the generated delay time of the first station and the incremental delay data of the subsequent stations, the delay time of the subsequent stations is calculated station by station.
[0122] Step S330: Save the reconstructed synthetic delay data as a file in a specified format.
[0123] S400: Verify the quality of synthetic data through statistical similarity, distribution similarity and prediction effect.
[0124] Step S410: Calculate the statistical similarity of the indicator evaluation model. This measures the similarity between the synthetic data and the real data in terms of statistical characteristics such as mean and variance. The specific statistical similarity score results are shown in Table 5:
[0125] Table 5. Statistical similarity scores of delay times for each station in generated data
[0126]
[0127] Step S420: Calculate the index to verify the similarity between the synthetic delay data and the real delay data. The similarity scores of the delay time distribution of each station obtained based on the distribution similarity evaluation index are shown in Table 5. At the same time, a distribution comparison chart of the delay data of more than 5 minutes at the terminal station (station 6) is drawn, as shown in Table 5. Figure 2 shown.
[0128] Table 6. Similarity scores of delay time distribution of each station in generated data
[0129]
[0130] Step S430: The generated data and the real data are used as training sets to train the train delay prediction model, and 15% of the original train data is randomly selected by month as the test set to compare the delay prediction effect of the fused data and the original data as the training set. Figure 1 As shown, the late prediction of the original data is as follows Figure 2 As shown in the figure, it can be found that in the delay prediction graph of the fused data, the scatter points are closer to the diagonal line of the true value. In particular, for delays greater than 30 minutes, the prediction effect using the original data deviates greatly, while the prediction effect using the fused data is significantly closer to the true value. This shows that the data generated by the improved CTGAN network can improve the problem of insufficient prediction accuracy caused by insufficient data in delay prediction, and has strong usability.
[0131] The above shows and describes the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions merely illustrate the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and modifications are intended to fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the appended claims and their equivalents.
Claims
1. A train delay data generation method based on improved CTGAN, characterized by: The following steps are involved: S100: Collects raw train delay data, extracts arrival delay time series for multiple consecutive stations, calculates delay increments for adjacent stations, constructs operational scenario features, and designs input data formats that include discrete conditional columns and continuous variables. Step S110: extracting the arrival delay time series data of each train at multiple consecutive stations on a line; Step S120: Calculate the train delay time increments between adjacent stations, retain the initial station delay time and increment characteristics, and remove the original station data to reduce redundancy; Step S130: Using train operation knowledge rules and combining with original train feature data, construct train delay operation scenario feature indicators; The knowledge rules are as follows: (1) Whether the delay is propagated: After a station is delayed, if the delay time of the next station is greater than that of the current station, it is considered that the delay has propagated and marked as 1, otherwise it is marked as 0; (2) Delay degree: It is divided into different degrees according to the delay time at the terminal. When the delay time is less than 15 minutes, the delay degree is marked as 1; when the delay time is between 15 and 30 minutes, the delay degree is marked as 2; When the delay time is greater than 30 minutes, the delay level is marked as 3; (3) The delay interval, i.e., the location where the first arrival delay occurs. There are 6 stations along the line. Excluding the departure station, there are 5 stations that handle arrival services. When the first arrival delay occurs at the second station, it is considered to have occurred in the first interval and the delay is marked as 1. Similarly, the values range from 1 to 5. Step S140: One-hot encode the train operation scenario feature data as discrete conditional columns to ensure that the model can distinguish different scenario categories. The initial station delay time and incremental features are input into the generative adversarial model (CTGAN) as continuous variables. One-Hot encoding is a method used to convert discrete categorical variables into numerical form. Its specific calculation formula is as follows: Assume that the discrete variable X has N categories and define its One-Hot encoding vector for: (2) in: Representative categories, is a binary vector of length N, only when Belong to category When, index is 1, and the rest are all 0; S200: Build an improved CTGAN model by adding a Transformer encoding layer to the convolutional neural network (CNN). Use the self-attention mechanism to capture the spatiotemporal relationship between train arrival delay time series and operational scenario features. Configure training parameters and train the model. Step S210: A Transformer structure is added to the convolutional neural network (CNN) of the discriminator network structure of the generative adversarial model (CTGAN) to form an improved CTGAN model. The self-attention mechanism in the Transformer is used to better understand the spatiotemporal relationship between the continuous variables of the delay time of each station and the discrete variables of the scene features in the train delay data. The improved generator network is used to generate train delay data, and the discriminator network is used to distinguish between real data and data generated by the generator. The generator and discriminator work together to make the generated data continuously approach the real data. Step S220: improving the training parameters of the CTGAN model according to the characteristics of the train delay input data; Step S230: Using the train delay input data prepared in step S130, the scene feature data is one-hot encoded as discrete variable conditions to train the CTGAN model. During the training process, the generator network and the discriminator network compete with each other, continuously optimizing the model parameters, and stopping after reaching the maximum number of training rounds. S300: Use the trained model to generate delay increment features and initial station data to reconstruct the complete delay time series; S400: Verify the quality of synthetic data through statistical similarity, distribution similarity and prediction effect.
2. The train delay data generation method based on the improved CTGAN according to claim 1 is characterized by: The step S300 includes the following contents: step S310: using the trained improved CTGAN model, randomly generating a specified number of synthetic delay increment feature data, as well as the delay time data and operation scenario feature data of the first station; Step S320: Reconstructing the original delay data from the incremental features, and calculating the delay time of subsequent stations based on the generated delay time of the first station and the incremental delay data of subsequent stations. Step S330: Save the reconstructed synthetic delay data as a file in a specified format.
3. The train delay data generation method based on the improved CTGAN according to claim 1 is characterized by: The step S400 includes the following contents: Step S410: calculating the statistical similarity score of the index evaluation model; Step S420: Calculate the similarity score between the synthetic data and the real data distribution by the indicator verification; Step S430: Design an experiment to verify the practicality of the generated data. Use the generated data and real data as training sets to train the train delay prediction model. Randomly select 15% of the original train data by month as a test set to compare the delay prediction effects of the fused data and the original data as training sets.
4. A train delay data generation system based on the method according to claim 1, characterized in that: include: Data preprocessing module: used to extract site delay time, calculate incremental features, construct scenario features, and encode them; Improved CTGAN model module: including adding Transformer to improve the generator and discriminator, and configuring training parameters; Data generation module: reconstructs the complete delay sequence based on the model output; Quality assessment module: Verify the statistical, distribution characteristics and predictive practicality of synthetic data.
5. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute the method according to any one of claims 1 to 3.
6. An electronic device, characterized in that: The method comprises a processor and a memory; the memory stores computer-readable instructions, and the processor is used to execute the computer-readable instructions, wherein the computer-readable instructions execute the method according to any one of claims 1 to 3 when executed.
Citation Information
Patent Citations
Knowledge data collaborative driving-based train arrival delay prediction method and application thereof
CN118536681A
Industrial internet anomaly detection method based on deep generative adversarial network
CN119520027A