A spatiotemporal traffic flow prediction method fusing multi-graph structure and knowledge enhancement

By constructing a traffic flow prediction method with a multi-graph structure and explicit periodic knowledge features, the problem of insufficient spatial and temporal modeling in existing technologies is solved, and higher accuracy and stability of traffic flow prediction are achieved.

CN122336985APending Publication Date: 2026-07-03CHONGQING UNIV OF POSTS & TELECOMM

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHONGQING UNIV OF POSTS & TELECOMM
Filing Date
2026-04-13
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing traffic flow prediction technologies struggle to fully characterize physical adjacency, similarity, hub propagation, and potential dynamic relationships when dealing with spatial coupling effects in complex urban road networks. Temporal modeling mechanisms also fail to account for local fluctuations, global dependencies, and periodic changes, and the use of explicit periodic prior knowledge is insufficient, resulting in inadequate prediction accuracy and stability.

Method used

We employ a method that integrates multi-graph structures and knowledge enhancement. By constructing distance graphs, similarity graphs, adaptive graphs, and Hub graphs, we extract multi-source spatial dependency features. We then combine dense and sparse self-attention mechanisms to capture the temporal dependencies of traffic flow. Additionally, we introduce explicit periodic knowledge features for fusion and use a hybrid prediction head for multi-step prediction.

Benefits of technology

It improves the spatial dependence representation of traffic flow prediction, enhances the characterization of complex temporal dynamics, improves the robustness and generalization ability of the model, and improves the accuracy and stability of multi-step prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122336985A_ABST
    Figure CN122336985A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of traffic flow prediction, and particularly relates to a spatio-temporal traffic flow prediction method fusing multi-graph structure and knowledge enhancement, comprising the following steps: obtaining historical observation data of traffic monitoring nodes at continuous multiple time steps; constructing enhanced features based on the historical observation data; splicing the enhanced features and the historical observation data to obtain enhanced input features; inputting the enhanced input features into a pre-trained traffic flow prediction model; and the traffic flow prediction model predicting traffic flow at one or more future time steps. The application realizes joint modeling of multi-source spatial correlation, complex time dynamics and historical period knowledge in traffic flow data, and improves the accuracy and robustness of future multiple time step traffic flow prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traffic flow prediction technology, specifically relating to a spatiotemporal traffic flow prediction method that integrates multi-graph structure and knowledge enhancement. Background Technology

[0002] With the development of intelligent transportation systems, urban road perception networks, and vehicle-road cooperative technologies, large-scale traffic sensors can continuously collect time-series data such as traffic flow, occupancy, and speed at road sections, segments, or nodes. Predicting traffic flow status at one or more future moments based on historical observation data is a key foundational technology in traffic guidance, congestion warning, signal control, route planning, and road operation management. For traffic flow prediction tasks, existing technologies typically need to simultaneously handle temporal and spatial correlations: on the one hand, traffic conditions exhibit significant short-term fluctuations, daily periodicity, and weekly periodicity; on the other hand, different road segments or monitoring nodes have physical connections, propagation effects, and functional similarities. Traffic prediction inputs usually include not only raw flow, occupancy, and speed, but also time-period features, missing value masks, and enhancement features such as differencing, moving averages, previous day's data, and previous week's data to improve the model's ability to express traffic dynamics.

[0003] Existing traffic flow prediction methods can be broadly classified into the following categories:

[0004] 1. The first category is prediction methods based on statistics or traditional time series analysis, such as historical averages, autoregressive models, moving average models, and their combinations. These methods typically extrapolate future traffic conditions linearly based on the assumption of stationarity or a fixed-order time dependency. These methods are simple to implement and have low computational overhead, showing some effectiveness in short-term, highly regular scenarios. However, they often struggle to accurately model nonlinear fluctuations, sudden disturbances, superimposed periodic changes, and multi-node coupled propagation phenomena in complex urban road networks, resulting in limited prediction accuracy.

[0005] 2. The second category is prediction methods based on recurrent neural networks, such as RNN, GRU, and LSTM. These methods convey historical information over time through hidden states, effectively uncovering temporal dependencies in traffic sequences. Compared to traditional statistical methods, they possess stronger nonlinear expressive power and are therefore widely used in traffic flow prediction, speed prediction, and multi-step time series prediction tasks. However, these methods primarily emphasize temporal sequence modeling, neglecting the topological connections between nodes, road network propagation relationships, and implicit associations between distant nodes. When significant spatial coupling effects exist in the traffic network, relying solely on recurrent neural networks for temporal modeling often fails to adequately characterize the spatial propagation features of complex road networks.

