A traffic flow prediction method based on a generator and a discriminator
Patent Information
- Application Number
- CN202610940259.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-26
- Publication Date
- 2026-08-18
AI Technical Summary
针对传统模型在长时序交通预测中的三个关键局限:一是难以准确捕捉交通流的长期趋势演化规律,二是对突发异常事件导致的瞬时波动响应滞后,三是动态空间关联建模能力不足,尤其在趋势发生转折的时刻,模型往往出现预测滞后、峰值低估或过平滑现象,导致对转折点的响应精度显著下降
(1)提出一种基于生成器和判别器的交通流量预测方法,该方法通过生成器与判别器的对抗性训练,有效学习交通流数据中复杂的时空演化规律,显著提升了长时序预测的稳定性和准确性。
Smart Images

Figure CN122598437A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic flow prediction, and more specifically, to a traffic flow prediction method based on a generator and a discriminator. Background Technology
[0002] Despite significant progress in short-term traffic flow prediction, several problems remain to be addressed. Traditional statistical methods heavily rely on the assumption of data stationarity, failing to handle the prevalent nonlinearity and random fluctuations in traffic flow, resulting in limited predictive effectiveness. While machine learning methods can model complex data, they often depend on manual feature design and selection, making it difficult to fully uncover potential patterns in traffic data. Furthermore, most focus only on temporal correlations, failing to effectively capture the spatial structural features of the road network. Although deep learning methods offer advantages in spatiotemporal modeling, most graph neural network-based models rely on predefined adjacency matrices, making it difficult to fully reflect the dynamic spatial correlations of the road network, potentially overlooking potential effective connections.
[0003] This is crucial for optimizing urban traffic management and improving the efficiency of road resource utilization. In real-world complex traffic scenarios, traffic flow data exhibits strong non-stationary characteristics and dynamic evolution patterns, which places higher demands on prediction models. This paper addresses three key limitations of traditional models in long-term traffic forecasting: first, they struggle to accurately capture the long-term trend evolution of traffic flow; second, they lag in responding to instantaneous fluctuations caused by sudden abnormal events; and third, they lack the ability to model dynamic spatial correlations, especially at points where trends reverse, where models often exhibit prediction lag, underestimate peak values, or oversmoothness, leading to a significant decrease in response accuracy at these turning points. Summary of the Invention
[0004] This invention proposes a traffic flow prediction method based on generators and discriminators. By introducing a generative adversarial network framework and a frequency domain enhancement mechanism, it achieves a leap from "feature modeling" to "trend perception".
[0005] A traffic flow prediction method based on a generator and a discriminator includes the following steps: Step S1: The trend modeling module performs frequency domain transformation and principal component extraction; Step S2: The spatial coding module is coupled with adaptive topological convolution and dynamic spatiotemporal attention in parallel to extract the global topological evolution path and local dynamic associations, respectively, and then fused to generate a high-order spatial code. Step S3: The prediction generation module fuses the output features of the first two; Step S4: Input the output features into the adversarial optimization module. The adversarial optimization module uses a minimax game between the discriminator and the generator to make the predicted sequence produced by the generator infinitely close to the empirical distribution of the real traffic state in terms of statistical distribution.
[0006] Preferably, the trend modeling module uses discrete Fourier transform to project traffic flow into the frequency domain, extracts physically meaningful periodic components and low-frequency backbones; then, it replaces linear mapping with a nonlinear trend fitting method, captures the nonlinear characteristics of trend evolution through learnable spline functions, and generates a stable trend guidance representation.
[0007] Preferably, the spatial coding module receives the trend-guided representation generated by the trend modeling module. By using parallel adaptive topological convolution and dynamic spatiotemporal attention, features are extracted from the global topological evolution path and local dynamic associations, respectively. Finally, a high-order spatial encoding representation is generated through a collaborative fusion mechanism.
[0008] Preferably, the prediction generation module captures the temporal evolution features through the deep analysis trend modeling module. Heterogeneous spatial dependencies extracted by the spatial coding module Further predictions will be made.
[0009] Preferably, the prediction generation module constructs a nonlinear mapping system based on a multi-layer encoder-decoder architecture, and generates a future multi-step traffic state prediction sequence that conforms to the road network topology constraints through deep fusion of spatiotemporal features.
[0010] Preferably, the optimization objective of the standard adversarial mechanism against optimization modules can be formally defined as:
[0011]
[0012] in, Represents a real traffic observation sequence, The predicted value output by the generator.
[0013] Preferably, the anti-optimization module enables the generator to continuously evolve during the trend modeling and spatial encoding stages through gradient feedback from the dual discriminator.
[0014] Preferably, the generator's total loss function The optimization objective of the discriminator as follows:
[0015] .
[0016] The model of this invention adopts a generator-discriminator adversarial architecture. The four core modules include: a trend modeling module that captures the periodic and non-stationary features of traffic flow through frequency domain and trend fitting, providing trend guidance; a spatial encoding module that combines adaptive topological convolution and dynamic spatiotemporal attention in parallel to extract global topology and local dynamics, generating high-order spatial codes; a prediction generation module that fuses the features of the first two modules to output multi-step prediction values; and an adversarial optimization module that constructs a temporal and spatial dual discriminator, providing adversarial supervision from the perspectives of temporal coherence and spatial correlation, respectively, to ensure the spatiotemporal rationality of the generated samples.
[0017] The beneficial effects of this invention are: (1) A traffic flow prediction method based on generator and discriminator is proposed. This method effectively learns the complex spatiotemporal evolution law in traffic flow data through adversarial training of generator and discriminator, which significantly improves the stability and accuracy of long time series prediction.
[0018] (2) Design trend modeling module and spatial coding module, and construct a dual discriminator for the authenticity of time series pattern and the rationality of spatial flow relationship, so that the model can adaptively capture the global long-term trend and local dynamic correlation in traffic flow.
[0019] (3) Extensive experiments were conducted on multiple real-world datasets to verify the superior performance of the TrendGAT framework. Through various experiments and result analyses, the effectiveness of the trend enhancement module and adversarial learning mechanism was revealed, demonstrating that the proposed model has good interpretability. Attached Figure Description
[0020] Figure 1 A flowchart illustrating a traffic flow prediction method based on a generator and a discriminator; Figure 2 Trend Modeling Module Structure Diagram: Figure 3 Spatial coding module structure diagram; Figure 4 Generator structure diagram; Figure 5 Generate an adversarial network structure diagram; Figure 6 Ablation experiments on three datasets (a) ablation experiment on PEMS03 dataset, b) ablation experiment on PEMS04 dataset, and c) ablation experiment on PEMS08 dataset). Figure 7 Comparison of prediction results for the PEMS03 dataset (where (a) node 30 of the PEMS03 dataset and (b) node 135 of the PEMS03 dataset). Figure 8Comparison of prediction results for the PEMS04 dataset (where (a) PEMS04 dataset node 150 and (b) PEMS04 dataset node 195). Figure 9 Comparison of prediction results for the PEMS08 dataset (where (a) PEMS08 dataset node 50 and (b) PEMS08 dataset node 90). Detailed Implementation
[0021] To more clearly describe the inventive objectives, technical solutions, and advantages of the specific embodiments of this invention, the solutions in the specific embodiments will be described in detail below with reference to the accompanying drawings. The specific technical solutions involved in the following embodiments are merely for the purpose of clearly and completely describing the innovative technical solutions of this invention. They are only a part of the specific implementation methods that this invention can adopt, not all embodiments, and should not be construed as limiting the innovative solutions of this invention. Any solution that adopts the same inventive concept as this invention should be included within the protection scope of this invention.
[0022] For those skilled in the art, when understanding the solutions described in the specific embodiments of the present invention, conventional technical manuals in the field can be consulted. At the same time, appropriate understandings or adjustments can be made to the above-mentioned terms to deduce the same or similar technical solutions without creative effort.
[0023] Example 1
[0024] A traffic flow prediction method based on a generator and a discriminator includes the following steps: Step S1: The trend modeling module performs frequency domain transformation and principal component extraction; Step S2: The spatial coding module is coupled with adaptive topological convolution and dynamic spatiotemporal attention in parallel to extract the global topological evolution path and local dynamic associations, respectively, and then fused to generate a high-order spatial code. Step S3: The prediction generation module fuses the output features of the first two; Step S4: Input the output features into the adversarial optimization module. The adversarial optimization module uses a minimax game between the discriminator and the generator to make the predicted sequence produced by the generator infinitely close to the empirical distribution of the real traffic state in terms of statistical distribution.
[0025] Example 2
[0026] like Figure 1As shown, a traffic flow prediction method based on generators and discriminators is proposed. Using the basic structure of a generative adversarial network (GAN), a complete end-to-end prediction system is constructed through a collaborative optimization mechanism between the generator and discriminator. The core idea of the model is to enable the generator to not only learn to minimize prediction errors through an adversarial training strategy, but also to generate prediction results that conform to the characteristics of real traffic flow distribution in both spatiotemporal dimensions.
[0027] The generator adopts an encoder-decoder structure: the encoder uses a gated recurrent unit of a nested node adaptive graph convolution operator to extract spatiotemporal features from historical sequences and learn the dynamic evolution of traffic flow; the decoder uses the encoder's final state as the initial condition to recursively generate multi-step predictions.
[0028] The generator comprises three modules: a trend modeling module enhances the perception of long-term evolutionary trends through frequency domain transformation and principal component extraction; a spatial coding module combines adaptive topological convolution (ATC) and dynamic spatiotemporal attention (DSA) in parallel to extract global topological evolution paths and local dynamic correlations, respectively, and generates high-order spatial codes through collaborative fusion; and a prediction generation module fuses the output features of the first two modules to achieve multi-step prediction. The discriminator employs a dual mechanism: a time-series authenticity discriminator evaluates the rationality of the time dimension to ensure that the predicted fluctuation patterns and periodic characteristics conform to real evolutionary laws; and a spatial flow relationship discriminator analyzes the flow correlation between nodes to determine the consistency of the prediction results in the topological structure.
[0029] like Figure 2 As shown, the trend modeling module receives input data and follows the process of "time-frequency domain projection - frequency domain nonlinear enhancement - time-domain trend reconstruction": the traffic flow is projected to the frequency domain using the Discrete Fourier Transform (DFT) to extract physically meaningful periodic components and low-frequency backbones; then, the nonlinear trend fitting method (TFM) is used to replace the linear mapping, and the nonlinear characteristics of trend evolution are captured through learnable spline functions to generate a stable trend-guided representation, so that subsequent modules can focus on capturing residual features in spatiotemporal heterogeneity and achieve deep decoupling.
[0030] The model receives historical traffic flow sequences. in For batch size, To observe the length of historical windows, This represents the total number of nodes in the transportation network. In the initial stages of trend modeling, the module will use time-domain signals... Projecting to the complex frequency domain. To fully utilize the real-valued characteristics of traffic data and reduce computational complexity, a real-valued Fast Fourier Transform (RFFT) is used to project the time-domain signal to an orthogonal frequency domain:
[0031]
[0032] in, This represents the traffic flow sequence after centralized processing. Indicates the RFFT operation. The number of sampling points for the transformed frequency. This is the transformed complex mapping. Through this transformation, the intricate dynamic changes in the time domain are decomposed into a series of complex spectral coefficients with clear physical meanings, each coefficient... Each represents a specific frequency. The amplitude and phase information below.
[0033] In the frequency domain feature extraction stage, the module introduces a complex encoder to enhance the model's perception depth of periodic patterns, resulting in enhanced frequency domain features. The transformation process is as follows:
[0034]
[0035] After completing frequency domain feature extraction and enhancement, the module performs inverse real fast Fourier transform (IRFFT) to map the signal from the complex spectral domain back to the original time series space.
[0036]
[0037] in, Predicting the step size for the target yields a preliminary trend representation. Although it possesses a basic periodic shape, its ability to capture nonlinear trend drift in traffic flow is limited due to the linear stationarity assumption of the Fourier transform.
[0038] To further improve the fitting accuracy of the trend representation, the module uses a nonlinear trend fitting method instead of the traditional linear mapping for deep fitting at the end of the time-domain reconstruction path. This method breaks through the limitation of the fixed activation function of the traditional perceptron and uses learnable basis functions to refine the initially reconstructed trend for a second time:
[0039]
[0040] in, and These represent the basic activation term and the learnable spline fitting term, respectively. and To adjust the scaling factor, the nonlinear enhancement of TFM is used to accurately characterize the dynamic evolution of traffic flow trends, resulting in a trend-guided representation with high smoothness and regularity. .
[0041] The dependencies between traffic nodes are not only constrained by the topology of the physical road network, but also exhibit highly dynamic propagation characteristics and local fluctuations. Therefore, the spatial coding module receives the trend-guided representation generated by the trend modeling module. By employing parallel adaptive topological convolution (ATC) and dynamic spatiotemporal attention (DSA), features are extracted from the global topological evolution path and local dynamic associations, respectively. Finally, a high-order spatial encoding representation is generated through a collaborative fusion mechanism, such as... Figure 3 As shown.
[0042] Adaptive topological convolution primarily addresses the problem that static graph structures cannot describe the dynamic propagation characteristics of traffic flow. It embeds graph convolution operations into a recurrent neural architecture and utilizes multilayer perceptrons (MLPs) to achieve nonlinear enhancement of node embedding, thereby accurately fitting the evolutionary paths between nodes.
[0043] ATC uses a node embedding matrix Adaptively learn the latent topological space, utilize MLP to perform feature transformation on node embeddings, and generate an adaptive adjacency matrix with spatiotemporal awareness. :
[0044]
[0045] To capture the temporal evolution of traffic flow, ATC combines graph convolution with gated recurrent units (GRUs). For the input trend representation, its hidden state... The update logic is as follows:
[0046]
[0047] in, and To update and reset the door, , and This is the weight matrix. , and For bias terms, Indicated based on adaptive matrix Chebyshev polynomial graph convolution operation. Through the temporal memory capability of GRU and the spatial diffusion capability of GCN, ATC can characterize the long-range propagation path of traffic between road network nodes, and realize deep encoding of the macroscopic topological evolution law of traffic network.
[0048] For any central node and its local neighborhood DSA first calculates the dynamic correlation scores between nodes. This score is determined through a shared weight matrix. and Perform linear projection and enhance expressiveness using a nonlinear activation function:
[0049]
[0050] in, It is an aggregated representation of trend features extracted by the trend modeling module within a time window. To address the drastic nature of local traffic fluctuations, DSA introduces spatially normalized weights. ;
[0051]
[0052] Ultimately, through multi-head parallel computation, DSA is able to capture local dynamics from multiple feature subspaces:
[0053]
[0054] To achieve complementary advantages between the two, the module proposes a fusion operator based on a gating mechanism:
[0055]
[0056] in It is the fused weight matrix obtained. It contains both smooth evolutionary path information and fine-grained local correlation dynamics.
[0057] The prediction generation module is the output of the entire architecture, capturing the temporal evolution features through deep analysis of the trend modeling module. Heterogeneous spatial dependencies extracted by the spatial coding module Further predictions are needed. For example... Figure 4 As shown, this module constructs a nonlinear mapping system based on a multi-layer encoder-decoder architecture, which generates a future multi-step traffic state prediction sequence that conforms to the road network topology constraints through deep fusion of spatiotemporal features.
[0058] The generator's input layer first performs a feature fusion operation, concatenating trend-guided features and spatially encoded features along the feature dimension to construct an augmented spatiotemporal feature tensor. The encoder section consists of The layer contains nested node-adaptive graph convolution operators. It is composed of gated recurrent units (Graph-GRU) connected in series. For the first... Layer encoder in The core process of state updates at any given moment is as follows:
[0059]
[0060] in, The input is a concatenated vector of the hidden state from the previous time step. and These represent the update gate and the reset gate, respectively, which regulate the ratio of forgetting to retaining historical spatiotemporal information. It is an adaptive adjacency matrix passed by the spatial coding module.
[0061] To further enhance the model's ability to perceive node specificity, the operator An adaptive parameter pooling mechanism for nodes is employed. This is achieved by introducing a node embedding matrix. Implement graph convolution weights and bias Dynamic generation:
[0062]
[0063] Combining Chebyshev polynomial expansion, The complete space aggregation logic of the operator is as follows:
[0064]
[0065] in, for The Chebyshev recursive term ensures that the model can adaptively adjust the spatial diffusion intensity based on the inherent properties of different road segments.
[0066] After the encoder completes recursive modeling for all historical time steps, the model extracts the top-level terminal hidden states. As a global context representation, unlike traditional autoregressive decoding schemes, this study employs a non-recursive convolutional prediction architecture to eliminate the risk of error accumulation during the prediction process. The decoder first uses layer normalization (LayerNorm) to calibrate the feature distribution and introduces Dropout to suppress overfitting:
[0067]
[0068] Then, a two-dimensional convolution operator is used to perform cross-dimensional feature decomposition, directly projecting the deep hidden features into the future. Output space for each prediction step:
[0069]
[0070] in, represents the set of convolution kernel parameters, which represents the learnable weight matrix and bias of the convolutional layer.
[0071] Finally, through tensor reconstruction (Reshape) and axis permute operations, the... Mapped to the final prediction result This logical architecture, which goes from recursive encoding to parallel decoding, maintains the ability to model long-term dependencies while achieving efficient sequence generation through convolutional decoding, ensuring the consistency of prediction results under both temporal fluctuations and road network topology constraints.
[0072] After initially generating the predicted sequence, to further improve the fitting accuracy of this invention for the complex nonlinear fluctuations and long-period evolution patterns of traffic flow, this invention introduces the game-theoretic optimization concept of Generative Adversarial Networks (GANs). The core logic of the adversarial optimization module is to use a minimax game between the discriminator and the generator to make the predicted sequence produced by the generator infinitely close in statistical distribution to the empirical distribution of the actual traffic state. Figure 5 As shown, the optimization objective of the standard adversarial mechanism can be formally defined as:
[0073]
[0074] in, Represents a real traffic observation sequence, The predicted value output by the generator.
[0075] Time series authenticity discriminator The focus is on evaluating the rationality of the generated sequence's evolution over time, ensuring that the prediction results conform to the physical reality of traffic flow in terms of fluctuation patterns, peak characteristics, and periodicity. Its input is a spliced sequence of historical observations. With predicted sequence Complete temporal tensor To overcome the limitations of traditional multilayer perceptrons (MLPs) in capturing subtle nonlinear trends, this study introduces a linear layer, TFMLinear, based on the nonlinear trend fitting method (TFM), into the discriminator, which can more accurately characterize the complex dynamic features of traffic flow. For the input... Feature vectors after flattening The mapping logic through multiple TFM operators can be expressed as:
[0076]
[0077] in, This represents a weighted combination of spline basis functions. Through this design... This forces the generator to learn the long-term time dependence and short-term random fluctuations of traffic flow, thereby effectively avoiding numerical drift or smoothing over-processing in the generation process.
[0078] Spatial flow relationship discriminator From a spatial topology perspective, optimization can be aided by examining the logical coordination of traffic distribution among road network nodes. In real road networks, traffic changes between adjacent or strongly correlated road segments should follow an inherent spatial diffusion logic, and generating sequences that only achieve numerical approximations often ignore this hidden topological constraint. By constructing a dynamic association matrix between nodes This relationship is quantified by generating predicted values. The formula for calculating the autocorrelation between nodes is defined as follows:
[0079]
[0080] An adaptive adjacency matrix is introduced at the location using a spatial encoding module. As a topological prior, this allows the discriminator to focus on node pairs with strong physical connections and potential correlations. The discriminator uses a dedicated spatial TFM network to determine the authenticity of the correlation matrix.
[0081]
[0082] This spatial discrimination logic ensures that the generator must consider the spatial alignment and structural coordination between the output values of each node during the convolution mapping process, effectively solving the shortcomings of traditional prediction where the prediction results between nodes are fragmented and do not conform to the global flow logic.
[0083] The entire adversarial optimization module utilizes gradient feedback from a dual discriminator to continuously evolve the generator during trend modeling and spatial encoding. During training, the model follows a minimax game objective and combines regression loss with dual adversarial loss. The generator's total loss function... The optimization objective of the discriminator The following structures are constructed respectively:
[0084]
[0085] By adjusting the weighting factors and The model achieves an optimal balance between regression accuracy and consistency in temporal-spatial dual distribution. This dual-discrimination mechanism, along with trend-guided representation and adaptive topological evolution convolution, forms a tight logical loop: trend modeling provides the evolutionary direction, spatial encoding provides topological constraints, and adversarial optimization ensures that the predicted results have high fit and interpretability in both the temporal and spatial spectra through dual discrimination.
[0086] To verify the effectiveness of the method of this invention, model performance was tested based on three real public datasets: PEMS03, PEMS04, and PEMS08, as detailed in Table 1. The PEMS03 dataset covers 358 sensors, collecting data for 91 days from September 1st to November 30th, 2018, with traffic flow (F) as the signal type. The PEMS04 dataset contains 307 sensors, spanning 59 days from January 1st to February 28th, 2018, providing three traffic parameters: traffic flow (F), speed (S), and occupancy (O). The PEMS08 dataset contains 170 sensors, collecting data for 62 days from July 1st to August 31st, 2016, also including traffic flow, speed, and occupancy signals. These datasets demonstrate good differentiation in terms of the number of nodes, time span, and signal dimensions, laying a reliable data foundation for subsequent spatiotemporal feature extraction and generalization ability evaluation of the model.
[0087]
[0088] In the experiment, the three datasets were divided into training, validation, and test sets in a 6:2:2 ratio. Data for the next hour was predicted using historical data from the previous hour. Since the sampling frequency for all three datasets was 5 minutes, the observation and prediction step size was set to 12. The batch size, RNN unit count, and training epochs were all set to 64 for all three datasets, with an initial learning rate of 0.003. Some configurations are shown in Table 2.
[0089]
[0090] To verify the effectiveness of the proposed model framework, 10 benchmark models were selected for comparison, and the proposed model was evaluated using three performance metrics: MAE, RMSE, and MAPE. The selected benchmark models are as follows: 1) ARIMA: Combining autoregressive (AR), integral (I), and moving average (MA) components, it can capture linear dependencies and trend changes in univariate time series, but it is difficult to handle nonlinear or spatially complex traffic flow data.
[0091] 2) FC-LSTM: Based on the LSTM architecture, it captures long-term dependencies in time series through a gating mechanism and combines fully connected layers for feature mapping and prediction output.
[0092] 3) DCRNN: Introduces Diffusion GCN and Gated Recurrent Unit (GRU) to model spatiotemporal dependencies. By using GRU instead of traditional RNN, it can better capture complex dynamic changes in time series.
[0093] 4) STGCN: Combines graph convolution (GCN) with gated convolutional neural networks (Gated CNN) to extract spatiotemporal features based on static graph structures, and can capture both spatial and temporal dependencies in the data.
[0094] 5) ASTGCN: Introduces an attention mechanism to enhance the spatiotemporal graph convolutional network. It dynamically captures the strength of associations and temporal dependencies between nodes through spatial attention and temporal attention modules, but has high computational complexity.
[0095] 6) GraphWaveNet: Uses an adaptive adjacency matrix for graph learning, combined with one-dimensional dilated convolution (DilatedCNN) to capture multi-scale temporal dependencies, improving the model's flexibility and generalization ability.
[0096] 7) AGCRN: It uses node embedding to build adaptive graph convolutions and combines GRU to capture fine-grained spatiotemporal dynamics, enhancing the capabilities of traditional graph convolutional networks and enabling automatic capture of fine-grained spatiotemporal correlations in traffic sequence data.
[0097] 8) MTGNN: Combining graph convolution and temporal convolution modules, it automatically learns the dependencies between nodes in multivariate time series. It performs well on large-scale datasets, but its advantages are not significant for small-scale datasets.
[0098] 9) STGODE: Constructs a spatiotemporal continuous dynamic system based on the ordinary differential equation (NODE), and combines graph convolution with an ordinary differential equation solver to model the continuous evolution process of spatiotemporal interaction.
[0099] 10) DGCRN: By combining dynamic graph structure learning with gated recurrent units, it adaptively generates adjacency matrices using node embedding and achieves multi-step prediction based on an encoder-decoder framework.
[0100] The proposed model was evaluated against several representative benchmark models using multi-dimensional metrics on three public datasets with different characteristics: PEMS03, PEMS04, and PEMS08. This validated the comprehensive performance of the constructed spatiotemporal architecture in traffic flow prediction. The experimental results are shown in Table 3. Under different datasets, the proposed model demonstrated the best prediction performance in the three core metrics: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Mean Absolute Percentage Error (MAPE). Data analysis shows that on the PEMS03 dataset, compared to the second-best performing MTGNN model, the proposed model reduced the MAE from 15.10 to 14.67, a decrease of 2.85%, and also achieved a significant reduction in MAPE compared to AGCRN. On the PEMS04 dataset, which has a more complex topology and more volatile sample data, the proposed model's MAPE decreased by approximately 5.83% compared to AGCRN. This consistent advantage across different road network environments not only demonstrates the model's leading position in multi-step prediction tasks, but also reflects the model's extremely strong fitting depth and generalization stability to spatiotemporal data distribution characteristics.
[0101]
[0102] In handling long-term trend evolution, traditional models such as DCRNN or STGCN often suffer from severe cumulative errors and trend shifts at the back end of the full prediction step due to their reliance on static topology or simple recursive mechanisms. This model, however, performs a priori frequency domain deconstruction of traffic flow through a trend modeling module, and uses Adaptive Topological Evolutionary Convolution (ATC) to recursively extrapolate spatiotemporal states, ensuring that the predicted trajectory remains highly consistent with the actual trend across the entire timescale. For non-stationary fluctuations caused by sudden abnormal events, the integrated Dynamic Spatiotemporal Association Attention (DSA) overcomes the limitations of physical connectivity by instantaneously redistributing weights within local neighborhoods through a Query-Key mechanism. This allows for rapid adjustment of the contribution of spatial correlations during sudden changes in traffic flow, significantly improving the model's sensitivity to capturing dynamic spatial correlations.
[0103] Traditional regression models tend to minimize global residuals during optimization, often resulting in overly smoothed prediction curves and lags in response at key turning points in traffic flow. Therefore, to address the core challenge of insufficient response capability at trend inflection points in long-term time-series prediction tasks, this paper proposes a dual-discrimination adversarial optimization mechanism. The time-series discriminator utilizes the nonlinear fitting characteristics of spline basis functions in TFM networks to discriminate the dynamic characteristics of the generated sequence, forcing the generator to learn the true nonlinear fluctuation slope. Simultaneously, the spatial flow relationship discriminator ensures that the predicted values maintain both numerical accuracy and topological consistency in the road network through structured verification of the inter-node correlation matrix. This joint training mode of "regression prediction + dual discrimination" enables the model to respond earlier and more accurately than the baseline model when facing drastic fluctuations and turning points in traffic flow, demonstrating the superior performance and robustness of this model in dealing with long-term evolution patterns and complex local anomalies.
[0104] To further verify the rationality of the proposed prediction method and its core innovative components, ablation experiments were conducted on the model on which the prediction method is based, and the experimental results were analyzed: w / o TMM: To verify the cornerstone role of the Trend Modeling Module (TMM), this experiment replaced the path combining Discrete Fourier Transform (DFT) and Nonlinear Trend Fitting (TFM) with the traditional time-step linear projection. Results show that this variant exhibits the most significant performance degradation across all datasets. Under this variant, the model loses its macroscopic anchoring to the global periodicity and long-term evolutionary trends of traffic flow, making the generator highly susceptible to local noise interference when handling multi-step predictions and unable to capture the essential characteristics of non-stationary time series.
[0105] w / o ATC: To evaluate the contribution of Adaptive Topological Convolution (ATC) in extracting spatial structure features, the adaptive adjacency matrix dynamically generated by node embedding vectors in the model was replaced with a static graph structure defined based on physical distance. Experiments showed that this variant performed poorly on datasets with complex road network structures. This demonstrates that static physical graphs are insufficient to characterize the dynamic evolution of traffic flow over time in reality, while the ATC designed in this study significantly enhances the model's ability to express spatially heterogeneous interactions.
[0106] w / o DSA: To investigate the ability of Dynamic Spatiotemporal Association Attention (DSA) to capture local instantaneous fluctuations, it was separated from the dual-path spatial coding module, degenerating the spatial coding module into a pure convolutional structure. Results show that this variant has a relatively small impact on experimental results, but performance metrics still decrease. After ablating DSA, the model loses its ability to capture local instantaneous fluctuations. The non-linear weighting capability of the mechanism leads to a significant decrease in its sensitivity to responding to sudden changes in traffic flow or unexpected traffic events during morning and evening rush hours.
[0107] w / o Dual-D: To verify the advantages of the dual-discrimination adversarial optimization mechanism based on TFM networks, this experiment replaced the discriminator with a traditional multilayer perceptron (MLP) structure and eliminated the spatiotemporal dual-discrimination stage, reverting to a pure supervised learning mode. Data shows that performance significantly decreases under this variant. This indicates that standard MLPs struggle to accurately characterize complex spatiotemporal dynamic distributions using spline basis functions, unlike the TFM operator. The introduction of the dual discriminator forces the model to maintain numerical accuracy while ensuring that the predicted curve possesses realistic physical fluctuation characteristics at key inflection points.
[0108] Figure 6 The ablation results visually demonstrate the differentiated contributions of each component to model performance. Removing the Trend Modeling Module (TMM) resulted in a sharp increase in prediction error across the three datasets; for example, the MAE of PEMS03 increased by 36.3%, confirming the fundamental role of frequency domain deconstruction and global trend anchoring in non-stationary traffic flow prediction. Spatial dimension ablation further reveals the synergistic effect of ATC and DSA. Stripping Adaptive Topological Convolution (ATC) degrades model performance when handling complex road networks due to a lack of dynamic manifold awareness; for example, the MAE of PEMS04 increased by 17.3%. Removing Dynamic Spatiotemporal Attention (DSA) significantly weakens the sensitivity to capturing instantaneous flow correlations. Furthermore, the absence of the Dual-D discriminator led to a 25.2% deterioration in the MAE of PEMS08, demonstrating the irreplaceable value of adversarial discrimination in correcting prediction distributions and avoiding excessive curve smoothing.
[0109] To more intuitively evaluate the predictive performance of the model based on the method of this invention in real traffic scenarios, representative sensor nodes in the road network were selected, and their predicted values at different prediction step sizes were compared with the actual observed values, such as... Figures 7 to 9 As shown, the blue curve represents the actual traffic flow, and the pink curve represents the model's predicted value.
[0110] The visualization results clearly demonstrate that the predicted trajectories generated by the proposed TrendGAT model closely match the actual traffic flow trends. During off-peak hours when traffic flow is relatively stable, the predicted curves almost perfectly match the actual values, showcasing the model's extremely high regression accuracy. Even during peak hours and other periods of drastic traffic fluctuation, the model can still robustly track sudden increases and decreases in traffic flow without significant prediction lag or large numerical deviations.
[0111] By deeply observing key turning points such as "peaks" and "troughs" in the curve, the effectiveness of the innovative module of this model can be further verified. Traditional traffic prediction models often exhibit oversmoothing when facing traffic peaks due to the pursuit of minimizing the global residual, resulting in predicted values that fail to reach the true peak height. Thanks to the Dual-D discriminant adversarial optimization mechanism and the nonlinear trend fitting method (TFM) for keenly capturing nonlinear correlations, this model demonstrates excellent response sensitivity at key turning points. The model not only accurately predicts the arrival time of the peak but also maintains a high degree of consistency with the actual curve in terms of fluctuation slope. This proves that adversarial logic can force the generator to learn the true physical distribution of traffic evolution, rather than simply fitting numerical values.
[0112] Furthermore, the visualization results also reflect the supporting role of the trend modeling module in long-term forecasting. Even in the later time steps of multi-step forecasting, the forecast curve still maintains good forecasting performance. This performance, which takes into account both global trend stability and local detail sensitivity in the time domain, fully demonstrates the superiority of the TrendGAT architecture in processing complex and non-stationary traffic flow data.
[0113] In terms of the prediction model composition of the prediction method of this invention, the generator integrates a trend modeling module, a spatial encoding module, and a prediction generation module. The trend modeling module extracts principal components through frequency domain analysis, enhancing the model's ability to perceive long-term evolution trends. The spatial encoding module integrates Adaptive Topological Evolution Convolution (ATC) and Dynamic Spatiotemporal Association Attention (DSA) to achieve accurate modeling of the dynamic influence relationships between nodes in the road network topology. The prediction generation module fuses the output features of the two modules to generate future traffic states. Regarding the discriminator construction, the model is designed with a dual discrimination mechanism including a time-series authenticity discriminator and a spatial flow relationship discriminator, evaluating from two dimensions: temporal fluctuation patterns and spatial topological consistency, to ensure the rationality of the prediction results.
[0114] The prediction model was systematically tested on three large-scale real-world datasets: PEMS03, PEMS04, and PEMS08. Performance comparison experiments, ablation experiments, and prediction visualization experiments were conducted. Experimental results show that TrendGAT exhibits significantly smoother error growth in multi-step prediction tasks, and outperforms existing mainstream benchmark models across all evaluation metrics. It effectively alleviates accuracy decay and oversmoothing issues in long-term predictions, significantly improving the model's robustness and generalization ability in complex, non-stationary traffic scenarios.
[0115] The above embodiments describe only the basic principles, main features and / or advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and the description of the invention content in the specification are only the principles or specific cases of the present invention. Without departing from the essence of the innovative idea of the present invention, there are various changes and improvements to the innovative solution of the present invention, and all such changes and improvements fall within the scope of protection claimed by the present invention.
Claims
1. A traffic flow prediction method based on a generator and a discriminator, comprising the following steps: Step S1: The trend modeling module performs frequency domain transformation and principal component extraction; Step S2: The spatial coding module is coupled with adaptive topological convolution and dynamic spatiotemporal attention in parallel to extract the global topological evolution path and local dynamic associations, respectively, and then fused to generate a high-order spatial code. Step S3: The prediction generation module fuses the output features of the first two; Step S4: Input the output features into the adversarial optimization module. The adversarial optimization module uses a minimax game between the discriminator and the generator to make the predicted sequence produced by the generator infinitely close to the empirical distribution of the real traffic state in terms of statistical distribution.
2. The traffic flow prediction method based on generator and discriminator according to claim 1, characterized in that, The trend modeling module uses discrete Fourier transform to project traffic flow into the frequency domain, extracting physically meaningful periodic components and low-frequency backbones; then, a nonlinear trend fitting method (replacing linear mapping) is used to capture the nonlinear characteristics of trend evolution through learnable spline functions, generating a stable trend guidance representation.
3. The traffic flow prediction method based on generator and discriminator according to claim 1, characterized in that, The spatial coding module receives the trend-guided representation generated by the trend modeling module. By using parallel adaptive topological convolution and dynamic spatiotemporal attention, features are extracted from the global topological evolution path and local dynamic associations, respectively. Finally, a high-order spatial encoding representation is generated through a collaborative fusion mechanism.
4. The traffic flow prediction method based on generator and discriminator according to claim 1, characterized in that, The prediction generation module captures the temporal evolution features through deep analysis of the trend modeling module. Heterogeneous spatial dependencies extracted by the spatial coding module Further predictions will be made.
5. The traffic flow prediction method based on generator and discriminator according to claim 1, characterized in that, The prediction generation module constructs a nonlinear mapping system based on a multi-layer encoder-decoder architecture, and generates a multi-step traffic state prediction sequence that conforms to the road network topology constraints through deep fusion of spatiotemporal features.
6. The traffic flow prediction method based on generator and discriminator according to claim 1, characterized in that, The optimization objective of the standard adversarial mechanism for anti-optimization modules can be formally defined as: ; in, Represents a real traffic observation sequence, The predicted value output by the generator.
7. The traffic flow prediction method using a generator and discriminator according to claim 1, characterized in that, The anti-optimization module enables the generator to continuously evolve during the trend modeling and spatial encoding stages through gradient feedback from the dual discriminator.
8. The traffic flow prediction method using a generator and discriminator according to claim 1, characterized in that, Total loss function of the generator The optimization objective of the discriminator as follows: 。