A traffic flow prediction method based on exogenous variable enhancement

CN122548638APending Publication Date: 2026-08-11CHINA UNIV OF MINING & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-25
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

现有方法多直接对原始序列进行建模,缺乏对不同时间尺度特征的有效分解与利用,从而限制了模型对复杂时序结构的表达能力

Benefits of technology

1)本发明通过引入外源数据的趋势项与季节项,并结合余弦相似度的空间聚合机制,在未显著增加目标数据输入长度的前提下,有效增强了模型对长期周期性与趋势性特征的学习能力;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122548638A_ABST
    Figure CN122548638A_ABST
Patent Text Reader

Abstract

The application discloses a traffic flow prediction method based on exogenous variable enhancement, comprising the following steps: obtaining historical traffic flow data of a target area as target data, and obtaining historical traffic flow data of an exogenous area as exogenous data; exogenous information screening and spatial correlation modeling; mapping the target data and the exogenous enhanced data to a unified feature space, and independently mapping each time step; globally modeling the fused feature representation in space and time; locally modeling the spatial and temporal features: dividing the time sequence into multiple continuous subsequences patches, and locally modeling; feature fusion and prediction output; model training: constructing a loss function, and training model parameters by using a gradient descent optimization algorithm, after the training is completed, applying the model to a traffic flow prediction task to realize prediction of a future traffic state of the target area. The application can realize deep fusion of multi-source information, and improve the prediction accuracy and stability of a traffic flow prediction model in a complex scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traffic science and deep learning technology, specifically relating to a traffic flow prediction method based on external variable enhancement. Background Technology

[0002] With the rapid development of intelligent transportation systems, traffic flow prediction, as a crucial foundational technology supporting traffic management and scheduling optimization, plays a key role in applications such as urban traffic operation analysis, route planning, and congestion mitigation. In recent years, deep learning-based methods, especially spatiotemporal modeling methods that integrate spatial structure and temporal dynamic features, have made significant progress in short-term traffic flow prediction tasks. For example, graph-based spatiotemporal neural networks can effectively characterize the temporal evolution of road network topology and traffic states, demonstrating high prediction accuracy on multiple public datasets. However, in more practical medium- and long-term traffic flow prediction scenarios, existing technologies still face significant challenges.

[0003] On the one hand, transportation systems are affected by various uncertainties, such as traffic congestion, weather changes, and emergencies. These factors exhibit strong randomness and complexity over time, and their interference with the prediction results accumulates as the prediction timeframe increases, significantly reducing the model's prediction accuracy. On the other hand, transportation networks exhibit significant regional heterogeneity in geospatial terms. Different regions show significant differences in traffic demand structure, travel patterns, and functional attributes, making it difficult for the model to maintain stable generalization ability in complex scenarios.

[0004] In existing technologies, most traffic flow prediction methods rely primarily on historical traffic flow data within a single region to model future states, i.e., they accomplish the prediction task by mining the spatiotemporal dependencies within the target area. However, from the perspective of traffic flow formation mechanisms, it essentially reflects the comprehensive results of human travel behavior, and different regions often exhibit certain similarities and transferability in long-term trends and periodic fluctuation patterns. Existing methods typically fail to fully exploit these shared temporal characteristics across regions, resulting in limited model performance when facing complex or data-sparse scenarios. Furthermore, although some studies have attempted to introduce external factors such as weather and events as auxiliary information, existing methods still utilize external information in a relatively simple way, usually only directly inputting it into the model as an additional feature, lacking an effective modeling mechanism for the deep correlation between external information and traffic flow, and failing to fully leverage the potential value of external information in improving prediction performance.

[0005] On the other hand, traffic flow time series typically contain multiple components, including long-term trends, periodic changes, and random disturbances. Among these, long-term trends and periodic patterns better reflect the inherent laws of traffic flow evolution compared to the original series. Existing methods mostly model the original series directly, lacking effective decomposition and utilization of features at different time scales, thus limiting the model's ability to express complex temporal structures. Summary of the Invention

[0006] The purpose of this invention is to provide a traffic flow prediction method based on external variable enhancement, which can achieve deep fusion of multi-source information and improve the prediction accuracy and stability of traffic flow prediction models in complex scenarios.