[0006] 3. The third category is prediction methods based on graph neural networks or spatiotemporal joint modeling. These methods typically abstract traffic sensor nodes as nodes in a graph, and road connectivity, distance relationships, or adjacency relationships as graph edges. Spatial dependency features are then extracted using mechanisms such as graph convolution, diffusing convolution, or graph attention, and temporal features are extracted by combining them with temporal convolution, recurrent networks, or attention networks. Compared to schemes that only use temporal modeling, this type of method can better handle spatial correlations in traffic networks, and therefore has become an important technical approach in the field of traffic prediction.

[0007] While existing traffic flow prediction technologies have been able to combine temporal and spatial modeling to some extent to complete prediction tasks, they still generally suffer from the following problems: the spatial relationship expression is relatively simple, making it difficult to simultaneously characterize physical adjacency relationships, similarity relationships, hub propagation relationships, and potential dynamic relationships; the temporal modeling mechanism struggles to simultaneously account for local fluctuations, global dependencies, and periodic changes; there is insufficient utilization of explicit knowledge features such as the previous day's same period, the previous week's same period, differential, and moving average; and the fitting ability for complex nonlinear relationships in multi-step prediction still needs improvement. Therefore, it is still necessary to propose a new time-series traffic flow prediction method to achieve joint modeling of multi-source spatial relationships, complex temporal dependencies, and explicit prior knowledge, thereby improving the accuracy, robustness, and practicality of traffic flow prediction. Summary of the Invention

[0008] To address the shortcomings of existing traffic flow prediction technologies, such as limited spatial relationship modeling, insufficient characterization of temporal dependencies, inadequate utilization of explicit periodic priors, and insufficient accuracy and stability in multi-step prediction, this invention proposes a spatiotemporal traffic flow prediction method that integrates multi-graph structure and knowledge enhancement. This method acquires historical observation data from traffic monitoring nodes over multiple consecutive time steps, constructs enhanced features based on this historical data, and concatenates these enhanced features with the historical observation data to obtain enhanced input features. These enhanced input features are then input into a pre-trained traffic flow prediction model, which predicts traffic flow for one or more future time steps. The pre-trained traffic flow prediction model's processing of the enhanced input features specifically includes the following steps:

[0009] The enhanced input features are projected onto the hidden feature space, and the spatiotemporal encoded features are obtained by extracting features through a spatiotemporal encoding layer composed of multiple spatiotemporal encoding blocks stacked together. Each spatiotemporal encoding block processes the input features sequentially through spatial feature extraction, temporal dependency modeling, and feedforward enhancement.

[0010] Extract the features of the same time the day before the desired prediction time, the features of the same time the week before the desired prediction time, the first difference features, and the moving average features from historical data, and encode the extracted features to obtain knowledge features;

[0011] The spatiotemporal coding features and knowledge features are gated and fused. The fused features are then input into the LSTM encoder and the KAN encoder respectively to obtain temporal memory features and nonlinear mapping features.

[0012] The hybrid approach is used to combine temporal memory features and nonlinear mapping features to obtain the final encoded features;

[0013] Set a query vector for each future prediction step. Each query vector and the final encoded feature are interacted with through multi-head cross attention. The interacted features are then linearly projected to obtain traffic flow prediction results for multiple future time steps.

[0014] Compared with the prior art, the present invention has the following beneficial effects:

[0015] 1. This invention enables joint modeling of multi-source spatial relationships, improving the ability to express spatial dependencies. Existing traffic flow prediction methods typically rely on single physical adjacency relationships, distance relationships, or fixed topologies for spatial relationship modeling, which fails to fully reflect the complex propagation and coupling relationships in real traffic networks. This invention simultaneously introduces multiple graph structures, including distance graphs, similarity graphs, adaptive graphs, and hub graphs, to jointly describe the spatial dependencies between traffic nodes from multiple perspectives, such as physical connectivity, operational mode similarity, potential associations, and propagation relationships at key hubs. A unified spatial feature representation is obtained through a fusion mechanism. Therefore, this invention can more comprehensively characterize the complex spatial propagation patterns in traffic networks, enhance the model's ability to express the coupling effects of multiple nodes, and thus improve the accuracy of traffic flow prediction.

[0016] 2. This invention can more fully characterize the complex temporal dynamics of traffic flow, improving temporal modeling capabilities. Traffic flow sequences typically exhibit characteristics such as short-term local fluctuations, long-term dependencies, daily and weekly periodic patterns, and sudden changes. Existing technologies, relying solely on recurrent networks, temporal convolutions, or standard attention mechanisms, often struggle to simultaneously capture local temporal details and long-distance dependencies. This invention employs a time-dimensional augmented modeling mechanism, extracting dependencies across different time ranges through a combination of dense and sparse branches. Furthermore, it incorporates local window constraints, causal constraints, and a temporal augmentation feedforward module to further refine and enhance temporal features. Therefore, this invention can more accurately capture key temporal patterns in traffic flow changes, improving the model's adaptability to complex, time-varying traffic conditions.

