Train delay data generation method based on improved CTGAN
Through the improved CTGAN model, combined with the Transformer encoding layer and self-attention mechanism, high-quality and diverse train delay data are generated, which solves the problem of data scarcity in the existing technology and improves the data support capabilities of train delay prediction and scheduling optimization.
Patent Information
- Application Number
- CN202510653355.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-05-21
AI Technical Summary
It is difficult for the prior art to generate high-quality and diversified train delay data, resulting in limited performance of data-driven train delay analysis and prediction models.
The improved CTGAN model is adopted, combined with the Transformer encoding layer and self-attention mechanism, and the train delay data generation method is constructed. By collecting train operation scenario characteristics and time series data, high-quality train delay data is generated.
The generated train delay data has high fidelity and strong diversity, which can effectively expand the scale of the data set and improve the data support capabilities of train delay prediction and scheduling optimization.
Smart Images

Figure CN120409277A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of railway train operation 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 has become increasingly widespread. As one of the important operation data, train delay data is of great value for aspects such as train operation analysis, dispatching optimization, and service quality improvement. However, in actual operation, trains usually operate on time, and delay data is relatively scarce, especially large delay data is even rarer. The scarcity of data limits the performance improvement of data-driven train delay analysis and application models.
[0003] To solve the problem of scarce train delay data, the following methods are usually adopted in the prior art:
[0004] 1. Data augmentation techniques: For example, by performing operations such as translation, scaling, and adding noise to existing delay data to increase the data volume. However, the data generated by this method has limited diversity and is difficult to cover the distribution characteristics of real delay data.
[0005] 2. Simulation model generation: By constructing a train operation simulation model to simulate delay situations under different operation scenarios. However, it is difficult for the simulation model to accurately model complex operation environments, and the data authenticity is difficult to guarantee.
[0006] 3. Traditional statistical methods: Using statistical models (such as Gaussian mixture models, hidden Markov models, etc.) to learn the distribution of delay data and generate synthetic data. However, traditional statistical models have limited ability to model high-dimensional and complex distribution data, and the generated data quality is not high.
[0007] In recent years, generative adversarial networks (GANs), as a powerful deep generative model, have achieved remarkable results in fields such as images and texts. The GAN model can learn the complex distribution of real data and generate high-quality synthetic data. Conditional tabular generative adversarial network (CTGAN), as a variant of GAN, is specifically used to process tabular data and can effectively capture the mixed distribution of discrete and continuous variables in tabular data. However, for train operation delay data, which involves time correlation and complex operation scenario constraints, the generator in the traditional CTGAN only uses a convolutional neural network and is not sufficient to process complex spatio-temporal mixed data sequences. It is possible to consider improving the structure of the generator by adding a network that is good at processing complex relationship sequences as the basic structure for generating train delay data. Summary of the Invention
[0008] The purpose of the present invention is to overcome the deficiencies in the existing train delay data generation method, and propose an improved train delay data generation method based on CTGAN, aiming to generate high-quality train delay data based on different train operation scenarios to solve the problem of scarce train delay data and provide data support for subsequent data-driven train delay prediction.
[0009] The present invention is realized by the following technical solutions:
[0010] S100: Collect the original train delay data, extract the arrival delay time series of multiple consecutive stations, calculate the delay increment between adjacent stations, construct the operation scenario features, and design the input data form including discrete conditional columns and continuous variables;
[0011] S200: Construct an improved CTGAN model, add a Transformer encoding layer on the basis of CNN, use the self-attention mechanism to capture the spatio-temporal feature relationship between the train arrival delay time series and the operation scenario features, configure the training parameters and train the model;
[0012] S300: Use the trained model to generate the delay increment features and the initial station data, and reconstruct the complete delay time series;
[0013] S400: Verify the quality of the synthetic data through statistical similarity, distribution similarity and prediction effect.
[0014] Further, the step S100 includes:
[0015] Step S110: Extract the arrival delay time series data of multiple consecutive stations of each train on a line. Select the arrival delay times of stations 1, 2, 3, 4, 5, and 6 passed by the train in sequence as the original features.
[0016] Step S120: Calculate the delay time increment between adjacent stations of the train, retain the initial station delay time (delay at station 1) and the increment features, and remove the original station data to reduce redundancy.
[0017] Step S130: Use the train operation knowledge rules, combined with the original train feature data, to construct operation scenario feature indicators such as whether the train delay propagates, the degree of train delay, and the initial interval of train delay.
[0018] Step S140: Design the model input data form. Use data such as train operation scenario features (whether the train delay propagates, the degree of train delay, and the initial interval of train delay) as discrete conditional columns for One-hot encoding to ensure that the model can distinguish different scenario categories, while the initial station delay time (delay at station 1) and the increment features are input into the CTGAN model as continuous variables.
[0019] Further, the step S200 includes:
[0020] Step S210: Add a Transformer structure to the traditional discriminator network structure CNN (Convolutional Neural Network) of the generative adversarial model CTGAN to form an improved CTGAN model. Utilize the self-attention mechanism in the Transformer to better understand the spatio-temporal interrelationships between the continuous variables of the late arrival times at each station and the discrete variables of the scenario features in the train late arrival data, enabling the improved generator network to generate train late arrival data and the discriminator network to distinguish between real data and the data generated by the generator. The collaborative action of the generator and the discriminator makes the generated data continuously approach the real data;
[0021] Step S220: Configure the training parameters of the improved CTGAN model according to the characteristics of the train late arrival input data, including the type of normalizer, learning rate, number of training epochs, batch size, etc.
[0022] Step S230: Use the train late arrival input data prepared in step S130, perform One-hot encoding on the scenario feature data as discrete variable conditions, and 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 epochs.
[0023] Further, the step S300 includes:
[0024] Step S310: Use the trained improved CTGAN model to randomly generate a specified number of synthetic late arrival increment feature data, as well as the late arrival time data and operation scenario feature data of the first station.
[0025] Step S320: Reconstruct the original late arrival data from the increment features. Based on the generated late arrival time of the first station and the late arrival increment data of subsequent stations, calculate the late arrival times of subsequent stations by backward inference station by station.
[0026] Step S330: Save the reconstructed synthetic late arrival data as a file in a specified format.
[0027] Further, the step S400 includes:
[0028] Step S410: Calculate the statistical similarity score of the metric evaluation model. Measure the similarity between the synthetic data and the real data in terms of statistical features such as mean and variance.
[0029] Step S420: Calculate the similarity score of the metric to verify the distribution similarity between the synthetic data and the real data.
[0030] Step S430: Design an experiment to verify the practicality of the generated data. Use the generated data and real data as the training set for training the train delay prediction model, and randomly select 15% of the original train data by month as the test set, and compare the delay prediction effects of the fused data and the original data as the training set.
[0031] The present invention also discloses a train delay data generation system, which is based on the above method and is characterized by including:
[0032] Data preprocessing module: used to extract the station delay time, calculate incremental features, construct scenario features and encode them;
[0033] Improved CTGAN model module: includes a generator with Transformer added and a CNN discriminator, and configures training parameters;
[0034] Data generation module: reconstructs the complete delay sequence according to the model output;
[0035] Quality assessment module: verifies the statistical, distribution characteristics and prediction practicality of the synthetic data.
[0036] The present invention also discloses a non-volatile storage medium, which is characterized in that the non-volatile storage medium includes a stored program, wherein the program controls the device where the non-volatile storage medium is located to execute the above method when running.
[0037] The present invention also discloses an electronic device, which is characterized by including 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: By using the improved CTGAN model, it can effectively learn the mutual relationship and complex distribution feature information of train delay data, generate high-quality and highly realistic synthetic delay data, and better reflect the logical relationship, statistical characteristics and distribution law of real delay data.
[0040] 2. Diversified data generation: The generation mechanism of the GAN model makes the synthetic data have good diversity, can generate synthetic data covering a wider data space and richer delay scenarios, and overcomes the problem of the single nature of the data generated by traditional data enhancement methods.
[0041] 3. Application of Incremental Features and Scenario Features: By constructing and utilizing features such as late increment and operation scenario, the improved CTGAN model can better capture the propagation and evolution law of train delays between stations. The generated synthetic data has stronger correlation between stations and is more in line with the characteristics of actual train delays.
[0042] 4. Alleviation of Data Scarcity: The method of the present invention can effectively generate a large amount of synthetic delay data under different operation scenarios, significantly expand the scale of the data set, alleviate the problem of scarce train delay data, and provide powerful data for subsequent data-driven train operation analysis, delay prediction, scheduling optimization and other applications. Brief Description of the Drawings
[0043] Figure 1 is a processing flow chart of train delay data generation based on the improved CTGAN provided by the present invention;
[0044] Figure 2 is a comparison of the late arrival distributions of the original data and the generated data at the terminal station of the present invention with a delay of more than 5 minutes.
[0045] Figure 3 is the late arrival prediction situation using the fused generated data.
[0046] Figure 4 is the late arrival prediction situation using the original data. Detailed Embodiment
[0047] A method for generating train delay data based on an improved CTGAN includes the following steps:
[0048] Step S100: Collect and prepare 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 a train at multiple consecutive stations on a line. Select the arrival delay times of stations 1, 2, 3, 4, 5, and 6 passed by the train in sequence as the original features.
[0050] Step S120: Calculate the delay time increment between adjacent stations of the train according to formula (1), retain the delay time at the initial station (delay at station 1) and the incremental feature, and remove the original station data to reduce redundancy.
[0051] (1)
[0052] Wherein, 、 respectively represent the delay times of the train at the 、 th stations, represents the The delay increment between the station and the
[0053] Step S130: Using train operation knowledge rules and combining with the original train feature data, construct operation scenario feature indicators such as whether train delay spreads, the degree of train delay, and the starting section of train delay. The specific knowledge rules are as follows:
[0054] (1) Whether the delay spreads: After a delay occurs at a certain station, if the delay time of the next station is greater than that of the current station, it is considered that the delay spreads, marked as 1, otherwise 0.
[0055] (2) Degree of delay: It is divided into different degrees according to the size of the delay time at the terminal station. When the delay time is less than 15 minutes, the degree of delay is marked as 1; when the delay time is between 15 - 30 minutes, the degree of delay is marked as 2; when the delay time is greater than 30 minutes, the degree of delay is marked as 3.
[0056] (3) Delay occurrence section, that is, the position where the first arrival delay appears. There are a total of 6 stations along the line. Excluding the starting station, there are 5 stations handling arrival operations. When the first arrival delay occurs at the second station, it is regarded as the delay occurring in the first section, and the delay is marked as 1, and so on, with values ranging from 1 - 5.
[0057] Step S140: Design the form of the model input data. Data such as train operation scenario features (whether train delay spreads, the degree of train delay, and the starting section of train delay) are encoded using One - hot encoding as discrete condition columns to ensure that the model can distinguish different scenario categories, while the initial station delay time (delay at station 1) and incremental features are input into the CTGAN model as continuous variables.
[0058] Among them, One - Hot encoding is a method for converting discrete categorical variables into numerical forms, and its specific calculation formula is as follows:
[0059] Let the discrete variable X have a total of N categories, and define its One - Hot encoding vector as:
[0060] (2)
[0061] Where: represents the th category, is a binary vector of length N, and only when belongs to the category does the index is 1 and the rest are all 0. For example, for the degree of train delay, it is divided into 3 categories according to time, and the One-Hot encodings corresponding to categories 1, 2, and 3 are respectively , , .
[0062] Step S200: Construct an improved CTGAN model. Add a Transformer encoding layer on the basis of CNN, and use the self-attention mechanism to capture the spatio-temporal feature relationship between the train arrival delay time series and the running scenario features, configure the training parameters and train the model.
[0063] Step S210: Construct an improved CTGAN model, and the CTGAN model includes a generator network and a discriminator network.
[0064] Improvement of the 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 correlation and logical correlation of train delay feature data. The specific structure is as follows:
[0065] (1) Input layer: Receive the concatenated input of the noise vector and the conditional vector, and the input dimension input_dim is 9 (including initial delay, incremental delay features, and running 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 size of the convolutional kernel 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 dependence relationship of incremental features and the logical correlation between scenario features, set the number of layers to 2, and the number of heads (num_heads) to 8 to enhance the spatio-temporal hybrid sequence modeling ability;
[0068] (4) Output layer: Use the Tanh function to generate synthetic data with the same dimension as the input.
[0069] The discriminator network is used to distinguish between real data and the data generated by the generator. The two models work together to make the generated data continuously approach the real data. The discriminator network adopts the original convolutional structure, a 4-layer fully connected network, the activation function is ReLU, and the output layer uses Sigmoid.
[0070] In addition, design the loss function for CTGAN. The loss function of CTGAN introduces conditional constraints and feature encoding optimization on the basis of the traditional GAN, and is specifically divided into the losses of the generator (G) and the discriminator (D).
[0071] (1) Discriminator loss calculation: (2)
[0072] In the formula, represents the loss of the discriminator , represents taking the expectation, represents the generator, represents the set of real late data, represents a real late data sample, represents the set of generated data, represents a generated late data sample, represents the operating scenario condition, represents the discriminator under the condition for the real late data output, represents the discriminator for the generator under the condition for the generated late data output, represents the real late data sample follows the distribution of the real late data under the condition , , represents the generated late data sample follows the distribution of the generated late data under the condition , . Among them represents the discriminant output of the discriminator for the real late data the expectation after taking the logarithm . is a number between (0, 1). An output of 1 means that the discriminator believes that the input data must be real data. Therefore, for the discriminant output of the real data, the closer it is to 1, the better; is a number between (0, 1). Ideally, the discriminant of the discriminator for the data generated by the generator should be 0, indicating that it believes that the generated data must be fake data. Therefore represents the probability that the discriminator believes that the generated data is fake data. represents the expectation after taking 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. Therefore, it hopes to maximize the discriminant output for the 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 as realistic data as possible to deceive the discriminator. Therefore, it hopes that the discriminator's discriminant output is closer to 1.
[0075] In the formula, represents the loss of the generator , represents the encoding loss, is the weighting coefficient, and the discriminant output is a number between (0, 1). When is closer to 1, is smaller. Therefore, it is designed as part of the loss function, and the smaller the better; while represents the weighted encoding loss, and this term also needs to be minimized by the generator to ensure that the generated data is similar to the real data in the discrete feature distribution. Among them, is the encoding loss for discrete features such as whether the delay propagates, the delay interval, and the degree of delay, and the cross-entropy is used to constrain 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. To balance the capabilities of the generator and the discriminator, the learning rate of the generator is set to 3*10 , , -4 , ,
[0078] ,
[0076] ,
[0077] , -4 ,
[0079] , and the learning rate of the discriminator 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 overfitting, the dropout rate 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 epochs.
[0078] S300: Use the trained model to generate delay increment features and initial station data, and reconstruct the complete delay time series;
[0079] Step S310: Use the trained CTGAN model to randomly generate a specified number of synthetic delay increment feature data, as well as the delay time data of the first station and the operation scenario feature information.
[0080] Step S320: Reconstruct the original delay data from the incremental features. According to the delay time of the first station generated and the delay increment data of subsequent stations, calculate the delay times of subsequent stations by reverse inference station by station according to Equation (4).
[0081] (4)[[ID=?]]
[0082] Wherein, 、 respectively represent the delay times of the train at the 、 th stations, represents the delay increment between the th station and the th station.
[0083] Step S330: Save the reconstructed synthetic delay data as a file in a specified format.
[0084] S400: Verify the quality of the synthetic data by statistical similarity, distribution similarity and prediction effect.
[0085] Step S410: Design the statistical similarity (Statistic Similarity) of the index evaluation model. Measure the similarity between the synthetic data and the real data in statistical features such as mean and variance. The specific index calculation formula is as Equation (5):
[0086] (5)
[0087] Wherein, represents the statistical similarity score of the synthetic data, and respectively represent the th and th statistical quantities (such as mean, variance, median, quantile, etc.) of the real data ; N is the total number of statistical quantities. When selecting mean, variance, median, and 25% quantile, 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 index evaluation to verify the similarity between the distribution of the synthetic data and the real data. The calculation formula of the specific scoring index (KS Complement) is as Equation (6):
[0089] (6)
[0090] Among them, D is the Kolmogorov-Smirnov statistic, defined as the maximum absolute difference between the cumulative distribution functions (CDFs) of the real data and the synthetic data. The specific calculation of D is as shown in Equation (7):
[0091] (7)
[0092] In the formula, denotes taking the maximum value after calculating the distribution for all observed values of the late arrival data variables That is, finding the maximum gap between the CDFs of the two distributions. and respectively represent the cumulative distribution functions of the real data and the synthetic data When the KS Complement is closer to 1, it indicates that the distribution of the synthetic data is more consistent with that of the real data.
[0093] Step S430: Verify the usability of the generated data. Use the generated data and the real data as the training set for training the train late arrival prediction model, and randomly select 15% of the train original data by month as the test set. Compare the late arrival prediction effects of the fused data and the original data as the training set to test the application ability of the synthetic data in the actual data-driven model.
[0094] The present invention also provides an embodiment for exemplarily showing the process and results of using the method provided by the present invention for generating late arrival data. The specific steps are as follows:
[0095] A method for generating train late arrival data based on an improved CTGAN, characterized by comprising the following steps:
[0096] S100: Collect the original train late arrival data, extract the arrival late arrival time series of multiple consecutive stations, calculate the late arrival increment between adjacent stations, construct the operation scenario features, and design the input data form including discrete conditional columns and continuous variables;
[0097] Step S110: Collect a total of 1598 arrival late arrival time series data of each train at 6 stations along the way on the Beijing-Tianjin Intercity Line in a certain year as the original features. The specific data format examples are as follows:
[0098] Table 1 Example of Train Original Late Arrival Time Information
[0099]
[0100] Step S120: Calculate the late arrival time increment between adjacent stations of the train according to Equation (1), retain the late arrival time at the initial station (late arrival at Station 1) and the increment features, 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 as follows:
[0103] Table 2 Example of train incremental delay time information
[0104]
[0105] Step S130: Using the train operation knowledge rules and combining with the original train feature data, construct operation scenario feature indicators such as whether train delay propagates, the degree of train delay, and the initial section of train delay. The specific knowledge rules are as follows:
[0106] (4) Whether delay propagates: After a delay occurs at a certain station, if the delay time at the next station is greater than that at the current station, it is considered that delay propagation occurs, marked as 1, otherwise 0.
[0107] (5) Degree of delay, which is divided into different degrees according to the size of the delay time at the terminal station. When the delay time is less than 15 minutes, the degree of delay is marked as 1; when the delay time is between 15 - 30 minutes, the degree of delay is marked as 2; when the delay time is greater than 30 minutes, the degree of delay is marked as 3.
[0108] (6) Delay occurrence section, that is, the position where the first arrival delay appears. There are a total of 6 stations along the line. Excluding the starting station, there are 5 stations handling arrival operations in total. When the first arrival delay occurs at the second station, it is regarded as the delay occurring in the first section, and the delay is marked as 1, and so on, with values ranging from 1 to 5.
[0109] The delay scenario features calculated based on the example data in Table 1 are shown in Table 3 as follows:
[0110] Table 3 Example of train delay scenario features
[0111]
[0112] Step S140: Design the form of model input data. Use data such as train operation scenario features (whether train delay propagates, the degree of train delay, and the initial section of train delay) as discrete condition columns for One - hot encoding to ensure that the model can distinguish different scenario categories, and use the initial station delay time (delay at Station 1) and incremental features as continuous variables to input into the CTGAN model. Among them, the One - hot encoding of the delay scenario features calculated based on the example data in Table 1 is shown in Table 4 as follows:
[0113] Table 4 Example of One - hot encoding of train delay scenario features
[0114]
[0115] S200: Construct an improved CTGAN model. Add a Transformer encoding layer on the basis of CNN, and use the self-attention mechanism to capture the spatio-temporal feature relationship between the train arrival delay time series and the operation scenario features. Configure the training parameters and train the model;
[0116] Step S210: Add a Transformer structure to the traditional discriminator network structure CNN (Convolutional Neural Network) of the generative adversarial model CTGAN to form an improved CTGAN model. Use the self-attention mechanism in Transformer to better understand the spatio-temporal mutual relationship between the continuous variables of the delay time at each station and the discrete variables of the scenario features in the train delay data, so that the improved generator network is used to generate train delay data, and the discriminator network is used to distinguish between real data and the data generated by the generator. The generator and the discriminator work together to make the generated data continuously approach the real data.
[0117] Step S220: Configure the training parameters of the improved CTGAN model according to the characteristics of the train delay input data. In order to balance the capabilities of the generator and the discriminator, set the learning rate of the generator to 3*10 -4 , and set the learning rate of the discriminator to 2*10 -4 ; Set the number of training epochs to 800; Set the batch size to 64; In addition, in order to prevent overfitting of the data, set the dropout rate to 0.1.
[0118] Step S230: Use the train delay input data prepared in Step S130, perform One-hot encoding on the scenario feature data as discrete variable conditions, and train the CTGAN model. During the training process, the generator network and the discriminator network compete with each other, continuously optimize the model parameters, and stop after reaching the maximum number of training epochs. Among them, the loss function value of the generator is -0.27, and the loss function value of the discriminator is 0.2.
[0119] S300: Use the trained model to generate delay increment features and initial station data, and reconstruct the complete delay time series;
[0120] Step S310: Use the trained improved CTGAN model to generate synthetic delay increment feature data with the same quantity as the original data, as well as the delay time data and operation scenario feature data of the first station.
[0121] Step S320: Reconstruct the original delay data from the increment features. According to the generated delay time of the first station and the delay increment data of the subsequent stations, calculate the delay time of the subsequent stations by reverse deduction station by station.
[0122] Step S330: Save the reconstructed synthetic late arrival data as a file in a specified format.
[0123] S400: Verify the quality of the synthetic data by statistical similarity, distribution similarity, and prediction effect.
[0124] Step S410: Calculate the statistical similarity of the metric evaluation model (Statistic Similarity). Measure the similarity between the synthetic data and the real data in terms of statistical features such as mean and variance. The specific statistical similarity scoring results are shown in Table 5:
[0125] Table 5 Statistical similarity scores of the late arrival times at each station of the generated data
[0126]
[0127] Step S420: Calculate the similarity of the distribution of the synthetic late arrival data and the real late arrival data for metric verification. The distribution similarity scores of the late arrival times at each station obtained according to the distribution similarity evaluation metrics are shown in Table 5. At the same time, a distribution comparison graph of the late arrival data at the terminal station (Station 6) greater than 5 minutes is drawn, as Figure 2 shown.
[0128] Table 6 Distribution similarity scores of the late arrival times at each station of the generated data
[0129]
[0130] Step S430: Use the generated data and the real data as the training set to train the train late arrival prediction model, and randomly select 15% of the original train data by month as the test set, and compare the late arrival prediction effects of the fused data and the original data as the training set. The late arrival prediction of the fused data is as Figure 1 shown, and the late arrival prediction of the original data is as Figure 2 shown. It can be found that in the late arrival prediction graph of the fused data, the scatter points are closer to the real value diagonal. Especially for the late arrivals greater than 30 minutes, there is a large deviation in the prediction effect using the original data, while using the fused data is significantly closer to the real value, indicating that the data generated by the improved CTGAN network can improve the problem of insufficient prediction accuracy caused by insufficient data volume in late arrival prediction and has strong usability.
[0131] The basic principles, main features and advantages of the present invention have been shown and described above. Those skilled in the art should understand that the present invention is not limited by the above embodiments. What is described in the above embodiments and the specification is only the principle of the present invention. Without departing from the spirit and scope of the present invention, various changes and improvements will occur to the present invention, and all these changes and improvements fall within the scope of the present invention claimed. The scope of protection claimed by the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for generating train delay data based on improved CTGAN, characterized in that, It includes the following steps: S100: Collect the original train delay data, extract the arrival delay time series of multiple consecutive stations, calculate the delay increment between adjacent stations, construct the operation scenario features, and design the input data form including discrete condition columns and continuous variables; S200: Construct an improved CTGAN model, add a Transformer encoding layer on the basis of the convolutional neural network CNN, use the self-attention mechanism to capture the spatio-temporal feature relationship between the train arrival delay time series and the operation scenario features, configure the training parameters and train the model; S300: Use the trained model to generate delay increment features and initial station data, and reconstruct the complete delay time series; S400: Verify the quality of the synthetic data through statistical similarity, distribution similarity and prediction effect.
2. The method according to claim 1, characterized in that, The step S100 includes the following contents: Step S110: Extract the arrival delay time series data of multiple consecutive stations of each train on a line; Step S120: Calculate the delay time increment between adjacent stations of the train, retain the initial station delay time and increment features, and remove the original station data to reduce redundancy; Step S130: Use the train operation knowledge rules, combine with the original train feature data, and construct the train delay operation scenario feature index; Step S140: One-hot encode the train operation scenario feature data as discrete condition columns to ensure that the model can distinguish different scenario categories, and the initial station delay time and increment features are input into the generative adversarial model CTGAN as continuous variables.
3. The method according to claim 2, characterized in that, The step S200 includes the following contents: Step S210: Add a Transformer structure to the discriminator network structure convolutional neural network CNN of the generative adversarial model CTGAN to form an improved CTGAN model, and use the self-attention mechanism in the Transformer to better understand the spatio-temporal mutual relationship between the continuous variables of the delay time at each station and the discrete variables of the scenario features in the train delay data, so that the improved generator network is used to generate train delay data, and the discriminator network is used to distinguish between real data and the data generated by the generator. The generator and the discriminator work together to make the generated data continuously approach the real data; Step S220: Configure the training parameters of the improved CTGAN model according to the train delay input data features; Step S230: Use the train delay input data prepared in step S130, one-hot encode the scenario feature data as discrete variable conditions, and train the CTGAN model; during the training process, the generator network and the discriminator network confront each other, continuously optimize the model parameters, and stop after reaching the maximum number of training rounds.
4. The method for generating train delay data based on improved CTGAN according to claim 3, characterized in that The step S300 includes the following contents: Step S310: Use the trained improved CTGAN model to randomly generate 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: Reconstruct the original late arrival data from the incremental features. Based on the late arrival time of the first station generated and the late arrival incremental data of subsequent stations, calculate the late arrival times of subsequent stations by reverse deduction station by station; Step S330: Save the reconstructed synthetic late arrival data as a file in a specified format.
5. The method for generating train delay data based on improved CTGAN according to claim 3, characterized in that, The said Step S400 includes the following contents: Step S410: Calculate the statistical similarity score of the index evaluation model; Step S420: Calculate the similarity score of the index to verify the distribution similarity between the synthetic data and the real data; Step S430: Design an experiment to verify the practicability of the generated data. Use the generated data and the real data as the training set for training the train late arrival prediction model, and randomly select 15% of the original train data by month as the test set, and compare the late arrival prediction effects of the fused data and the original data as the training set.
6. The method for generating train delay data based on the improved CTGAN according to claim 2, wherein The said knowledge rules are as follows: (1) Whether the late arrival spreads: After a late arrival occurs at a certain station, if the late arrival time of the next station is greater than that of the current station, it is considered that the late arrival spreads, marked as 1, otherwise 0; (2) Degree of late arrival. It is divided into different degrees according to the size of the late arrival time at the terminal station. When the late arrival time is less than 15 minutes, the degree of late arrival is marked as 1; when the late arrival time is between 15 - 30 minutes, the degree of late arrival is marked as 2; When the late arrival time is greater than 30 minutes, the degree of late arrival is marked as 3; (3) Interval where the late arrival occurs, that is, the position where the first arriving late arrival appears. There are a total of 6 stations along the line. Excluding the originating station, there are 5 stations handling arrival operations in total. When the first arriving late arrival occurs at the second station, it is regarded as the late arrival occurring in the first interval, and the late arrival is marked as 1, and so on, with values ranging from 1 - 5.
7. The method for generating train late arrival data based on the improved CTGAN according to claim 2, wherein the One - Hot encoding is a method for converting discrete categorical variables into numerical forms, and its specific calculation formula is as follows: Let the discrete variable \(X\) have a total of \(N\) categories, and define its One - Hot encoding vector as: (2) Wherein: represents the th category, is a binary vector of length N, and only when belongs to the category , the index is 1, and the rest are all 0. For example, for the degree of delay, divided into 3 categories according to time, the One-Hot encodings corresponding to categories 1, 2, and 3 are respectively , , .
8. A train delay data generation system, which is based on the method described in claim 1, and is characterized in that, including: Data pre - processing module: used to extract the late arrival time of the station, calculate the incremental features, construct the scenario features and encode; Improved CTGAN model module: includes a generator and a discriminator improved by adding a Transformer, and configure the training parameters; Data generation module: reconstruct the complete late arrival sequence according to the model output; Quality evaluation module: verify the statistical, distribution characteristics and prediction practicability of the synthetic data.
9. A non-volatile storage medium, characterized in that, The said non - volatile storage medium includes the stored program, wherein when the program runs, it controls the device where the non - volatile storage medium is located to execute the method described in any one of claims 1 to 7.
10. An electronic device, characterized in that, including a processor and a memory; the memory stores computer - readable instructions, and the processor is used to run the computer - readable instructions, wherein when the computer - readable instructions run, they execute the method described in any one of claims 1 to 7.
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
Transform variant-based high-speed train late recovery time prediction method
CN119599193A
Method for analyzing and generating optimal transportation schedules for vehicles such as trains and controlling the movement of vehicles in response thereto
US5177684A
Systems, methods, devices, and platforms for industrial internet of things
WO2024155584A1