[0007] To achieve the above objectives, this invention provides a traffic flow prediction method based on enhanced exogenous variables, comprising the following steps: S1, Obtain historical traffic flow data for the target area. As target data, historical traffic flow data from external regions are also acquired. As external data, STL is used to perform time series decomposition on the external data to obtain trend components. Seasonal Quantity ;in, This indicates the batch size of the model input. The number of nodes in the target dataset. Input the time step into the model. Provide the number of nodes in the external dataset; S2, External Information Filtering and Spatial Relevance Modeling: Calculating the Spatial Similarity between Target Data and External Data Based on Cosine Similarity. and Based on the similarity results, weighted aggregation of external data is performed to obtain the external prompts most relevant to the target region. : ,in, This represents the trend component feature most relevant to the target data. This represents the seasonal component feature most relevant to the target data; ; ; S3 maps the target data and external enhancement data to a unified feature space, performing independent mapping at each time step: , , ; in, For fully connected layers or 1×1 convolutions, the aim is to convert the input shape Mapped to , The embedding dimension of the fully connected layer's output vector is then concatenated along the feature dimension to obtain the fused representation. : , This represents a vector concatenation operation, which joins two vectors along the last feature dimension. for The embedding dimension of a vector. ; S4, Feature representation after fusion Perform global spatiotemporal modeling; S5, Local Spatiotemporal Feature Modeling: Divide the time series into multiple continuous sub-sequence patches, and perform local modeling within each patch. The spatiotemporal features of each patch are output as follows: ; S6, Feature Fusion and Prediction Output: Features learned from different patches are integrated to obtain fused features. : ; Next, a one-dimensional convolution is used to map the features to the final prediction space, yielding the final traffic flow prediction result. : ; in, For the final output of the model, Indicates the time step of the forecast; S7, Model Training: Construct a loss function and use the gradient descent optimization algorithm to train the model parameters. After training, apply the model to the traffic flow prediction task to predict the future traffic conditions of the target area.

[0008] As a further aspect of the present invention, the cosine similarity calculation method in S2 is as follows: ; in, Represents the target data, with the shape of , Indicates exogenous characteristics, trend components Or seasonal portion All shapes , obtained Shape .

[0009] As a further aspect of the present invention: global spatiotemporal modeling includes two aspects: time dimension and space dimension, and the local steps include: S4-1, Time Dependency Modeling: Modeling the time series of each spatial node along the time dimension, using the time dimension as the sequence dimension, and employing a multi-head self-attention mechanism to capture long-term dependencies: ; in, This represents a multi-head self-attention function. , and From input Obtained through linear transformation. Represents the query vector. Represents the key vector. Represents a value vector; S4-2, Spatial Dimension Modeling: In the spatial modeling process, topological information of the transportation network is introduced, and the adjacency matrix is ​​integrated into the attention weights. The spatial feature representation is obtained as follows: ; ; in, Represents the spatial attention function. Represents the normalized exponential function, Obtained by linear mapping from the current input. It is a normalization function for maximum and minimum values; These are trainable parameters; S4-3. Global Feature Fusion: This involves fusing temporal and spatial features to obtain a global spatiotemporal representation. : .

[0010] As a further aspect of the present invention: Step S5 specifically includes: S5-1, Data Segmentation: Assume the patch length is... The non-overlapping length between two consecutive patches is Step, which represents the length of the input data over time. Cut to obtain One patch, , This represents the data for the i-th patch; S5-2, Temporal Local Modeling: For each spatial node within each patch, temporal convolution is used to extract local dependencies. ; in, , These represent the kernel size as follows: and Temporal convolution kernel; Represents the convolution operator. ReLU is the layer normalization function, and ReLU is the activation function. S5-3, Dynamic Spatial Modeling: Dynamically constructing spatial relationships based on the current input: ; in, Represents the static adjacency matrix of the transportation network; After obtaining the dynamic adjacency matrix, the spatial features of the data are modeled using graph convolution operations: ; in, These represent the trainable parameters of the model; S5-4, Local Feature Fusion: Concatenate the outputs of spatiotemporal convolution along the feature dimension to obtain an output that fuses spatiotemporal features. : .