[0017] 3. This invention explicitly utilizes historical periodic knowledge and statistical features to improve model robustness and generalization ability. Traffic flow exhibits clear patterns such as the same period of the previous day, the same period of the previous week, local trend changes, and smoothing trends. In existing technologies, many methods mainly rely on the model to implicitly learn these patterns from the original sequence, failing to adequately utilize explicit prior knowledge. This invention constructs enhanced features at the input stage, including time encoding, missing value masking, difference features, moving average features, features from the same period of the previous day, and features from the same period of the previous week. Furthermore, at the prediction stage, it further extracts historical periodic knowledge and statistical knowledge separately and fuses them with spatiotemporal features. Therefore, this invention can improve the model's ability to identify periodic traffic patterns, maintaining good robustness and generalization performance even in scenarios with high noise, missing data, or significant traffic fluctuations.

[0018] 4. This invention enhances the fitting ability of complex nonlinear traffic relationships and improves multi-step prediction performance. In practical traffic applications, it is often necessary to continuously predict traffic flow over multiple future time steps. However, as the prediction step length increases, the error accumulation problem becomes more prominent. In existing technologies, some multi-step prediction methods have relatively simple decoding methods, which are insufficient in controlling error propagation in complex nonlinear relationships and long-span predictions. This invention employs a hybrid prediction head that combines cyclic memory modeling and nonlinear mapping modeling in the prediction output stage, and combines it with a multi-step decoding mechanism to generate prediction results for multiple future time steps, thereby enhancing the model's fitting ability to complex nonlinear spatiotemporal relationships. Therefore, this invention can effectively improve the accuracy degradation problem in long-term multi-step prediction and enhance the stability and practicality of multi-step traffic flow prediction. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the overall process of the spatiotemporal traffic flow prediction model method that integrates multi-graph structure and knowledge enhancement of the present invention.

[0020] Figure 2 This is a schematic diagram illustrating the training and prediction results of the model in this invention;

[0021] Figure 3 This is a comparison chart of the results of the present invention and existing methods in traffic flow prediction tasks. Detailed Implementation

[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] To achieve joint modeling of multi-source spatial correlations, complex temporal dynamics, and historical periodic knowledge in traffic flow data, and to improve the accuracy and robustness of traffic flow prediction for multiple future time steps, this invention proposes a spatiotemporal traffic flow prediction method that integrates multi-graph structure and knowledge enhancement. This method acquires historical observation data from traffic monitoring nodes over multiple consecutive time steps, constructs enhanced features based on this historical data, concatenates these enhanced features with the historical observation data to obtain enhanced input features, and inputs these enhanced input features into a pre-trained traffic flow prediction model. The traffic flow prediction model then predicts traffic flow for one or more future time steps. The specific steps involved in processing the enhanced input features by the pre-trained traffic flow prediction model are as follows:

[0024] The enhanced input features are projected onto the hidden feature space, and the spatiotemporal encoded features are obtained by extracting features through a spatiotemporal encoding layer composed of multiple spatiotemporal encoding blocks stacked together. Each spatiotemporal encoding block processes the input features sequentially through spatial feature extraction, temporal dependency modeling, and feedforward enhancement.

[0025] Extract the features of the same time the day before the desired prediction time, the features of the same time the week before the desired prediction time, the first difference features, and the moving average features from historical data, and encode the extracted features to obtain knowledge features;

[0026] The spatiotemporal coding features and knowledge features are gated and fused. The fused features are then input into the LSTM encoder and the KAN encoder respectively to obtain temporal memory features and nonlinear mapping features.

[0027] The hybrid approach is used to combine temporal memory features and nonlinear mapping features to obtain the final encoded features;

[0028] Set a query vector for each future prediction step. Each query vector and the final encoded feature are interacted with through multi-head cross attention. The interacted features are then linearly projected to obtain traffic flow prediction results for multiple future time steps.

[0029] In this embodiment, historical observation data of traffic monitoring nodes are acquired over multiple consecutive time steps. The historical observation data includes at least one or more of traffic flow, occupancy rate, and speed. Preferably, for each monitoring node, enhanced input features are constructed at each historical time point. These enhanced input features, in addition to the original traffic state features, also include at least one of the following additional features:

[0030] 1. Temporal coding features that characterize time periodicity;

[0031] 2. Missing value mask feature to characterize data validity;

[0032] 3. First-order difference features characterizing short-term trends;

[0033] 4. The characteristics of moving averages that characterize local smoothing trends;

[0034] 5. Characteristics of the day preceding a historical cycle;

[0035] 6. Characteristics of the week preceding the historical cycle.

[0036] Preferably, the aforementioned multiple features corresponding to each node at each time point are concatenated to form an enhanced feature vector, and the model input samples are constructed according to a preset historical window length, while the model output labels are constructed according to a preset prediction step size. Through this method, the model input can include not only the original traffic observations but also explicit temporal priors, trend information, and periodic knowledge, thereby improving the model's ability to express complex traffic temporal patterns.