[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: 1) This invention effectively enhances the model's ability to learn long-term periodic and trend features without significantly increasing the length of the target data input by introducing trend and seasonal terms from external data and combining them with the spatial aggregation mechanism of cosine similarity. 2) In global spatiotemporal feature mining, a spatial attention module that integrates adjacency matrices was designed, enabling the model to simultaneously capture data-driven dynamic correlations and static connectivity relationships determined by road network topology. 3) In local spatiotemporal feature mining, a combination of patch segmentation and spatiotemporal convolution is used to overcome the deficiency of point-like attention mechanisms in ignoring contextual continuity, significantly improving the ability to model fine spatiotemporal evolution patterns within local time windows: 4) The overall model structure is clear, can be trained end-to-end, and has high prediction accuracy and good stability. Attached Figure Description

[0012] Figure 1 This is a framework diagram of the traffic flow prediction method based on external variable enhancement of the present invention; Figure 2 This is a schematic diagram of the Shapefile format for external regional road network data in an embodiment of the present invention: dots represent road segment markers; Figure 3 This is an example diagram of the STL decomposition result of a certain node in the BJ_Taxi dataset in an embodiment of the present invention; Figure 4 This is an example of time-series data patching in an embodiment of the present invention. P =6; S =4). Detailed Implementation

[0013] The present invention will be further illustrated by the following examples.

[0014] Using the PEMS series datasets (PEMSD3, PEMS04, PEMS08) widely used in traffic flow prediction as the target area data, such as... Figure 2 As shown, taxi trajectory data from a certain area is used as external regional data. By enhancing external variables, the accuracy of traffic flow prediction in the target area is improved.

[0015] like Figure 1 As shown, a traffic flow prediction method based on exogenous variable enhancement includes the following steps: S1, Obtain historical traffic flow data for the target area. As the target data, among which, This indicates the batch size of the model input (set to 16). The number of nodes in the target dataset (PEMSD3 dataset contains 358 sensors, PEMSD8 dataset contains 170 sensors, and PEMSD4 dataset contains 307 sensors). Input the time step into the model (12 historical time steps, 5 minutes each). Simultaneously acquire historical traffic flow data from external regions. The STL decomposition method is used to perform time series decomposition on the external source data (e.g., Figure 3 As shown), the trend components are obtained. Seasonal Quantity , The number of nodes in the external dataset is indicated (in this example, a certain region has a total of 128 regional nodes). S2, External Information Screening and Spatial Relevance Modeling. To enhance the effectiveness of external information, the spatial similarity between the target data and external data is calculated using cosine similarity as the metric, with the target data's first spatial similarity being the most significant factor. The spatial node and the first external data Taking the cosine similarity of spatial nodes as an example, its calculation method is as follows: ; in, Represents target data (shape is) ), Indicates exogenous characteristics (trend components) Or seasonal portion All shapes ), obtained Shape , This is the vector number for the data in the time dimension.

[0016] Based on the similarity results, the external information is weighted and aggregated to obtain the external prompts most relevant to the target region: ; ; in, This represents the trend component feature most relevant to the target data. This represents the seasonal component feature most relevant to the target data; Matrix multiplication is performed along the dimension of the external nodes: for each batch, the similarity matrix is... External data matrix Multiplication aggregates external information into the target node space, resulting in... , and They have the same spatial dimensions.

[0017] S3 maps the target data and external enhancement data to a unified feature space. Independent mapping is performed at each time step, implemented using a 1×1 convolution: , , ; in, For fully connected layers or 1×1 convolutions, the aim is to convert the input shape Mapped to , The embedding dimension of the fully connected layer output vector is set to 32, and then concatenated along the feature dimension to obtain the fused representation. : , This represents a vector concatenation operation, which joins two vectors along the last feature dimension. for The embedding dimension of a vector. ; S4, Feature representation after fusion Perform global spatiotemporal modeling, including both time and space dimensions: S4-1, Time Dependency Modeling. This involves modeling the time series of each spatial node along the time dimension. Using the time dimension as the sequence dimension, a multi-head self-attention mechanism is employed to capture long-term dependencies. ; ; ; ; in, , and From input Obtained through linear transformation. , , as well as For trainable parameters ( Set to 8); The feature dimension of a single attention head is represented (set to 4). The function represents concatenating the outputs of all individual attention heads. For activation function, For multi-head attention functions, It is a single-head attention function. Let i represent the attention head function.

[0018] S4-2, Spatial Dimension Modeling. In the spatial modeling process, topological information of the transportation network is introduced. Specifically, the adjacency matrix is ​​fused into the attention weights. The spatial feature representation is obtained as follows: ; ; in, Represents the spatial attention function. Represents the normalized exponential function, Obtained by linear mapping from the current input. It is a normalization function for maximum and minimum values; These are trainable parameters.

[0019] 4-3, Global Feature Fusion. Temporal and spatial features are fused to obtain a global spatiotemporal representation. : ; S5, Local Spatiotemporal Feature Modeling. To further characterize fine-grained changes over a short time range, the time series is divided into multiple continuous sub-sequence patches, and local modeling is performed within each patch. The spatiotemporal features of each patch are output as follows: .

[0020] S5-1, Data Segmentation. Assume the patch length is... (Set to 6), meaning the step size is 6, and the non-overlapping length between two consecutive patches is Step (set to 2), which is the time dimension for the input data. Perform cutting (e.g.) Figure 4 As shown), we obtain One patch, This represents the data for the i-th patch; S5-2, Temporal Local Modeling. For each spatial node within each patch, temporal convolution is used to extract local dependencies: ; in, as well as These represent the kernel size as follows: and Temporal convolution kernel ( =6, =6); symbol Represents the convolution operator. is the layer normalization function, and ReLU is the activation function.

[0021] S5-3, Dynamic Spatial Modeling. Dynamically constructing spatial relationships based on the current input: ; in, This represents the static adjacency matrix of the transportation network.

[0022] After obtaining the dynamic adjacency matrix, the spatial features of the data are further modeled using graph convolution operations: ; in, The trainable parameters of the model ( Set it to 12).

[0023] S5-4, Local Feature Fusion. The outputs of the spatiotemporal convolutions are concatenated along the feature dimension to obtain an output that fuses spatiotemporal features. : ; S6, Feature Fusion and Prediction Output. Features learned from different patches are integrated to obtain fused features. : ; Next, a one-dimensional convolution is used to map the features to the final prediction space, yielding the final traffic flow prediction result. : ; in, For the final output of the model, Indicates the time step of the prediction.

[0024] S7, Model Training. Construct a loss function (e.g., mean squared error loss function) and train the model parameters using the Adam optimizer. After training, apply the model to traffic flow prediction tasks to predict the future traffic conditions of the target area.

[0025] In this embodiment, the three California highway datasets PEMSD3, PEMS04, and PEMS08 are processed according to the steps described above: I. Raw Data Collection and Preprocessing In the experimental design, this invention selects a taxi trajectory dataset (hereinafter referred to as BJ_Taxi) from a certain region as the external prompt data. This region concentrates a large amount of residential, commercial, and commuting activities, and its traffic operation patterns can, to some extent, reflect the common patterns of urban residents' travel behavior, thus possessing a certain representativeness and being suitable as an external information source for cross-regional traffic pattern migration and prompt modeling in the experiment. In the data preprocessing stage, road segments are used as basic spatial units to spatially match and aggregate the original taxi trajectory data, thereby constructing road network-level traffic data that is consistent with the target prediction data in terms of spatial representation. Based on historical data from May, June, and July 2013, this invention constructs a new 30-day time series by averaging the corresponding dates, thus highlighting the monthly-scale periodic patterns in the traffic data and, to some extent, reducing the interference of abnormal fluctuations in a single month on the prompt information. On this basis, this invention uses the STL time series decomposition method to decompose the external prompt sequence, splitting it into seasonal, trend, and random disturbance components. These three components are dimensionless standardized score indicators, such as... Figure 3 The image shows an example of the STL decomposition results for a node in the BJ_Taxi dataset. The trend term represents the long-term trend of traffic flow; an increase indicates relatively stronger traffic demand, while a decrease indicates relatively weaker demand. The seasonal term represents the regular fluctuation range of traffic flow within a preset period; a positive value indicates that the flow is relatively high relative to the trend term, while a negative value indicates that it is relatively low. The random disturbance term represents the remaining random variation in traffic flow after deducting the trend and seasonal effects; an abnormally large absolute value corresponds to abnormal fluctuations or abnormal events in traffic flow. Considering that the seasonal and trend terms better reflect the periodic structure and long-term evolution of traffic flow changes, and that the random disturbance term contains more noise information, only the decomposed seasonal and trend terms were used as external input prompts in subsequent experiments.