[0037] To address the issue of various spatial relationships between nodes in a transportation network, this invention does not rely solely on a single adjacency matrix. Instead, it constructs multiple graph structures to jointly describe the relationships between transportation nodes. Preferably, it includes two or more of the following graph structures; more preferably, it includes four of the following graph structures simultaneously:

[0038] 1. Distance Graph: Constructed based on the physical distance, road connectivity, or topological adjacency between traffic nodes, reflecting the basic spatial connectivity in the traffic network;

[0039] 2. Similarity Graph: Constructed based on the similarity between the historical traffic sequences of each node, reflecting the functional relationships between nodes with similar operating modes;

[0040] 3. Adaptive graph: It automatically generates potential association weights between nodes through learnable node representations, reflecting the implicit dynamic spatial relationships under data-driven conditions;

[0041] 4. Hub Graph: Constructed based on the importance of nodes in the transportation network, connectivity centrality, or hub attributes, to enhance the modeling of the propagation impact of key nodes on surrounding and distant nodes.

[0042] The similarity graph is preferably constructed based on the historical traffic sequences during the training phase to avoid information leakage during the testing phase.

[0043] Furthermore, the historical sequences of each node can be standardized first, and then a prototype sequence of nodes can be formed based on intraday or periodic patterns. Through similarity screening and dynamic time-normalized distance calculation, the similarity adjacency relationship and edge weight between nodes can be determined.

[0044] By constructing the above-mentioned multi-source graph structure, the present invention can simultaneously express physical adjacency relationships, similarity relationships of operation modes, propagation relationships of key hubs, and implicit potential relationships in transportation networks, thereby overcoming the problem of insufficient expressive power of a single spatial graph structure in the prior art.

[0045] After obtaining multiple graph structures, this invention extracts spatial features from the input temporal features. Specifically, for each graph structure, graph convolution, diffusing convolution, or their equivalent graph neural network operators are used to propagate and aggregate the node features at each time step along the node dimension to extract the spatial dependency features under the corresponding graph structure.

[0046] Preferably, the spatial features extracted from different graph structures are fused. The fusion process can employ static weighting, gated weighting, attention weighting, or equivalent methods. More preferably, a gated fusion mechanism is used to adaptively generate fusion weights for each graph structure based on the features corresponding to the current sample, the current time step, and the current node, thereby obtaining a comprehensive spatial feature representation.

[0047] Through the above design, this invention does not pre-fix the importance of different graph structures, but dynamically determines the contribution of distance graph, similarity graph, adaptive graph and hub graph in the current prediction task based on traffic conditions, thereby improving the flexibility and adaptability of spatial modeling.

[0048] Following spatial feature extraction, this invention further models the temporal dependencies within the traffic sequence. Since traffic flow exhibits characteristics such as short-term local fluctuations, long-term dependencies, periodicity, and sudden changes, this invention employs an adaptive sparse self-attention mechanism to model the temporal dimension.

[0049] Specifically, the adaptive sparse self-attention mechanism includes at least two parallel branches:

[0050] 1. Dense attention branches are used to capture global dependencies between different historical moments;

[0051] 2. Sparse attention branch, used to emphasize high response relationships between moments of significant local change or critical moments.

[0052] Preferably, the time modeling process introduces local time window constraints and causal mask constraints, so that the model mainly focuses on effective information within the historical time range when predicting the current or future moments, which not only enhances the modeling ability of local time series changes, but also ensures temporal causality.

[0053] Furthermore, the outputs of the dense attention branch and the sparse attention branch are adaptively fused to obtain temporal augmentation features. Preferably, this fusion process employs learnable fusion weights so that the model can adaptively balance the effects of dense and sparse dependencies based on the traffic conditions at different nodes and time periods.

[0054] Furthermore, after temporal attention modeling, this invention also includes a temporal feature enhancement feedforward module to further refine the features after temporal modeling. The temporal feature enhancement feedforward module preferably includes one or more of channel expansion, local convolution, gated modulation, depthwise separable convolution, and linear mapping, used to enhance the local pattern representation ability and nonlinear transformation ability of the temporal features.

[0055] Through the above-mentioned time modeling and feature enhancement design, the present invention can simultaneously take into account local short-term fluctuations, long-term time span dependencies, and complex nonlinear dynamic changes in traffic flow, thereby improving the time dimension representation effect.

[0056] To further improve the model's ability to utilize traffic flow cyclical and statistical patterns, this invention extracts and integrates knowledge features from the input separately during the prediction phase. Preferably, these knowledge features include at least one of the following:

[0057] 1. The historical value corresponding to the same moment on the previous day;

[0058] 2. The historical value corresponding to the same moment in the previous week;

[0059] 3. First-order difference characteristics;

[0060] 4. Moving average characteristics;