[0026] To verify the model's prediction accuracy, comparative experiments were conducted on three publicly available benchmark datasets: PEMSD3, PEMSD8, and PEMSD4. All three datasets are sourced from the California Traffic Monitoring System. The raw data was collected at 30-second sampling intervals and aggregated over 5-minute intervals. Regarding traffic feature types, the PEMSD3 dataset uses traffic speed, while the PEMSD8 and PEMSD4 datasets use traffic flow. Experiments on datasets with different traffic feature types allow for a more comprehensive evaluation of the model's adaptability and robustness under various traffic representations. The PEMSD3 dataset contains 358 sensors, covering the period from September to November 2018. The PEMSD8 dataset contains 170 sensors, covering the period from July to August 2016. The PEMSD4 dataset contains 307 sensors, covering the period from January to February 2018. In the experiment, this invention uses the first 60% of the data as the training set, 20% as the validation set, and the last 20% as the test set. During the data preprocessing stage, to eliminate the influence of different units and numerical ranges on the model training process, this invention employs maximum-minimum normalization, scaling all feature values ​​to the [0,1] interval. The specific formula is: ; in, This represents the normalized traffic flow data. as well as These correspond to the maximum and minimum values ​​in the training set of this dataset, respectively.

[0027] II. Experimental Setup and Model Evaluation Indicators The experiment used traffic flow data from the past hour (12 steps) as input to predict traffic flow changes within the next hour (12 steps) to evaluate the model's performance in long-sequence prediction tasks. During model training, the Adam optimizer was used to update model parameters to improve convergence speed and stability during training. All experiments were conducted on the lab's own server with the following hardware configuration: Intel Core i9-10940X CPU @3.30 GHz and NVIDIA GeForce RTX 3080 Ti GPU.

[0028] This invention uses three general metrics to evaluate the performance of each model: Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and Root Mean Square Error (RMSE). The specific formulas are as follows: ; ; ; in, For the predicted results, This represents the target value for the prediction task at the corresponding spatial scale.

[0029] In the experiment, the model's learning rate was set to 0.001, and the decay factor was set to 0.1. Through the above experimental settings and training strategies, this invention ensures model training stability while maximizing training efficiency and prediction accuracy, providing a reliable experimental basis for subsequent comparative experiments.

[0030] III. Baseline Model Selection To demonstrate the prediction accuracy of the method of this invention, the following representative traffic flow prediction models were selected for comparative experiments: VAR: VAR is one of the most classic statistical models in the field of time series forecasting, and it is selected as a representative of statistical models in this study.

[0031] ARIMA: ARIMA is a classic time series forecasting model that combines autoregression and moving average, and it is also a representative of statistical models.

[0032] SVR: SVR is a classic regression algorithm. Its core idea is to use a kernel function to map the input to a high-dimensional space and find a maximum margin hyperplane to fit the training data. It is selected as a representative of machine learning models in this study.

[0033] FC-LSTM: As an improved recurrent neural network scheme that is more suitable for time series data processing, FC-LSTM is widely used as a basic module in traffic flow prediction models. This study selects it as a representative of classic deep learning models.

[0034] DCRNN: DCRNN combines recurrent neural networks with a diffusion process on a graph to model spatiotemporal dependencies in an encoder-decoder framework.

[0035] STGCN: STGCN integrates spatiotemporal convolution and designs a new framework that can mine the spatiotemporal correlation of traffic flow data. It is one of the most classic spatiotemporal convolution models in the field of traffic flow prediction.

[0036] Graph WaveNet: Graph WaveNet introduces an adaptive dependency matrix that accurately captures dynamic spatial dependencies in data through node embedding learning, making it suitable for long-sequence traffic flow prediction.

[0037] ASTGCN: ASTGCN introduces an attention mechanism on the basis of spatiotemporal graph convolutional networks, enabling dynamic mining of spatiotemporal features of traffic flow data.