[0061] 5. Time period coding characteristics.

[0062] This invention maps the aforementioned knowledge features and the high-dimensional spatiotemporal features output by the spatiotemporal coding module to a unified feature space, and then fuses them. The fusion method can employ concatenation fusion, additive fusion, gated fusion, cross-attention fusion, or equivalent methods. Preferably, a gated fusion method is used, allowing the model to adaptively adjust the contribution ratio of explicit knowledge features and implicit spatiotemporal features based on the sample state. Through this design, the model can not only automatically learn traffic patterns using the spatiotemporal coding module, but also explicitly utilize prior knowledge such as the previous day, the previous week, local differences, and local averages, thereby improving prediction robustness and generalization ability in scenarios with significant periodicity, strong local fluctuations, or high data noise.

[0063] To address the problem of simultaneously predicting multiple future time steps in practical traffic applications, this invention employs a multi-step prediction and decoding mechanism to generate future traffic flow results. This multi-step prediction and decoding mechanism can adopt any one or more of the following methods:

[0064] 1. Direct multi-step decoding method, which directly maps the encoded output to obtain the predicted values ​​for multiple future time steps;

[0065] 2. Autoregressive decoding method, which uses the output of the previous prediction step to generate the result of the next prediction step;

[0066] 3. Query-based decoding method, which sets corresponding query vectors for different future time steps, and uses the query vectors to interact with historical encoding outputs to generate output results for different prediction steps.

[0067] This invention employs a query-based decoding method, enabling the model to extract the most relevant feature representations from historical encoded information for different prediction steps when generating prediction results for different future time steps, thereby improving the accuracy and stability of medium- and long-term multi-step predictions.

[0068] Finally, the model outputs traffic flow predictions for each monitoring node at one or more future time steps.

[0069] This invention provides a specific implementation process for acquiring traffic observation data from multiple traffic monitoring nodes at continuous historical moments, constructing enhanced features from the acquired data, and inputting the data into a trained unified traffic flow prediction model to obtain traffic flow prediction results for one or more future time steps.

[0070] In a preferred embodiment, the unified traffic flow prediction model consists of an input layer, a spatiotemporal coding layer, and a prediction layer. The input layer receives the traffic flow augmentation feature tensor; the spatiotemporal coding layer is composed of multiple stacked spatiotemporal coding blocks, each including a multi-graph spatial feature extraction module, a time-dependent modeling module, and a feedforward augmentation module; the prediction layer includes a knowledge feature extraction module, an adaptive knowledge fusion module, an LSTM-KAN hybrid coding module, and a multi-step decoding module. The overall input of the model is a historical traffic feature tensor. Where B represents the batch size, T represents the historical time window length, N represents the number of traffic nodes, and F represents the input feature dimension; in the preferred embodiment, F=12, and the model output is the traffic flow prediction result for the next H time steps. ,like Figure 1 Specifically, it includes the following steps:

[0071] Step 1: Obtain traffic monitoring sequences and construct enhanced input features.

[0072] This involves acquiring raw traffic state data from multiple monitoring nodes in a traffic network at consecutive sampling times. In this embodiment, the raw traffic state data preferably includes flow rate, occupancy rate, and speed. For the raw observation of the nth node at time t, it can be expressed as:

[0073]

[0074] in, This indicates that the nth node is in the nth position. Traffic flow at any given moment This represents the occupancy rate of the nth node at time t. This represents the velocity of the nth node at time t.

[0075] To improve the model's ability to express periodic patterns, local trends, and data quality, enhanced input features are further constructed from the original traffic data. In a preferred embodiment, the following 12-dimensional features are constructed for each node at each time step: traffic flow features. Market share characteristics Speed ​​characteristics Intraday cycle sine coding, intraday cycle cosine coding, intraweek cycle sine coding, intraweek cycle cosine coding, missing value mask feature, first-order difference feature, causal moving average feature, and previous day's same-time feature. Characteristics of the same time in the previous week .

[0076] Specifically, the time period encoding features in this embodiment include: intraday periodic sine encoding, intraday periodic cosine encoding, intraweekly periodic sine encoding, and intraweekly periodic cosine encoding. Based on the relative position of the same time step t within a day and a week, intraday periodic sine encoding, intraday periodic cosine encoding, intraweekly periodic sine encoding, and intraweekly periodic cosine encoding are constructed respectively.

[0077]

[0078]

[0079] in, This represents the periodic sine code of the observation data at time step t. This represents the number of time steps within a day. If sampling is performed every 5 minutes, then... , This represents the relative position of the t-th time step within a one-day cycle; This represents the periodic cosine encoding of the observation data at time step t; This represents the periodic sine code of the observation data at time step t. This represents the number of time steps within a week. If sampling is performed every 5 minutes, then... , This indicates the relative position of the t-th time step within a one-week cycle; This represents the periodic cosine code of the observation data at time step t. In this invention, the four periodic coding features reflect the current position within the daily and weekly cycles, and are broadcast to all nodes simultaneously after calculation.