[0038] STSGCN: STSGCN designs a spatiotemporal synchronization modeling mechanism to capture the local spatiotemporal correlation of data, and effectively captures the heterogeneity in the local spatiotemporal graph through modules of multiple different time periods.

[0039] STODE: STODE captures the dynamic spatiotemporal features of data through tensor-based ordinary differential equations (ODEs), thereby constructing deeper convolutional networks.

[0040] STFGNN: STFGNN effectively learns hidden spatiotemporal dependencies by fusing multiple spatiotemporal graphs, processing different time periods in parallel. The model integrates a fusion graph module and a gated convolution module to handle long sequence data.

[0041] STGHCN: STGHCN integrates high-order spatial hypergraph convolution with temporal gating mechanisms and an encoder-decoder framework, giving it a strong ability to model complex spatiotemporal features of traffic data.

[0042] IV. Comparative Experiment Results and Analysis Table 1 presents the performance comparison results of the proposed method and various baseline models on the PEMSD3, PEMSD8, and PEMSD4 datasets. In the comparative experiments, each model predicted the traffic conditions for the next 60 minutes and was evaluated using three metrics: MAE, RMSE, and MAPE. For each comparative model, the table lists its average prediction error on the corresponding dataset to ensure the objectivity and comparability of the results. Based on the experimental results in Table 1, the following conclusions can be drawn: 1. Overall, except for the FC-LSTM model, deep learning models significantly outperform traditional statistical models and machine learning models in prediction accuracy. This result is consistent with previous research summaries of the modeling capabilities of different types of models. Traditional statistical models typically rely on linear assumptions and have limited ability to characterize complex nonlinear changes and sudden disturbances, resulting in weaker resistance to interference. 2. The prediction accuracy of machine learning models is close to that of FC-LSTM models, and is generally better than that of statistical models. Both machine learning models and FC-LSTM are relatively common time series prediction methods, which mainly focus on modeling time dimension features and lack the ability to explicitly characterize the spatial structure of traffic networks. 3. On the PEMSD8 and PEMSD4 datasets, the VAR model shows relatively better prediction accuracy. This phenomenon is related to the statistical characteristics of the PEMSD8 and PEMSD4 datasets themselves. However, the PEMSD3 dataset has a large number of zero values, which makes prediction difficult. This also reflects that the generalization ability of traditional models varies in different data scenarios. Their performance often depends on the structural characteristics of the data itself and it is difficult to maintain a consistent advantage in complex dataset environments. 4. The method of this invention achieves the lowest error values ​​in all three evaluation metrics on the PEMSD3 and PEMSD8 datasets. It performs best in the MAPE metric on the PEMSD4 dataset, while the MAE and RMSE metrics are very close to the optimal model STGHCN model, resulting in the best overall performance.

[0043] As shown in Table 1, compared to the second-best model STGHCN on the PEMSD3 and PEMSD8 datasets, the proposed method improves the MAPE, MAE, and RMSE metrics by 3.79%, 0.67%, and 9.43%, respectively, on the PEMSD3 dataset; and by 4.77%, 0.78%, and 0.90%, respectively, on the PEMSD8 dataset. On the PEMSD4 dataset, the proposed method improves the MAPE metric by 3.44% compared to the second-best model, while the differences in MAE and RMSE compared to the best model are 0.14 (0.71%) and 0.08 (0.13%), respectively. The improvement in RMSE on the PEMSD3 dataset is particularly significant, indicating that the proposed model has a stronger ability to reduce prediction errors in data with large sequence fluctuations. This stable and consistent performance improvement across datasets further verifies the model's generalization ability and robustness under different traffic characteristic scenarios.

[0044] Table 1 Comparison of experimental results

[0045] In summary, the experimental results fully validate the effectiveness of the traffic flow prediction method based on exogenous variable enhancement proposed in this invention. By introducing exogenous cue data to enhance the representation of long-term information, and combining a global attention mechanism with a local spatiotemporal convolution modeling strategy at the patch scale, the method of this invention can simultaneously characterize the long-term trend features and local dynamic fluctuation features in traffic data, achieving synergistic fusion of global and local information. This multi-level spatiotemporal feature modeling mechanism enables the model to achieve higher accuracy and more stable prediction performance in complex traffic scenarios.

Claims

1. A traffic flow prediction method based on exogenous variable enhancement, characterized in that, Includes the following steps: S1, Obtain historical traffic flow data for the target area. As target data, historical traffic flow data from external regions are also acquired. As external data, STL is used to perform time series decomposition on the external data to obtain trend components. Seasonal Quantity ;in, This indicates the batch size of the model input. The number of nodes in the target dataset. Input the time step into the model. Provide the number of nodes in the external dataset; S2, External Information Filtering and Spatial Relevance Modeling: Calculating the Spatial Similarity between Target Data and External Data Based on Cosine Similarity. and Based on the similarity results, weighted aggregation of external data is performed to obtain the external prompts most relevant to the target region. : ,in, This represents the trend component feature most relevant to the target data. This represents the seasonal component feature most relevant to the target data; ; ; S3 maps the target data and external enhancement data to a unified feature space, performing independent mapping at each time step: , , ; in, For fully connected layers or 1×1 convolutions, the aim is to convert the input shape Mapped to , The embedding dimension of the fully connected layer's output vector is then concatenated along the feature dimension to obtain the fused representation. : , This represents a vector concatenation operation, which joins two vectors along the last feature dimension. for The embedding dimension of a vector. ; S4, fusing the feature representations performing global spatio-temporal modeling; S5, Local Spatiotemporal Feature Modeling: Divide the time series into multiple continuous sub-sequence patches, and perform local modeling within each patch. The spatiotemporal features of each patch are output as follows: ; S6, feature fusion and prediction output: the learned features in different patches are uniformly integrated to obtain the fused features : ; Then the feature is mapped to the final prediction space by one-dimensional convolution to obtain the final traffic flow prediction result : ; wherein, is the final output of the model, denotes the predicted time step; S7, Model Training: Construct a loss function and use the gradient descent optimization algorithm to train the model parameters. After training, apply the model to the traffic flow prediction task to predict the future traffic conditions of the target area.

2. The traffic flow prediction method based on exogenous variable enhancement according to claim 1, characterized in that, The cosine similarity in S2 is calculated as follows: ; in, Represents the characteristics of the target traffic flow, with the shape being... , Indicates exogenous characteristics, trend components Or seasonal portion All shapes , obtained Shape .

3. The traffic flow prediction method based on exogenous variable enhancement according to claim 1 or 2, characterized in that, Global spatiotemporal modeling includes both time and space dimensions, while local steps include: S4-1, Time Dependency Modeling: Modeling the time series of each spatial node along the time dimension, using the time dimension as the sequence dimension, and employing a multi-head self-attention mechanism to capture long-term dependencies: ; in, This represents a multi-head self-attention function. , and From input Obtained through linear transformation. Represents the query vector. Represents the key vector. Represents a value vector; S4-2, Spatial Dimension Modeling: In the spatial modeling process, topological information of the transportation network is introduced, and the adjacency matrix is ​​integrated into the attention weights. The spatial feature representation is obtained as follows: ; ; in, Represents the spatial attention function. Represents the normalized exponential function, Obtained by linear mapping from the current input. It is a normalization function for maximum and minimum values; These are trainable parameters; S4-3, global feature fusion: fuse the time feature and the space feature to obtain a global space-time representation : .

4. The traffic flow prediction method based on exogenous variable enhancement according to claim 2, characterized in that, The specific steps of S5 include: S5-1, Data Segmentation: Assume the patch length is... The non-overlapping length between two consecutive patches is Step, which represents the length of the input data over time. Cut to obtain One patch, , representing the data of the i-th patch; S5-2, Temporal Local Modeling: For each spatial node within each patch, temporal convolution is used to extract local dependencies. ; in, , These represent the kernel size as follows: and Temporal convolution kernel; Represents the convolution operator. ReLU is the layer normalization function, and ReLU is the activation function. S5-3, Dynamic Spatial Modeling: Dynamically constructing spatial relationships based on the current input: ; wherein, denotes a static adjacency matrix of the traffic network; After obtaining the dynamic adjacency matrix, the spatial features of the data are modeled using graph convolution operations: ; wherein, representative model trainable parameters; S5-4, Local Feature Fusion: Concatenate the outputs of spatiotemporal convolution along the feature dimension to obtain an output that fuses spatiotemporal features. : .