[0080] In this embodiment, the missing value mask feature is used to characterize the validity of the data at the current time of the current node, denoted as Preferably, when the flow and occupancy of node n at time step t are both 0, the location is determined to be an invalid observation, and let... Otherwise This is used to explicitly indicate whether the observation point is valid.

[0081] In this embodiment, the first-order difference feature is used to characterize the local change trend, defined as the difference in flow rate between the current time and the previous time, denoted as . , represented as:

[0082]

[0083] In this embodiment, the causal moving average feature is used to characterize the local smoothing trend, denoted as If we assume the length of the causal sliding window is... Preferably ,but:

[0084]

[0085] in, , This represents the traffic flow at node n at time step τ, which is calculated by averaging only the historical traffic flow values ​​at the current time and before, without incorporating future information.

[0086] Therefore, node At any moment The enhanced input vector can be written as:

[0087]

[0088] After concatenating the augmented features of all nodes at all time steps, an augmented feature tensor is formed. In this embodiment, the input feature dimension is 12.

[0089] Step 2: Construct training samples using a sliding window method.

[0090] The enhanced feature tensor is divided into input samples and predicted labels using a sliding window method. Let the length of the historical input window be T, and the prediction step size be H. Then the input and label of the i-th sample are represented as follows:

[0091]

[0092]

[0093] In a preferred embodiment, only the traffic flow dimension in the label is used as the prediction target, thereby forming traffic flow supervision labels for each node in the next H time steps. Preferably, the continuous numerical features and target traffic flow are standardized before training to improve training stability.

[0094] Step 3: Construct a multi-source spatial relationship diagram.

[0095] To characterize different spatial relationships in a transportation network, this invention does not employ a single adjacency matrix, but instead constructs multiple graph structures. In a preferred embodiment, the following four types of graphs are constructed: (1) a distance graph; (2) an adaptive graph; (3) Figure; (4) Similarity graph. Among them, the distance graph is used to represent the physical adjacency relationship between nodes; the adaptive graph is generated by learnable node embeddings and is used to represent implicit potential association relationships; The graph is used to enhance the propagation effect of key hub nodes; the similarity graph is used to represent the functional associations between nodes with similar historical operating patterns. In a preferred embodiment, the adaptive graph can be represented as:

[0096]

[0097] in, and An embedding matrix for learnable nodes. This is the embedding dimension. This method can adaptively learn the potential relationships between nodes through the training process.

[0098] Then, the above multiple adjacency matrices are stacked as follows:

[0099]

[0100] As input to the subsequent multi-graph spatial feature extraction module.

[0101] Step 4: Input the enhanced input features into the spatiotemporal coding layer to extract spatiotemporal feature representations.

[0102] First, input the augmented feature tensor ( Projecting onto the hidden feature space, we get:

[0103]

[0104] Where d represents the hidden dimension, , These are the learnable weight matrices used for projection onto the hidden feature space. Then, The input consists of a spatiotemporal coding layer composed of multiple stacked spatiotemporal coding blocks. Each spatiotemporal coding block includes three sub-modules: spatial feature extraction, temporal dependency modeling, and feedforward enhancement.

[0105] 1. Spatial Feature Extraction Module:

[0106] For the g-th graph structure Graph convolution or diffraction convolution is used to propagate and aggregate node features to obtain spatial features under the corresponding graph. The spatial features of multiple graphs are further gated and fused, which can be specifically represented as:

[0107]

[0108] in, These represent the spatial features corresponding to the distance map, adaptive map, hub map, and similarity map, respectively. This indicates a feature concatenation operation. This represents the features obtained by stitching together the spatial features of each graph; This represents the gating function, used to generate the fusion weights corresponding to each graph structure. This represents the set of fusion weights for each graph; This represents the fusion weight corresponding to the g-th graph structure. This represents element-wise multiplication. This represents the spatial features under the g-th graph. This represents the integrated spatial features after fusion. In this way, the model can dynamically determine the importance of different graph structures based on the current time, the current node, and the current sample state.

[0109] 2. Time-dependent modeling module:

[0110] After spatial feature extraction, adaptive sparse self-attention modeling is applied to the temporal dimension. Let the input features of the temporal module be represented as... First, obtain the query matrix, key matrix, and value matrix:

[0111]

[0112] Attention Score Represented as:

[0113]

[0114] in, For query vector, A learnable query mapping matrix; For key vectors, It is a learnable key mapping matrix; For value vectors, A learnable value mapping matrix; This indicates the single-head attention dimension.

[0115] In a preferred embodiment, the temporal module includes dense attention branches and sparse attention branches. The dense branches are used to model global temporal dependencies and can be represented as:

[0116]

[0117] Where M is a mask matrix formed by the time window constraint and the causal constraint. The element in the i-th row and j-th column of the mask matrix M is used to indicate whether the j-th time step is allowed to be focused when attention is calculated at the i-th target time step. When the j-th time step satisfies When the value is 'allowed', the corresponding element is set to an allowed value (the allowed value is used to retain the attention score at the corresponding position, which is set to 1 in this embodiment); otherwise, it is set to a prohibited value (the prohibited value is used to suppress the attention score at the corresponding position, which is set to 0 in this embodiment). w1 is the preset time window length, which is w1=8 in this embodiment. In dense branches, the original attention score is constrained using the mask matrix, and the constrained attention score is normalized to obtain the temporal attention weight. The value vector is weighted and aggregated based on the temporal attention weight to obtain the global temporal dependency feature.

[0118] Sparse branches are used to highlight key time step relationships and can be represented as:

[0119]

[0120] The two branches are then weighted and merged to obtain the final time attention:

[0121]

[0122] in, and These are learnable fusion parameters. The final time module output is:

[0123]

[0124] The above methods can simultaneously capture local fluctuation relationships and longer-term dependencies.

[0125] 3. Feedforward Enhancement Module: Following the temporal module, a feedforward enhancement module further refines the temporal features to improve nonlinear representation capabilities. This module preferably includes operations such as channel expansion, local convolution, gated modulation, and linear projection to enhance the local pattern recognition capability in traffic sequences.

[0126] After processing through multiple spatiotemporal coding blocks, the spatiotemporal coding features are obtained: .

[0127] Step 5: Extract explicit knowledge features and perform adaptive fusion.

[0128] To further enhance the model's ability to utilize periodic patterns and local statistical characteristics, this invention starts from the original input. Knowledge features are extracted separately. In a preferred embodiment, the knowledge features include features from the same time the previous day, features from the same time the previous week, first-order difference features, and moving average features. The corresponding indices are the 10th, 11th, 8th, and 9th dimensions of the enhanced input vector in this embodiment, respectively. Let the extracted knowledge features be:

[0129]

[0130] After encoding it, we obtain the knowledge representation:

[0131]

[0132] Then encode the spatiotemporal features With knowledge characteristics Gating fusion is represented as:

[0133]

[0134] in, Indicates feature splicing, This represents the Sigmoid function. The gating coefficient, , These are the trainable weight matrix and bias vector during the gating fusion process, respectively. , These are the spatiotemporal coding features in the gating fusion process. Knowledge characteristics The trainable weight matrix allows for adaptive balancing of explicit knowledge features and implicit spatiotemporal features based on different sample states.

[0135] Step 6: Perform multi-step traffic flow prediction using the LSTM-KAN hybrid prediction head.

[0136] First, the fusion features Expanding by node dimension yields ,Will Inputting the LSTM encoder yields the temporal memory features:

[0137]

[0138] At the same time, Inputting the KAN encoder yields nonlinear mapping features:

[0139]

[0140] In a preferred embodiment, a hybrid mode is used for mixing and fusion, as follows:

[0141]

[0142] in, Mixed weights; , This refers to the trainable weight matrix and bias vector when calculating the mixed weights. This is a trainable weight matrix for temporal memory features. is a trainable weight matrix for nonlinear mapping features.

[0143] This combines the temporal memory advantage of LSTM with the high nonlinear representation advantage of KAN.

[0144] Subsequently, a query-based multi-step decoder is used to output traffic flow results for multiple future time steps. A query vector is set for each future prediction step. ,in By interacting with each query vector and the encoded output, we obtain:

[0145]

[0146] in , This indicates a multi-head cross-attention operation.

[0147] Finally, the traffic flow prediction results for multiple future time steps are obtained by outputting the projection layer:

[0148]

[0149] in, , These are the trainable weight matrix and bias vector of the output projection layer, respectively.

[0150] And restore to:

[0151]

[0152] This yields the traffic flow forecasts for all nodes over the next H time steps.

[0153] Step 7: Calculate the loss and update the model parameters.

[0154] Model prediction results With real labels The models are compared, and the model parameters are optimized using a loss function. In a preferred embodiment, mean absolute error loss can be used:

[0155]

[0156] The backpropagation algorithm is used to jointly update the input projection parameters, multi-graph spatial module parameters, temporal attention parameters, knowledge fusion parameters, LSTM parameters, KAN parameters, and decoder parameters in the model until the loss function converges, thus obtaining the trained traffic flow prediction model.

[0157] After training, the traffic observation enhancement features of T consecutive time steps before the time to be predicted are input into the model, and the traffic flow prediction results of each traffic node in the next H time steps can be output.

[0158] Figure 2 To demonstrate the performance of the model on four different public datasets, this embodiment uses mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE) as losses for training. The performance on the four public highway traffic datasets PEMS03, PEMS04, PEMS07, and PEMS08 is as follows: Figure 2 As shown.

[0159] Figure 3 This figure shows a comparison of the results of the present invention and existing methods in traffic flow prediction tasks. It illustrates the performance comparison results of the present invention method and the baseline method under different evaluation indicators. As can be seen from the figure, the present invention is superior to other existing prediction methods in terms of prediction accuracy and stability.

[0160] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement, characterized in that, Historical observation data of traffic monitoring nodes over multiple consecutive time steps are acquired. Enhanced features are constructed based on the historical observation data. These enhanced features are then concatenated with the historical observation data to obtain enhanced input features. These enhanced input features are then input into a pre-trained traffic flow prediction model, which predicts traffic flow for one or more future time steps. The specific processing steps of the pre-trained traffic flow prediction model for the enhanced input features include the following steps: The enhanced input features are projected onto the hidden feature space, and the spatiotemporal encoded features are obtained by extracting features through a spatiotemporal encoding layer composed of multiple spatiotemporal encoding blocks stacked together. Each spatiotemporal encoding block processes the input features sequentially through spatial feature extraction, temporal dependency modeling, and feedforward enhancement. Extract the features of the same time the day before the desired prediction time, the features of the same time the week before the desired prediction time, the first difference features, and the moving average features from historical data, and encode the extracted features to obtain knowledge features; Gated fusion of spatiotemporal coding features and knowledge features is performed, and the fused features are input into LSTM encoder and KAN encoder respectively to obtain temporal memory features and nonlinear mapping features. The hybrid approach is used to combine temporal memory features and nonlinear mapping features to obtain the final encoded features; Set a query vector for each future prediction step. Each query vector and the final encoded feature are interacted with through multi-head cross attention. The interacted features are then linearly projected to obtain traffic flow prediction results for multiple future time steps.

2. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 1, characterized in that, Enhanced features are constructed for the historical observation data input at each time point, and the enhanced features include at least one of the following: Temporal coding features that characterize time periodicity; Missing value mask features that characterize data validity; First-order difference features characterizing short-term trends; The characteristics of a moving average that represent a local smoothing trend; Characteristics of the day preceding a historical cycle; The characteristics of the week preceding the historical cycle.

3. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 1, characterized in that, The process of spatial feature extraction includes: Using traffic monitoring nodes as nodes, distance graphs and adaptive graphs are constructed. At least two graph structures, including graphs and similar graphs; In each graph structure, graph convolution or diffraction convolution is used to propagate and aggregate node features to obtain the spatial features corresponding to the graph structure. The constructed graph structure is then concatenated and input into the gating module to calculate the weight of each graph. The weighted sum of all graphs is then used as the spatial feature.

4. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 1, characterized in that, The process of time-dependent modeling includes: For each traffic monitoring node whose spatial features have been extracted, the features are mapped into query vector, key vector, and value vector, and the attention score is calculated using the query vector and key vector. Construct a mask matrix formed by the combined effects of time window constraints and causal constraints; In dense branches, the global time dependency is obtained by weighting the mask matrix with attention scores; In the sparse branch, the key time step relationship is obtained by weighting the mask matrix with attention scores; Global time dependencies and key time step relationships are weighted and fused to obtain time dependencies; By weighting the value vector using time dependencies, we can obtain the features output by time dependency modeling.

5. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 4, characterized in that, In dense branches, the global time dependency is obtained by weighting the mask matrix with attention scores, including: in, S represents global time dependence; S is the attention score; M is the mask matrix; express function.

6. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 4, characterized in that, In the sparse branch, the key time step relationships are obtained by weighting the mask matrix with attention scores: in, S represents the key time step relationship; S represents the attention score; M represents the mask matrix; express function.

7. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 1, characterized in that, Feedforward enhancement is performed on the features output by time-dependent modeling using one or more cascaded methods of channel expansion, local convolution, gated modulation, and linear projection.

8. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 1, characterized in that, Gating fusion of spatiotemporal coding features and knowledge features includes: in, The gating factor; Represents spatiotemporal coding features; Representing knowledge characteristics; Indicates feature splicing; , These are the trainable weight parameters and bias parameters in the gating module, respectively. Represents the Sigmoid function; This represents element-wise multiplication; , These are the trainable weight matrices during the gating fusion process.

9. The spatiotemporal traffic flow prediction method integrating multi-graph structure and knowledge enhancement according to claim 1, characterized in that, The learnable network parameters in the traffic flow prediction model are updated using the backpropagation algorithm until the loss function converges, thus completing the training of the traffic flow prediction model. The loss function is expressed as: in, This represents the predicted traffic flow value for the nth traffic monitoring node in the bth sample at the hth time step in the future; This represents the actual traffic flow value of the nth traffic monitoring node in the bth sample at the hth time step in the future; B represents the batch size; H represents the number of prediction time steps; and N represents the number of traffic monitoring nodes.