Federal space-time attention adaptive graph learning method and system
By building a federal space-time attention adaptive graph learning system, the problems of privacy leakage and high communication costs in traditional traffic prediction are solved, and efficient traffic prediction in the federated learning environment is achieved.
Patent Information
- Application Number
- CN202510626623.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-08-08
AI Technical Summary
Traditional centralized traffic prediction methods have the risk of privacy leakage, high communication costs and limited model flexibility. Data fragmentation between clients in federated graph learning hinders the full utilization of space-time dependence.
A space-time attention enhancement dynamic graph convolution network model consisting of feature enhancement layer, dynamic graph convolution recursive network, multi-headed temporal attention module, graph attention module and spatiotemporal attention fusion module is constructed, and an activation decomposition strategy is implemented in the federated learning scenario, and traffic prediction is carried out through dynamic adjacency matrix learning and privacy protection mechanisms.
While protecting data privacy, it reduces communication costs, improves computing efficiency, enhances the model's responsiveness to complex and variable spatial patterns, and provides accurate traffic predictions.
Smart Images

Figure CN120449207A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a federated spatiotemporal attention adaptive graph learning method and system. Background Art
[0002] As cities continue to expand and transportation networks become increasingly complex, traditional centralized traffic prediction methods are no longer able to meet the needs of modern intelligent transportation systems. These methods typically require the centralization of large amounts of sensitive traffic data, which not only poses the risk of privacy leakage but is also difficult to implement in real-world scenarios where data is dispersed.
[0003] Therefore, graph-based deep learning methods, such as spatiotemporal graph neural networks (STGNNs), have become the main tools for traffic forecasting. These methods use graph neural networks (GNNs) to capture non-Euclidean spatial dependencies. Although GNN-based methods have made significant progress in capturing spatial dependencies, recent research has focused on using fixed weighted graphs based on prior knowledge and a set of simple spatiotemporal components to model the spatiotemporal dependencies of traffic flow problems. However, collecting up-to-date and accurate road information is costly, and a single fixed weighted graph has difficulty describing the correlations between sensors, resulting in large errors. At the same time, traffic forecasts are affected by complex spatiotemporal dependencies. Unlike traditional time series, they have significant spatiotemporal correlations and are easily affected by external events (such as peak traffic periods, traffic accidents, and holidays).
[0004] Furthermore, traffic flow predictions should also consider real-world scenarios. City-scale traffic data is often dispersed among numerous different data owners, each of whom (enterprise / organization / institution) can be considered a client. Due to privacy protection constraints, the sharing of this data is limited, making centralized training of graph neural networks for traffic flow prediction impractical. Federated learning (FL) has been proposed as a framework in which participants only share model parameters or embedded features without exposing potentially sensitive local data. This allows model training across distributed devices without sharing raw data, thus reducing privacy concerns. However, the data fragmentation introduced by this federation constraint severely hinders interaction between different clients and hinders the full utilization of spatiotemporal dependencies across clients.
[0005] Current research on federated graph learning is dedicated to addressing a series of challenges, including how to effectively learn when information is lost between clients, how to protect the privacy of the graph structure from being leaked, and how to deal with the heterogeneity of cross-client data. In this context, one focus of current research is to reconstruct information based on traditional GNNs and treat the edges between clients as public and predefined. For example, Xia M, Jin D, Chen J. Short-term traffic flow prediction based on graph convolutional networks and federated learning [J]. IEEE Transactions on Intelligent Transportation Systems, 2022, 24(1): 1191-1203. proposed: treating spatial topology as public information and applying community detection algorithms to partition subgraphs. In client-side traffic federated learning, all clients have access to the spatial graph. Although this method protects privacy to a certain extent, it only extracts dependencies from public and predefined channels. This approach is neither comprehensive nor has a loss in prediction accuracy. Summary of the Invention
[0006] The purpose of the present invention is to provide a federated spatiotemporal attention adaptive graph learning method and system to solve the problems of privacy leakage risk, high communication cost and limited model flexibility in the traditional federated spatiotemporal attention adaptive graph learning framework.
[0007] The technical solutions of the present invention are as follows:
[0008] In one aspect, the present invention provides a federated spatiotemporal attention adaptive graph learning method, comprising the following steps:
[0009] A traffic prediction problem is constructed, and based on the traffic prediction problem, a spatiotemporal attention enhanced dynamic graph convolutional network model is constructed, which consists of a feature enhancement layer, a dynamic graph convolutional recursive network, a multi-head temporal attention module, a graph attention module, and a spatiotemporal attention fusion module.
[0010] The traffic prediction problem is placed in a federated learning scenario, and privacy constraints are set for the spatiotemporal attention-enhanced dynamic graph convolutional network model.
[0011] Based on privacy constraints, an activation decomposition strategy is implemented on the spatiotemporal attention enhanced dynamic graph convolutional network model, and the activation decomposition strategy is to apply a transformation function to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model.
[0012] Traffic prediction is performed on traffic data collected by sensors using a spatiotemporal attention-enhanced dynamic graph convolutional network model in a federated learning scenario and implementing an activation decomposition strategy.
[0013] Preferably, the traffic prediction problem is defined as:
[0014]
[0015] Where f is the spatiotemporal attention enhanced dynamic graph convolutional network model; X t is a data matrix, representing the traffic data collected by all sensors in the traffic network at time t, X t The dimension is N×C, where N is the number of sensors and C is the number of sensor features; [X t-P+1 ,…,X t ] is the historical traffic data sequence that needs to be input into the spatiotemporal attention enhanced dynamic graph convolutional network model, which contains all observation data from the past time t-P+1 to the current time t; The graph structure representing the traffic network, Where V is the set of nodes in the graph, representing N sensors, |V| = N; E is the set of edges in the graph, representing the connection relationship between sensors; A is the adjacency matrix of the graph; Θ represents all parameters in the model f that need to be learned through training; [X t+1 ,…,X t+Q ] is the traffic prediction result output by model f, that is, the traffic status in the next Q time steps.
[0016] Preferably, the feature enhancement layer in the spatiotemporal attention enhanced dynamic graph convolutional network model is composed of two sequentially connected channel calibration modules and a time calibration module; the channel calibration module is a two-layer fully connected network, which is used to quantify the feature importance scores of different features in traffic data and adjust the features based on the feature importance scores; the time calibration module is composed of two one-dimensional convolutional layers, which is used to quantify the time importance scores of different time steps in traffic data, and adjust the different time step features adjusted by the channel calibration module based on the time importance scores, and finally output enhanced features.
[0017] The dynamic graph convolution recursive network consists of a gated recurrent unit based on dynamic graph convolution expansion, which calculates the gating signal and candidate state through dynamic graph convolution to obtain the output hidden state vector; the dynamic graph convolution performs graph convolution on the enhanced features based on dynamic adjacency matrix learning.
[0018] The multi-head temporal attention module consists of position embedding, a multi-head temporal attention layer and a residual network. The position embedding is used to perform position encoding on each time step of the hidden state vector output by the dynamic graph convolutional recurrent network; the multi-head temporal attention layer is used to calculate the correlation between the time steps after position encoding; the residual network is used to connect the output results of the parallel multi-head temporal attention layers, and perform linear transformation on the connected output results to obtain the output of the temporal attention module.
[0019] The graph attention module consists of a graph attention mechanism, which is used to calculate the graph attention weights of all hidden state vectors output by the dynamic graph convolutional recurrent network, and perform feature adjustment based on the dynamic attention weights to obtain the graph attention module output.
[0020] The spatiotemporal attention fusion module consists of a convolutional layer, which is used to map the fusion of the temporal attention module output and the graph attention module output to the prediction output dimension to generate the final traffic prediction result.
[0021] Preferably, the dynamic adjacency matrix learning representation is:
[0022]
[0023] Where, is the dynamic adjacency matrix finally learned; softmax() is the normalization function; ReLU() is the activation function; is the node embedding matrix; for The transposed matrix of .
[0024] The dynamic graph convolution is expressed as:
[0025]
[0026] Where Z is the output feature of the dynamic graph convolution layer; I N is the unit matrix; X is the enhanced feature of the input; E φ is another node embedding matrix, which is learned by the spatiotemporal attention enhanced dynamic graph convolutional network model; W φ is the shared weight parameter; b φ is the shared bias parameter.
[0027] Preferably, the traffic prediction problem is placed in a federated learning scenario and expressed as:
[0028] transportation network The adjacency matrix and traffic data are C i ∈C={C1,C2,…,C M} client segmentation, where C irepresents the i-th client, and M represents the number of clients.
[0029] The privacy constraints of the spatiotemporal attention enhanced dynamic graph convolutional network model are as follows: the i-th client C i Cannot communicate with other clients C j Sharing Client C i Local traffic data or local graph structure.
[0030] Preferably, the conversion function applied to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model is specifically:
[0031] For client C i The adjacency matrix in the dynamic graph convolutional recurrent network is decomposed using the DReLU strategy or the PAA strategy, and a part of it is only related to the client C i The other part is only related to client C j Related, expressed as:
[0032]
[0033] Where, Represents client C i and client C j The adjacency matrix decomposition form of the node relationship between them; i, j are client indexes; For client C i The corresponding identity matrix; is the applied conversion function, which is the ReLU activation function applied by the DReLU strategy or the polynomial approximation related conversion function applied by the PAA strategy; E i 、E j Client C i and client C j The node embedding matrix of To perform transposition after using the conversion function.
[0034] Based on privacy constraints, the activation decomposition strategy is implemented for the spatiotemporal attention enhanced dynamic graph convolutional network model as follows:
[0035] Each client calculates the corresponding local intermediate results and sends them to the server:
[0036]
[0037] In the formula, Intermediate j For client C j Local intermediate results of calculations; For client C j Output feature matrix at layer l-1.
[0038] The server calculates the global aggregate result based on all received local intermediate results:
[0039]
[0040] Where AGG global This is the global aggregation result.
[0041] The server broadcasts the global aggregation results back to all clients, and the clients themselves perform the final feature transformation and activation to obtain the output of the dynamic graph convolution layer.
[0042] Preferably, for client C i The adjacency matrix in the dynamic graph convolutional recursive network is decomposed using the DReLU strategy as follows:
[0043] Apply the ReLU activation function to client C i The local node embedding matrix, the decomposition of the adjacency matrix is expressed as:
[0044]
[0045] Where, The client C is calculated by applying the DReLU strategy i and client C j The adjacency matrix decomposition form between them; ReLU() is the ReLU activation function; () T Transpose the matrix.
[0046] Based on the decomposed adjacency matrix representation, the output of the dynamic graph convolution layer in the dynamic graph convolution recursive network is specifically:
[0047]
[0048] Where, The client C is calculated by applying the DReLU strategy i The output of the dynamic graph convolution layer l in ; σ is the activation function; Client C i 、C j Output feature matrix at layer l-1; Indicates that the sum of all clients is calculated on the server side; is a learnable weight matrix or tensor used for the final feature transformation.
[0049] Preferably, for client C i The adjacency matrix in the dynamic graph convolutional recursive network is decomposed using the PAA strategy as follows:
[0050] The transformation function of the polynomial approximation is defined as:
[0051]
[0052] Where, A set of K+1 transformation functions used by the PAA strategy; c k (·) is the K-th transformation function, k = 1, 2, …, K; Indicates the operation of k times Cartesian product of the input matrix, which is c k The specific implementation method of (·).
[0053] The c k (·) satisfies the decomposition property:
[0054]
[0055] Where, () k is the kth power; c k (E i ) is for client C i The node embedding matrix of c is applied with the k-th transformation function; k (E j I T For client C j The node embedding matrix of is transposed after applying the k-th transformation function.
[0056] Apply the decomposition property of the transformation function related to the polynomial approximation to the adjacency matrix for decomposition, and the decomposition of the adjacency matrix is expressed as:
[0057]
[0058] Where, Client C is calculated by applying the PAA policy i and client C j The adjacency matrix decomposition form between ; Indicates the accumulation of polynomial orders from k to K; p k are the coefficients of the k-th order polynomial.
[0059] Based on the decomposed adjacency matrix representation, the output of the dynamic graph convolution layer in the dynamic graph convolution recursive network is specifically:
[0060]
[0061] Where, Client C is calculated by applying the PAA policy i The output of the dynamic graph convolution layer l in ; σ is the activation function; Client C i 、C j Output feature matrix at layer l-1; Indicates that the sum of all clients is calculated on the server side; is a learnable weight matrix or tensor used for the final feature transformation.
[0062] On the other hand, the present invention provides a federated spatiotemporal attention adaptive graph learning system, including a model building module, a privacy constraint setting module, an activation decomposition strategy implementation module and a traffic prediction module.
[0063] The model building module is used to construct a traffic prediction problem, and according to the traffic prediction problem, a spatiotemporal attention enhanced dynamic graph convolutional network model is constructed, which consists of a feature enhancement layer, a dynamic graph convolutional recursive network, a multi-head temporal attention module, a graph attention module, and a spatiotemporal attention fusion module.
[0064] The privacy constraint setting module is used to place the traffic prediction problem in a federated learning scenario and set the privacy constraints of the spatiotemporal attention enhanced dynamic graph convolutional network model.
[0065] An activation decomposition strategy implementation module is used to implement an activation decomposition strategy on the spatiotemporal attention enhanced dynamic graph convolutional network model based on privacy constraints. The activation decomposition strategy is to apply a transformation function to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model.
[0066] The traffic prediction module is used to perform traffic prediction on traffic data collected by sensors using a spatiotemporal attention-enhanced dynamic graph convolutional network model in a federated learning scenario and implementing an activation decomposition strategy.
[0067] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the federated spatiotemporal attention adaptive graph learning method as described in any embodiment of the present invention.
[0068] Compared with the prior art, the present invention has the following technical effects:
[0069] The present invention adopts a polynomial-based privacy protection mechanism to learn the spatial dependencies between clients without directly exposing the original data; uses homomorphic encryption and other methods to protect the privacy of data during transmission; reduces time-consuming ciphertext operations on the server side and improves computational efficiency by activating the decomposition strategy; and reduces communication costs by optimizing the model structure and parameters. The core of the method described in the present invention is a dynamic graph convolutional recursive network, which can adaptively adjust its structure to better reflect the dynamic characteristics of the traffic network. It introduces a spatiotemporal attention mechanism to enhance the model's responsiveness to complex and variable spatial patterns. By combining the advantages of federated learning and spatiotemporal graph neural networks and introducing innovative privacy protection mechanisms and adaptive model structures, the present invention successfully solves the problems of privacy leakage risks, high communication costs, and limited model flexibility in the traditional federated spatiotemporal attention adaptive graph learning framework, providing accurate traffic predictions while protecting data privacy. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 This is the overall flow chart of the federated spatiotemporal attention adaptive graph learning method described in the present invention;
[0071] Figure 2 This is the overall structure diagram of the spatiotemporal attention enhanced dynamic graph convolutional network model described in the present invention. DETAILED DESCRIPTION
[0072] In order to make the objectives, technical solutions and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in combination with specific embodiments of the present application and with reference to the accompanying drawings.
[0073] Example 1
[0074] This embodiment provides a federated spatiotemporal attention adaptive graph learning method, see Figure 1 As shown, the following steps are included:
[0075] Constructing traffic prediction problems, such as Figure 2 As shown in the figure, according to the traffic prediction problem, a spatiotemporal attention enhanced dynamic graph convolutional network model is constructed, which consists of a feature enhancement layer, a dynamic graph convolutional recursive network, a multi-head temporal attention module, a graph attention module and a spatiotemporal attention fusion module.
[0076] The goal of traffic forecasting is to use historical traffic data (such as traffic volume and speed) and road network structure information to predict traffic conditions in the future. As a preferred implementation of this embodiment, the traffic forecasting problem is defined as:
[0077]
[0078] Where f is the spatiotemporal attention enhanced dynamic graph convolutional network model; X t is a data matrix, representing the traffic data collected by all sensors in the traffic network at time t, X t The dimension is N×C, where N is the number of sensors and C is the number of sensor features (such as traffic flow, average speed, etc.); [X t-P+1 ,…,X t ] is the historical traffic data sequence that needs to be input into the spatiotemporal attention enhanced dynamic graph convolutional network model, which contains all observation data from the past time t-P+1 to the current time t, and its dimension is P×N×C; The graph structure representing the traffic network, Where V is the set of nodes in the graph, representing N sensors, |V| = N; E is the set of edges in the graph, representing the connection relationship between sensors; A is the adjacency matrix of the graph (dimension is N×N), A ij =1 means there is a connection between node i and node j, A ij = 1 means there is no direct connection between nodes, sometimes it can also represent the strength (weight) of the connection; Θ represents all the parameters in the model f that need to be learned through training (such as the weights and biases of the neural network); [X t+1 ,…,X t+Q ] is the traffic prediction result output by model f, that is, the traffic status in the next Q time steps. It is also a three-dimensional data structure with the dimension of Q×N×C′, where C′ is the number of predicted features, which may be equal to C or only a part of it, such as the predicted speed.
[0079] The above formula defines the goal of the traffic prediction task. This embodiment requires building a model that can predict traffic information in the next Q time steps based on traffic information and road network structure in the past P time steps.
[0080] As a preferred implementation of this embodiment, the role of the feature enhancement layer in the spatiotemporal attention enhanced dynamic graph convolutional network model is to automatically adjust the importance of different features (channel dimensions) and different time points (time dimensions) in the input data, so that the model pays more attention to useful information. The design of the feature enhancement layer in this embodiment is derived from the channel attention mechanism. The feature enhancement layer adopts a "squeeze-excitation" architecture to enhance information exchange between channels and in the time dimension. By automatically adjusting the importance of the feature space, it significantly improves the expressive power of the feature map.
[0081] The feature enhancement layer consists of two sequentially connected channel calibration modules and time calibration modules.
[0082] The model automatically learns to assign different "attention" weights to different traffic features (such as speed and flow) through the channel calibration module. Important features will be amplified and unimportant features will be reduced. The channel calibration module is a two-layer fully connected network that first compresses the feature map. This step enables the model to recalibrate the features using a low-dimensional distribution; then, through a single activation process and self-thresholding mechanism, it analyzes and quantifies the impact of each channel to quantify the feature importance scores of different features in the traffic data and adjust the features based on the feature importance scores. The feature importance score calculation is specifically as follows:
[0083] s (c) =σ(W2δ(W1X (c) +b1)+b2)
[0084]
[0085] Where s (c) For each feature channel c (such as speed, flow), the importance score (value range is between 0 and 1) is calculated, and the original feature X is adjusted (reweighted) by this importance score. (c) ; σ is the Sigmoid activation function, which is used to compress the output to between 0 and 1 and is suitable for representing importance weights; W1, W2, b1, and b2 are the weights and biases of the two fully connected neural network layers, which are part of the parameters Θ that the model needs to learn; δ is the ReLU activation function, which is used to increase the nonlinear expression ability of the model; ⊙ is element-by-element multiplication; is the feature of the cth channel after channel attention adjustment.
[0086] The model automatically learns to assign different "attention" weights to different time points in historical traffic data through the time calibration module. For example, the time points before and after an accident may be more important than normal time points. The time calibration module consists of two one-dimensional convolutional layers, which are used to quantify the time importance scores of different time steps in the traffic data. Based on the time importance scores, the features of different time steps adjusted by the channel calibration module are adjusted, and the enhanced features are finally output. The time importance score is calculated as follows:
[0087] s (t) =σ(Θ 2,k *δ(Θ 1,k *X′ (t) )
[0088] X″ (t) =X′ (t) ⊙s (t)
[0089] Where s (t)is the importance score of the t-th time step calculated; Θ 1,k 、Θ 2,k X′ is the convolution kernel (filter) parameter of two one-dimensional convolution layers with a kernel size of k, which is also part of the parameter Θ that the model needs to learn. The convolution operation * is used to extract patterns in the time series; (t) is the feature at time step t after channel attention adjustment; X″ (t) is the feature of the t-th time step after time and channel dual attention adjustment; X″(all X″ (t) The set of ) is the final output of the entire feature enhancement layer.
[0090] The dynamic graph convolution recursive network is the core of the spatiotemporal attention enhanced dynamic graph convolutional network model, which is used to simultaneously capture the complex relationship of traffic data in space (road network structure) and time (forward and backward dependencies). The new feature of each node in the traditional graph convolutional network is the weighted average of its own and its neighbors' old features. The weight is determined by the fixed road network structure A, and then a linear transformation is performed. The dynamic graph convolution recursive network described in this embodiment improves the traditional graph convolutional network (GCN) by learning the connection relationship and strength between nodes through a dynamic adjacency matrix. Instead of relying on a fixed A.
[0091] The dynamic graph convolution recursive network consists of a gated recurrent unit based on dynamic graph convolution expansion, which calculates the gating signal and candidate state through dynamic graph convolution to obtain the output hidden state vector; the dynamic graph convolution performs graph convolution on the enhanced features based on dynamic adjacency matrix learning.
[0092] As a preferred implementation of this embodiment, the dynamic adjacency matrix learning representation is:
[0093]
[0094] Where, is the dynamic adjacency matrix finally learned, and its value It represents the dependency strength between node i and node j that the model believes, which is learned dynamically based on data; softmax() is a normalization function that normalizes the similarity (usually by row) so that the sum of all "connection" strengths of each node is 1; ReLU() is an activation function; is the node embedding matrix (N×d size), each node i has a d-dimensional vector To represent it, the vector is learned by the spatiotemporal attention enhanced dynamic graph convolutional network model, and d is usually much smaller than N; for The transposed matrix of It represents the similarity (dot product) between node embeddings, and the result is an N×N matrix.
[0095] Furthermore, using the learned dynamic adjacency matrix Perform graph convolution and allow each node to have a different processing method (through node-specific parameters). The dynamic graph convolution is expressed as:
[0096]
[0097] Where Z is the output feature of the dynamic graph convolution layer; I N is the unit matrix; X is the enhanced feature of the input; E φ is another node embedding matrix (N×d size), which is learned by the spatiotemporal attention enhanced dynamic graph convolutional network model and is used to generate node-specific parameters; W φ is a shared, smaller weight parameter; b φ is a shared, smaller bias parameter.
[0098] Furthermore, the goal of the Dynamic Graph Convolution-based Extended Gated Recurrent Unit (DGCGRU) is to enable the standard Gated Recurrent Unit (GRU) to not only process time series information, but also perceive and utilize dynamically changing spatial structure information at each step. This is achieved by replacing the linear transformation used to calculate the gating signal and candidate state in the GRU with a dynamic graph convolution operation. To achieve this, the calculation is expressed as:
[0099]
[0100] Where z t (Dimension N×D) is the update gate, which determines how much of the past hidden state H is retained t-1 , and how many new candidate states to add r t (dimension N×D) is the reset gate, which determines how much of the past hidden state H is ignored t-1 ; (dimension N×D) is the candidate state, which contains new information based on the current spatiotemporal context; H t is the final hidden state of the update; σ is the Sigmoid activation function; is a dynamic graph convolution operation; [,] is a splicing operation, which combines the current input and the previous state; X t (dimension N×C 1 , C 1 is the number of channels after feature enhancement) is the input feature at time t, which already contains preliminary feature importance information; H t-1 H is the hidden state; t-1 、H tThe dimension is N×D, where D is the hidden layer dimension; Θ z 、Θ r 、Θ h Represents three dynamic graph convolution operations respectively The set of learnable parameters involved (mainly the node embedding matrix E φ and shared parameters W φ ), b z 、b r 、b h is the corresponding bias parameter set (mainly shared bias b φ And through E φ nodeization).
[0101] The gated recurrent unit based on dynamic graph convolution expansion described in this embodiment has the following improvements:
[0102] 1. When calculating the two gates, the input is the feature X of the current time step t and the hidden state H of the previous time step t-1 Stitched together, this provides both current observation and historical context for gating decisions.
[0103] 2. Use dynamic graph convolution for expansion, which uses a dynamically learned adjacency matrix This matrix reflects the dependencies that the model believes should exist between nodes based on the data. It aggregates information about each node and its (dynamically determined) neighbors, using node-specific parameters (via E φ W φ and E φ b φ implementation), allowing different nodes to process the aggregated information in different ways.
[0104] 3. When calculating two gates, perform dynamic graph convolution operation Acting on the concatenated input, this means that the gate's decision (deciding how much to forget / keep) is now based on the spatiotemporal features of the current input as well as the spatiotemporal features of the historical state. The model not only looks at the temporal relationship, but also how the current input and historical state evolve in the spatial structure of the graph. For example, if the traffic pattern (feature X) of a certain area (part of the graph) is t ) compared with the historical state H t-1 There have been drastic changes (through operation captured), the gate may make different decisions.
[0105] 4. When calculating the candidate state, the input is the current feature X t And the splicing of the historical state after the reset gate control, The operation is applied again to this concatenated input, which means that the newly generated information is based on the current observation X t It is generated by combining the spatial dependencies on the current dynamic graph structure with some relevant historical context. It represents the "new ideas" proposed by the model in the current spatiotemporal state.
[0106] 5. Final state update This step is the same as the standard GRU, which uses the update gate z t To balance the old state H t-1 and the newly proposed candidate states If we update the gate z t If it is close to 1, the old state is retained more; if it is close to 0, the new state is adopted more. t and The calculations are integrated into the dynamic graph convolution, so the final hidden state H t It contains rich spatiotemporal joint information that evolves over time.
[0107] The multi-head temporal attention module consists of position embedding, a multi-head temporal attention layer and a residual network.
[0108] The position embedding is used to positionally encode each time step of the hidden state vector output by the dynamic graph convolutional recurrent network, adding a unique position information to each time step t in the sequence, because the attention mechanism itself is not aware of the order, expressed as:
[0109]
[0110]
[0111] Where, is the hidden state vector after adding position information; H t [i,:] is the hidden state vector of node i output by DGCGRU at time step t; e t The fixed position encoding vector generated for time step t; t is the position index of the time step; pos is the dimension index in the vector; p is the frequency index; d model is the dimension of the hidden state vector (D).
[0112] The multi-head temporal attention layer is used to calculate the correlation between time steps after position encoding. By calculating the correlation between each time step in the sequence and all other time steps, it aggregates information and captures long-term dependencies. The multi-head layer calculates multiple sets of correlations in parallel, focusing on different aspects. The calculation of the multi-head attention layer is expressed as:
[0113]
[0114]
[0115] Where, is the hidden state sequence output by DGCGRU (position encoding has been added); W Q 、W K 、W V Respectively A learnable weight matrix that maps to the query (Q), key (K), and value (V) spaces; d k is the dimension of the K vector; Used for scaling and stable calculation; softmax()V is the core calculation of attention, which calculates the similarity between Q and K to obtain the weight, and uses the weight to perform weighted summation on V; head i is the output of the i-th attention head, each attention head has its own h is the number of attention heads; Concat() is a concatenation operation that concatenates the outputs of all heads; W O is the final linear mapping layer weight; T Attn is the output of the multi-head attention layer
[0116] The residual network is used to connect the outputs of the parallel multi-head temporal attention layers and linearly transform the connected outputs to obtain the temporal attention module output. Each attention head is followed by a feedforward network and a layer normalization. The residual connections between these components form the residual network.
[0117] The dynamic graph convolutional recurrent network can capture spatial heterogeneity and synchronous spatiotemporal correlation, and the multi-head temporal attention can capture the global temporal information of the traffic context. However, the spatial information of the traffic context often evolves dynamically. For example, a major event at a location (e.g., a concert, a traffic accident) can trigger a sudden increase or decrease in the number of vehicles in the adjacent area. It is difficult to fully model this dynamic evolution with a dynamic graph convolutional recurrent network alone. In order to respond to complex and variable spatial patterns, the model described in this embodiment introduces a graph attention module, which dynamically assigns different weights based on the feature similarity of the target node and the adjacent nodes. The graph attention module is composed of a graph attention mechanism, which focuses on the spatial dimension, that is, dynamically determines which neighbor nodes are more important at this moment, and is used to calculate the graph attention weights of all hidden state vectors output by the dynamic graph convolutional recurrent network, and performs feature adjustment based on the dynamic attention weights to obtain the output of the graph attention module. The purpose of the graph attention mechanism is to calculate the attention weight a of node i to its neighbor j. ij , and use these weights to weight the information of the aggregated neighbors. The calculation is as follows:
[0118] e ij=a(Wh i ,Wh j ),j∈N i
[0119]
[0120] Where H last ={h1,h2,…,h N} is the final hidden state (or its aggregation) output by DGCGRU, which is used as the input of the graph attention module, h i is the feature vector of node i; W is the learnable linear transformation weight; a(,) is the function for calculating the attention coefficient (e.g., a small neural network); e ij is the raw (unnormalized) attention score between node i and its neighbor j; N i is the neighbor set of node i; Leaky ReLU() is the activation function; a ij is the normalized attention weight, indicating how much node i should pay attention to neighbor j; h′ i is the new feature vector of node i after graph attention aggregation; σ is the final activation function.
[0121] The calculation of the above graph attention mechanism can be expressed in matrix form:
[0122] H S =σ((M⊙A)H last W)
[0123] Where H S is the final output matrix of the graph attention module; M is the matrix containing all attention weights a ij A is the adjacency matrix (possibly used for masking, focusing only on actual connections).
[0124] The spatiotemporal attention fusion module consists of a convolutional layer that maps the fusion of the temporal attention module output and the graph attention module output to the prediction output dimension to generate the final traffic prediction result. The fusion and prediction calculation are as follows:
[0125] X t+1:t+Q =Conv(H S +H T )
[0126] Where H T is the output of the temporal attention module; H S is the output of the graph attention module; + is element-level addition (dimension matching may need to be adjusted); Conv() is one or more convolutional layers that map the fused high-level features to the final prediction output dimension; X t+1:t+QThe model finally outputs the traffic status prediction results for the next Q time steps.
[0127] The traffic prediction problem is placed in a federated learning scenario, and privacy constraints are set for the spatiotemporal attention-enhanced dynamic graph convolutional network model.
[0128] As a preferred implementation of this embodiment, the traffic prediction problem is placed in a federated learning scenario and expressed as follows:
[0129] transportation network The adjacency matrix A and traffic data X 1:T C i ∈C={C1,C2,…,C M} client segmentation, where C i represents the i-th client, M represents the number of clients. The data partition is expressed as:
[0130]
[0131] Where A is the global adjacency matrix (N×N); A ii For client C i The inner adjacency submatrix (size N i ×N i , N i For client C i The number of nodes); A ij (i≠j) is client C i and C j The submatrix of the connection relationship between i ×N i );X 1:T Feature data of all global clients from time step 1 to T (size is T×N×C); For client C i Local feature data at time step 1 to T (size T×N i ×C); M is the total number of clients; i and j are the indexes of the clients; 1:T represents the time from time step 1 to T.
[0132] The privacy constraints of the spatiotemporal attention enhanced dynamic graph convolutional network model are as follows: the i-th client C i Cannot communicate with other clients C j Sharing Client C i Local traffic data in Or local graph structure ((Implicit in A iiOr learn through node embedding matrix). For example, the historical traffic data of taxi companies in different regions and the correlation between taxis in different regions are considered sensitive business secrets and are not allowed to be disclosed or shared with others. In addition, this embodiment follows the assumption of most studies that there is no overlapping region and data between clients, that is, for any two clients i and j,
[0133] The proposed spatiotemporal attention-enhanced dynamic graph convolutional network model is applied to federated learning, and its privacy issues are conceptually expressed as follows:
[0134]
[0135] Where, For client C i The output feature matrix of the dynamic graph convolution layer l in the dynamic graph convolutional recurrent network; For client C i The dynamic adjacency matrix between internal nodes (based on calculate); For client C i Output feature matrix of dynamic graph convolution layer l-1 in dynamic graph convolutional recurrent network; For client C i Embedding matrix for generating node-specific parameters; For Combined to generate shared parameters for node-specific weights (possibly shared within the client, or globally); For client C i and C j The dynamic adjacency matrix between nodes (based on calculate); For client C j Output feature matrix of dynamic graph convolution layer l-1 in dynamic graph convolutional recurrent network; For client C j Embedding matrix for generating node-specific parameters; For client C j The corresponding shared parameters.
[0136] Based on the above privacy issues, homomorphic encryption (HE) and other technologies can be used to encrypt E i and H i , performing ciphertext calculations on the server. However, this method has a huge computational overhead, and HE supports limited operations (mainly addition and multiplication), making it difficult to handle nonlinear activation functions such as ReLU and Sigmoid.
[0137] Therefore, in order to solve the privacy constraints and computational limitations brought by the direct application of dynamic graph convolution, this embodiment proposes an activation decomposition strategy: based on the privacy constraints, the activation decomposition strategy is implemented on the spatiotemporal attention enhanced dynamic graph convolutional network model. The activation decomposition strategy is to apply a transformation function to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model. The transformation function is applied to the node embedding matrix E of each client. i , so that subsequent spatial dependency calculations can be decomposed and thus performed in a federated learning environment. The activation decomposition strategy proposed in this embodiment aims to efficiently calculate cross-client spatial dependencies while protecting privacy and handling nonlinear activations.
[0138] As a preferred implementation of this embodiment, the conversion function applied to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model is specifically:
[0139] For client C i The adjacency matrix in the dynamic graph convolutional recurrent network is decomposed using the DReLU strategy or the PAA strategy, and a part of it is only related to the client C i The other part is only related to client C j The key to the decomposition form is that the calculations within the client and between clients depend on the local calculations of each client. or The product of is expressed as:
[0140]
[0141] Where, Represents client C i and client C j The adjacency matrix decomposition form of the node relationship between them; i, j are client indexes; For client C i The corresponding identity matrix (size N i ×N i ), used to represent the self-loop of a node; is the applied conversion function, which is the ReLU activation function applied by the DReLU strategy or the polynomial approximation related conversion function applied by the PAA strategy; E i 、E j Client C i and client C j The node embedding matrix (size is N i ×d、N j ×d); To perform transposition after using the conversion function.
[0142] The above means that the original Calculation (such as or ) is converted to only involve local calculation results and This makes cross-client dependencies This can be achieved through secure aggregation in subsequent steps without directly sharing E i and E j .
[0143] Based on privacy constraints, the activation decomposition strategy is implemented for the spatiotemporal attention enhanced dynamic graph convolutional network model as follows:
[0144] Each client calculates the corresponding local intermediate results and sends them to the server:
[0145]
[0146] In the formula, Intermediate j For client C j Local intermediate results of calculations; For client C j Output feature matrix at layer l-1.
[0147] The server calculates the global aggregate result based on all received local intermediate results:
[0148]
[0149] Where AGG global This is the global aggregation result.
[0150] The server broadcasts the global aggregation results back to all clients, and the clients themselves perform the final feature transformation and activation to obtain the output of the dynamic graph convolution layer.
[0151] As a preferred implementation of this embodiment, the client C i The adjacency matrix in the dynamic graph convolutional recursive network is decomposed using the DReLU strategy as follows:
[0152] Apply the ReLU activation function to client C i The local node embedding matrix, the decomposition of the adjacency matrix is expressed as:
[0153]
[0154] Where, The client C is calculated by applying the DReLU strategy i and client C jThe adjacency matrix decomposition form between them; ReLU() is the ReLU activation function; () T Transpose the matrix.
[0155] Based on the decomposed adjacency matrix representation, the output of the dynamic graph convolution layer in the dynamic graph convolution recursive network is specifically:
[0156]
[0157] Where, The client C is calculated by applying the DReLU strategy i The output of the dynamic graph convolution layer l in ; σ is the activation function (such as ReLU, Tanh, etc.); Client C i 、C j The output feature matrix of the l-1 layer (as the input of this layer, the dimensions are N i ×D l-1 、N j ×D l-1 ); Indicates that the sum of all clients is calculated on the server side; It is a learnable weight matrix or tensor used for the final feature transformation, which may be globally shared or part of the client's local parameters.
[0158] The activation decomposition strategy of DReLU implemented in the spatiotemporal attention enhanced dynamic graph convolutional network model is as follows:
[0159] Each client calculates the corresponding local intermediate results and sends them to the server:
[0160]
[0161] Where, For client C j The local intermediate result calculated using the DReLU strategy; For client C j Output feature matrix at layer l-1.
[0162] The server receives all the local intermediate results Calculate the global aggregation results:
[0163]
[0164] Where AGG global This is the global aggregation result.
[0165] The server broadcasts the global aggregation results back to all clients. iCalculate the value RInside inside the activation function i :
[0166]
[0167] Then apply the activation function to get the client C i Activated i :
[0168] Activated i =σ(RInside i )
[0169] Client C i Perform the final transformation:
[0170]
[0171] Get the output of the dynamic graph convolution layer.
[0172] The advantage of the DReLU strategy described above is that it still keeps the server side only needing to do the summation operation. However, although the DReLU strategy reconstructs the spatial modeling between clients in a relatively concise form, due to the characteristic of the ReLU activation function that sets negative values to zero, applying ReLU in advance will lose negative value information, and the final transformation Occurs after the activation function, its specific meaning is the same as The shared / personalized state of the node needs to be determined based on model design. This early filtering results in the loss of information carried by these negative values when reconstructing spatial dependencies. This loss of negative values limits the model's ability to learn complex nonlinear relationships. In tasks such as traffic flow prediction, interactions between nodes can contain complex positive and negative correlations, which are crucial for accurate prediction. DReLU, due to the loss of some information during activation decomposition, may not fully capture these complex relationships.
[0173] As a preferred implementation of this embodiment, this embodiment proposes a PAA strategy, which uses polynomial approximation activation and learns adaptive coefficients from data to reduce the loss of information between clients during the activation decomposition process. i The adjacency matrix in the dynamic graph convolutional recursive network is decomposed using the PAA strategy as follows:
[0174] Most nonlinear activation functions can be represented by polynomials through Taylor expansion. Recent research has demonstrated the effectiveness of low-order polynomials in approximating training errors. Therefore, this embodiment uses a unified polynomial function to approximate activations and maintain nonlinearity. The core idea of the PAA strategy is to use a K-order polynomial to approximate the target nonlinear activation function (such as the ReLU part or the entire σ function in σ()), expressed as:
[0175]
[0176] Where, is the K-order polynomial approximation of the variable x; p k are the coefficients of the k-th order polynomial, which can be preset (such as Taylor expansion coefficients) or learned during training (possibly globally shared or client-specific p i,k );x k is the kth power of the variable x; K is the highest order of the polynomial, which is used to balance the approximation accuracy and computational / communication complexity.
[0177] If we directly apply this polynomial approximation to the dot product similarity in the dynamic adjacency matrix calculation Then the adjacency matrix decomposition of the PAA strategy is expressed as:
[0178]
[0179] Where, Client C defined for PAA i and client C j The dynamic adjacency matrix decomposition form between; () k is the kth power of the matrix.
[0180] Then there will be privacy issues: Direct calculation Need to access client C at the same time i E i and client C j E j , which is not allowed in federated learning. i 、E j The adjacency matrix of the PAA strategy is calculated under the condition of . The PAA strategy introduces a set of special transformation functions, and the transformation function related to the polynomial approximation is defined as:
[0181]
[0182] Where, A set of K+1 transformation functions used by the PAA strategy; c k(·) is the K-th transformation function, k = 1, 2, ..., K, which usually maps the original embedding matrix E (dimension N × d) to a higher-dimensional or structured space c k (E)(dimension N×d k ); Indicates the operation of k times Cartesian product of the input matrix, which is c k The specific implementation method of (·).
[0183] The above formula shows that originally E i and E j Interaction can be calculated Now it can be decomposed into two parts: one part c k (E i ) depends only on client C i The data, the other part c k (E j ) T Depends only on client C j The interaction between them becomes a simple matrix multiplication.
[0184] The c k The key property of (·) is that they satisfy the decomposition property:
[0185]
[0186] Where, () k is the kth power; c k (E i ) is for client C i The node embedding matrix of c is applied with the k-th transformation function; k (E j ) T For client C j The node embedding matrix of is transposed after applying the k-th transformation function.
[0187] Apply the decomposition property of the transformation function related to the polynomial approximation to the adjacency matrix for decomposition, and the decomposition of the adjacency matrix is expressed as:
[0188]
[0189] Where, Client C is calculated by applying the PAA policy i and client C j The adjacency matrix decomposition form between client C i The node and client C j The connection strength or dependency between the nodes in ; if i = j, This means that client C iThe connection relationship between internal nodes (a N i ×N i matrix); if i≠j, This means that client C i Node and client C j The connection relationship between nodes (a N i ×N j Matrix of ); Indicates the accumulation of polynomial orders from k to K; p k are the coefficients of the k-th order polynomial, which determine the specific form of the polynomial approximation. They are pre-set.
[0190] Based on the decomposed adjacency matrix representation, the output of the dynamic graph convolution layer in the dynamic graph convolution recursive network is specifically:
[0191]
[0192] Where, Client C is calculated by applying the PAA policy i The output of the dynamic graph convolution layer l in [1]. Furthermore, the parameter K is crucial for balancing accuracy and computational complexity: a larger K improves accuracy but increases computational requirements, and vice versa. The specific implementation can be adjusted for different scenarios. In addition, since the value distribution of model parameters, especially node embeddings, varies throughout the training process, the static p1,p2,…,p k is suboptimal. Instead, the polynomial coefficients can be learned dynamically from the data. Each client C i is assigned a unique set of coefficients P i ={p1,p2,…,p k}, these coefficients are iteratively refined using gradient descent in parallel with the evolution of node embeddings; σ is the activation function (e.g., ReLU, Tanh, etc.); Client C i 、C j The output feature matrix of the l-1 layer (as the input of this layer, the dimensions are N i ×D l-1 、N j ×D l-1 ); Indicates that the sum of all clients is calculated on the server side; It is a learnable weight matrix or tensor used for the final feature transformation, which may be globally shared or part of the client's local parameters.
[0193] The above formula describes the situation in which client C uses the PAA strategy in the federated learning scenario. iHow to calculate the output of the lth layer of its graph convolutional neural network. The core idea is to use the decomposition technique of the PAA strategy to convert the calculations that originally required direct interaction across clients (for example, calculations with The conversion of related items) can be completed by a server-safe aggregation of intermediate results.
[0194] The activation decomposition strategy of the spatiotemporal attention enhanced dynamic graph convolutional network model to implement PAA is as follows:
[0195] Each client calculates the corresponding local intermediate result, and all clients C j Send K+1 local intermediate results to the server:
[0196]
[0197] In the formula, Intermediate j,k For client C j The local intermediate results of the calculation, for k = 0, 1, ..., K; For client C j Output feature matrix at layer l-1.
[0198] The server sums each k separately to obtain K+1 global aggregation results:
[0199]
[0200] Where, This is the global aggregation result.
[0201] The server will K+1 Broadcast back to all clients, client C i It performs the complete feature transformation inside the activation function σ itself:
[0202]
[0203] Where, PInside i is the result of feature transformation.
[0204] Client C i Applying the outer activation function yields the final output:
[0205]
[0206] Traffic prediction is performed on traffic data collected by sensors using a dynamic graph convolutional network model that implements an activation decomposition strategy in a federated learning scenario. Furthermore, the activation strategy is integrated into the various components of the spatiotemporal attention-enhanced dynamic graph convolutional network model. Specifically, the core privacy protection mechanism (PAA / DReLU) is embedded in the spatial convolution step of the DGCGRU. Other components (temporal attention, graph attention, and fusion prediction) can be executed directly locally on each client in the federated setting due to the locality of their operations. In other words, spatial information aggregation based on the PAA or DReLU strategy is performed in the federated dynamic graph convolution, including a process of local computation -> secure aggregation (server-side) -> local update. This enables the model to capture cross-client spatial dependencies without leaking the original data. The computations for the multi-head temporal attention module, graph attention module, and spatiotemporal attention fusion module in the spatiotemporal attention-enhanced dynamic graph convolutional network model are all performed locally.
[0207] To verify the effectiveness and superiority of the method provided in this embodiment, some specific experimental cases are provided below:
[0208] 1. Dataset
[0209] Three traffic flow datasets (i.e., PeMSD4, PeMSD7, and PeMSD8) collected by California Department of Transportation sensors on highways, the METR-LA dataset, and the PEMS-BAY dataset are used as datasets for all experiments.
[0210] The PeMSD4 dataset covers traffic conditions in the San Francisco Bay Area and includes 3,848 sensors located on 29 roads. The data spans January and February 2018. During preprocessing, redundant sensors were removed to ensure that the distance between adjacent sensors exceeded 3.5 miles, resulting in a total of 307 sensors remaining. Traffic data is aggregated every 5 minutes, resulting in 288 data points per sensor per day. Missing values are filled using linear interpolation, and the data are normalized to zero mean.
[0211] The PeMSD7 dataset describes traffic conditions in California's 7th District. It contains 228 sensors covering weekdays in May and June 2012. Traffic flow speed data is aggregated every 5 minutes and normalized using the Z-score as input. Road topology is represented using a graph adjacency matrix. In PeMSD7, the adjacency matrix is symmetric based on the distance between sensors.
[0212] The PeMSD8 dataset depicts traffic conditions in the San Bernardino area and contains 1,979 sensors on eight roads over a period of 62 days, from July 1, 2016, to August 31, 2016. During preprocessing, some redundant sensors were removed, ultimately retaining 170 sensors. The data was normalized using zero mean.
[0213] The METR-LA (Metro Traffic Los Angeles) dataset is a commonly used dataset for traffic flow forecasting, primarily used to study and evaluate the performance of traffic prediction algorithms. This dataset contains traffic sensor data from the Los Angeles area and is used to build and validate traffic flow prediction models. The data format is typically time series data, containing traffic flow information from traffic sensors at different points in time. The METR-LA dataset records traffic flow every five minutes at 207 locations in Los Angeles for three months.
[0214] The PEMS-BAY dataset contains traffic data from 325 sensors in the Bay Area of California, collected over a six-month period from January 1 to May 31, 2017. Traffic flow speed data is aggregated every 5 minutes and normalized using the Z-score. Road topology is represented using a graph adjacency matrix.
[0215] In the graph modeling of traffic data, each node in METR-LA and PeMSData represents a sensor. Detailed information about each dataset is shown in Table 1.
[0216] Table 1 Detailed information of each dataset
[0217]
[0218] 2. Experimental environment
[0219] In this experiment, the default hyperparameter configuration set the hidden feature dimension to 64, with two hidden layers. The embedding dimension was set to 2, the number of heads in the multi-head attention mechanism was set to 4, the number of graph convolution layers was set to 2, and the polynomial coefficient was set to 4. The learning rate was 0.003, and the batch size was 64. During training, the model was trained for 200 global epochs and 2 local epochs. The validation and test set ratios were both set to 20%. In addition, the validation rate and test rate were both set to 0.2. Performance metrics for the experiment include root mean square error (RMSE), mean absolute error (MAE), and mean absolute ratio error (MAPE). Lower values for these metrics indicate better prediction performance.
[0220] All experiments use PyTorch 1.11.0 and are performed on a 12vCPU Intel(R) Xeon(R) Platinum 8352vCPU @ 2.10GHz and an NVIDIA RTX 4090 GPU with CUDA 11.6.
[0221] 3. Experimental results
[0222] As shown in Table 2 (the “\” in the table indicates that the baseline method does not provide reproducible code and the indicator is not in the original text), in the experimental evaluation on multiple datasets, the method described in this embodiment (Federated Spatio-TemporalAttention Adaptive Graph Learning Method, FST-AAGLM) demonstrated excellent performance, especially on the PEMSD4 and PEMSD8 datasets. In the analysis of the PEMSD4 dataset, the method described in this embodiment achieved the best performance in both speed and flow prediction tasks. Compared with the suboptimal baseline method, the method described in this embodiment reduced the root mean square error (RMSE) by 1.1% and the mean absolute percentage error (MAPE) by 23.6% in the speed prediction task; in the flow prediction task, the RMSE was reduced by 11.99% and the mean absolute error (MAE) was reduced by 17.74%.
[0223] Furthermore, on the PEMSD8 dataset, the method described in this embodiment outperformed the suboptimal baseline method in all three tasks: occupancy, speed, and flow. Specifically, the method described in this embodiment improved the MAE by 12.06% and the MAPE by 12.06% in the occupancy task; the MAE by 4.94% and the MAPE by 4.94% in the speed task; and the MAE by 12.10% and the MAPE by 12.10% in the flow task. These results demonstrate that the method described in this embodiment can provide more accurate prediction results across various traffic prediction tasks. On the PEMSD7 dataset, the method described in this embodiment achieved a MAE of 2.4525, outperforming most other methods, including FEDGTP and CTFL-MTGNN. On the PEMSD8 dataset, the method described in this embodiment achieved an RMSE of 1.3211 and a MAE of 0.7821 in speed prediction, demonstrating its high efficiency in handling occupancy and flow prediction.
[0224] Overall, the method described in this embodiment performs well on multiple data sets and indicators. These results show that the method described in this embodiment can effectively capture the dynamic changes of traffic flow while ensuring privacy, providing strong support for the optimization of intelligent transportation systems.
[0225] Table 2 Performance of FST-AAGLM and different baseline methods in prediction tasks on different datasets
[0226]
[0227]
[0228] 4. Conclusion
[0229] This embodiment proposes an innovative federated spatiotemporal attention adaptive graph learning method to address the challenges in urban traffic forecasting, especially in terms of data privacy protection and model accuracy. With the continuous expansion of cities and the increasing complexity of transportation networks, traditional centralized traffic forecasting methods can no longer meet the needs of modern intelligent transportation systems. These methods usually require the centralization of large amounts of sensitive traffic data, which not only poses the risk of privacy leakage but is also difficult to implement in real-world scenarios where data is dispersed. The method described in this embodiment is designed to address these problems. It combines the advantages of federated learning and spatiotemporal graph neural networks to provide accurate traffic forecasts while protecting data privacy.
[0230] The core of the federated spatiotemporal attention adaptive graph learning approach is a spatiotemporal attention enhanced dynamic graph convolutional network (STADE-DGCN). This approach improves the model's ability to capture traffic flow variations by dynamically learning spatiotemporal dependencies in traffic networks. Compared to traditional graph neural networks, STADES-DGCN can adaptively adjust its structure to better reflect the dynamic characteristics of traffic networks. This adaptability enables the model to more flexibly respond to unexpected events and cyclical changes in traffic networks, thereby improving prediction accuracy.
[0231] In the context of federated learning, the method described in this embodiment particularly emphasizes the importance of privacy protection. A polynomial-based privacy protection mechanism is adopted, which allows the model to learn the spatial dependencies between clients without directly exposing the original data. This method not only protects the privacy of the data, but also improves the efficiency of model training by reducing communication costs. In the experiment, the performance of the method described in this embodiment on multiple real-world traffic datasets was demonstrated. The results showed that compared with other baseline methods, the method described in this embodiment achieved better results in key indicators such as root mean square error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE).
[0232] In addition, ablation experiments and hyperparameter experiments were conducted to evaluate the impact of various components and parameters in the method described in this embodiment on the model performance. The ablation experiment results show that each component in STADES-DGCN, including the feature enhancement layer, the multi-head temporal attention module, and the graph attention module, contributes significantly to the overall performance of the model. In particular, the graph attention module can significantly improve the model's ability to capture complex spatial dependencies in traffic networks. Hyperparameter experiments reveal the impact of node embedding dimension and the number of multi-head attention heads on model performance, providing insights into how to adjust these parameters for optimal performance based on different datasets and application scenarios.
[0233] The successful implementation of the method described in this example not only demonstrates its technical feasibility but also demonstrates its potential for practical application. As intelligent transportation systems increase their demands for data privacy and prediction accuracy, the method described in this example provides an effective solution. It not only protects data privacy but also provides accurate traffic predictions, which are of great significance for areas such as transportation planning, congestion relief, and road safety.
[0234] Example 2
[0235] Accordingly, this embodiment provides a federated spatiotemporal attention adaptive graph learning system, which is used to implement the federated spatiotemporal attention adaptive graph learning method as described in Example 1 of the present invention, including a model construction module, a privacy constraint setting module, an activation decomposition strategy implementation module, and a traffic prediction module.
[0236] The model building module is used to construct a traffic prediction problem, and according to the traffic prediction problem, a spatiotemporal attention enhanced dynamic graph convolutional network model is constructed, which consists of a feature enhancement layer, a dynamic graph convolutional recursive network, a multi-head temporal attention module, a graph attention module, and a spatiotemporal attention fusion module.
[0237] The privacy constraint setting module is used to place the traffic prediction problem in a federated learning scenario and set the privacy constraints of the spatiotemporal attention enhanced dynamic graph convolutional network model.
[0238] An activation decomposition strategy implementation module is used to implement an activation decomposition strategy on the spatiotemporal attention enhanced dynamic graph convolutional network model based on privacy constraints. The activation decomposition strategy is to apply a transformation function to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model.
[0239] The traffic prediction module is used to perform traffic prediction on traffic data collected by sensors using a spatiotemporal attention-enhanced dynamic graph convolutional network model in a federated learning scenario and implementing an activation decomposition strategy.
[0240] Example 3
[0241] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for learning a federated spatiotemporal attention adaptive graph as described in the first embodiment of the present invention is implemented.
[0242] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c can be single or multiple.
[0243] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented using a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0244] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0245] In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory; hereinafter referred to as: ROM), random access memory (Random Access Memory; hereinafter referred to as: RAM), magnetic disk or optical disk, and other media that can store program code.
[0246] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention's description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A federated spatiotemporal attention adaptive graph learning method, characterized by: The following steps are involved: Constructing a traffic prediction problem, and constructing a spatiotemporal attention enhanced dynamic graph convolutional network model based on the traffic prediction problem, which consists of a feature enhancement layer, a dynamic graph convolutional recursive network, a multi-head temporal attention module, a graph attention module, and a spatiotemporal attention fusion module; The traffic prediction problem is placed in a federated learning scenario, and privacy constraints are set for the spatiotemporal attention-enhanced dynamic graph convolutional network model. Based on privacy constraints, implementing an activation decomposition strategy on the spatiotemporal attention enhanced dynamic graph convolutional network model, wherein the activation decomposition strategy is to apply a transformation function to the dynamic graph convolutional recurrent network in the spatiotemporal attention enhanced dynamic convolutional network model; Traffic prediction is performed on traffic data collected by sensors using a spatiotemporal attention-enhanced dynamic graph convolutional network model in a federated learning scenario and implementing an activation decomposition strategy.
2. The federated spatiotemporal attention adaptive graph learning method according to claim 1, characterized in that The traffic prediction problem is defined as: Where f is the spatiotemporal attention enhanced dynamic graph convolutional network model; X t is a data matrix, representing the traffic data collected by all sensors in the traffic network at time t, X t The dimension is N×C, where N is the number of sensors and C is the number of sensor features; [X t-P+1 ,…,X t ] is the historical traffic data sequence that needs to be input into the spatiotemporal attention enhanced dynamic graph convolutional network model, which contains all observation data from the past time t-P+1 to the current time t; The graph structure representing the traffic network, Where V is the set of nodes in the graph, representing N sensors, |V| = N; E is the set of edges in the graph, representing the connection relationship between sensors; A is the adjacency matrix of the graph; Θ represents all parameters in the model f that need to be learned through training; [X t+1 ,…,X t+Q ] is the traffic prediction result output by model f, that is, the traffic status in the next Q time steps.
3. The federated spatiotemporal attention adaptive graph learning method according to claim 2, characterized in that The feature enhancement layer in the spatiotemporal attention enhanced dynamic graph convolutional network model consists of two sequentially connected channel calibration modules and a time calibration module; the channel calibration module is a two-layer fully connected network used to quantify the feature importance scores of different features in traffic data and adjust the features based on the feature importance scores; The time calibration module consists of two one-dimensional convolutional layers, which are used to quantify the time importance scores of different time steps in the traffic data. Based on the time importance scores, the features of different time steps adjusted by the channel calibration module are adjusted, and the enhanced features are finally output. The dynamic graph convolution recursive network consists of a gated recurrent unit based on dynamic graph convolution expansion, which calculates the gating signal and candidate state through dynamic graph convolution to obtain the output hidden state vector; the dynamic graph convolution performs graph convolution on the enhanced features based on dynamic adjacency matrix learning; The multi-head temporal attention module consists of a position embedding, a multi-head temporal attention layer, and a residual network. The position embedding is used to positionally encode each time step of the hidden state vector output by the dynamic graph convolutional recurrent network. The multi-head temporal attention layer is used to calculate the correlation between time steps after position encoding; the residual network is used to connect the output results of the parallel multi-head temporal attention layers and perform linear transformation on the connected output results to obtain the temporal attention module output; The graph attention module consists of a graph attention mechanism, which is used to calculate the graph attention weights of all hidden state vectors output by the dynamic graph convolutional recurrent network, and perform feature adjustment based on the dynamic attention weights to obtain the output of the graph attention module; The spatiotemporal attention fusion module consists of a convolutional layer, which is used to map the fusion of the temporal attention module output and the graph attention module output to the prediction output dimension to generate the final traffic prediction result.
4. The federated spatiotemporal attention adaptive graph learning method according to claim 3, characterized in that The dynamic adjacency matrix learning is expressed as: Where, is the dynamic adjacency matrix finally learned; softmax() is the normalization function; ReLU() is the activation function; is the node embedding matrix; for The transposed matrix of The dynamic graph convolution is expressed as: Where Z is the output feature of the dynamic graph convolution layer; I N is the unit matrix; X is the enhanced feature of the input; E φ is another node embedding matrix, which is learned by the spatiotemporal attention enhanced dynamic graph convolutional network model; W φ is the shared weight parameter; b φ is the shared bias parameter.
5. The federated spatiotemporal attention adaptive graph learning method according to claim 3, characterized in that The traffic prediction problem is expressed in the federated learning scenario as follows: transportation network The adjacency matrix and traffic data are C i ∈C={C1,C2,…,C M } client segmentation, where C i represents the i-th client, M represents the number of clients; The privacy constraints of the spatiotemporal attention enhanced dynamic graph convolutional network model are as follows: the i-th client C i Cannot communicate with other clients C j Sharing Client C i Local traffic data or local graph structure.
6. The federated spatiotemporal attention adaptive graph learning method according to claim 5, characterized in that The conversion function applied to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model is specifically: For client C i The adjacency matrix in the dynamic graph convolutional recurrent network is decomposed using the DReLU strategy or the PAA strategy, and a part of it is only related to the client C i The other part is only related to client C j Related, expressed as: Where, Represents client C i and client C j The adjacency matrix decomposition form of the node relationship between them; i and j are client indexes; For client C i The corresponding identity matrix; is the applied conversion function, which is the ReLU activation function applied by the DReLU strategy or the polynomial approximation related conversion function applied by the PAA strategy; E i 、E j Client C i and client C j The node embedding matrix of To perform transposition after using the conversion function; Based on privacy constraints, the activation decomposition strategy is implemented for the spatiotemporal attention enhanced dynamic graph convolutional network model as follows: Each client calculates the corresponding local intermediate results and sends them to the server: In the formula, Intermediate j For client C j Local intermediate results of calculations; For client C j Output feature matrix at layer l-1; The server calculates the global aggregate result based on all received local intermediate results: Where AGG global is the global aggregation result; The server broadcasts the global aggregation results back to all clients, and the clients themselves perform the final feature transformation and activation to obtain the output of the dynamic graph convolution layer.
7. The federated spatiotemporal attention adaptive graph learning method according to claim 6, characterized in that For client C i The adjacency matrix in the dynamic graph convolutional recursive network is decomposed using the DReLU strategy as follows: Apply the ReLU activation function to client C i The local node embedding matrix, the decomposition of the adjacency matrix is expressed as: Where, The client C is calculated by applying the DReLU strategy i and client C j The adjacency matrix decomposition form between ; ReLU() is the ReLU activation function; T is the matrix transpose; Based on the decomposed adjacency matrix representation, the output of the dynamic graph convolution layer in the dynamic graph convolution recursive network is specifically: Where, The client C is calculated by applying the DReLU strategy i The output of the dynamic graph convolution layer l in ; σ is the activation function; Client C i 、C j Output feature matrix at layer l-1; Indicates that the sum of all clients is calculated on the server side; is a learnable weight matrix or tensor used for the final feature transformation.
8. The federated spatiotemporal attention adaptive graph learning method according to claim 6, characterized in that For client C i The adjacency matrix in the dynamic graph convolutional recursive network is decomposed using the PAA strategy as follows: The transformation function of the polynomial approximation is defined as: Where, A set of K+1 transformation functions used by the PAA strategy; c k (·) is the K-th transformation function, k = 1, 2, …, K; Indicates the operation of k times Cartesian product of the input matrix, which is c k (·) specific implementation methods; The c k (·) satisfies the decomposition property: Where, () k is the kth power; c k (E i ) is for client C i The node embedding matrix of c is applied with the k-th transformation function; k (E j I T For client C j The node embedding matrix of is transposed after applying the k-th transformation function; Apply the decomposition property of the transformation function related to the polynomial approximation to the adjacency matrix for decomposition, and the decomposition of the adjacency matrix is expressed as: Where, Client C is calculated by applying the PAA policy i and client C j The adjacency matrix decomposition form between ; Indicates the accumulation of polynomial orders from k to K; p k are the coefficients of the k-th order polynomial; Based on the decomposed adjacency matrix representation, the output of the dynamic graph convolution layer in the dynamic graph convolution recursive network is specifically: Where, Client C is calculated by applying the PAA policy i The output of the dynamic graph convolution layer l in ; σ is the activation function; Client C i 、C j Output feature matrix at layer l-1; Indicates that the sum of all clients is calculated on the server side; is a learnable weight matrix or tensor used for the final feature transformation.
9. A federated spatiotemporal attention adaptive graph learning system, characterized by: The system is used to implement the federated spatiotemporal attention adaptive graph learning method according to any one of claims 1 to 8, comprising a model building module, a privacy constraint setting module, an activation decomposition strategy implementation module, and a traffic prediction module; A model building module is used to construct a traffic prediction problem, and to build a spatiotemporal attention enhanced dynamic graph convolutional network model based on the traffic prediction problem, which consists of a feature enhancement layer, a dynamic graph convolutional recursive network, a multi-head temporal attention module, a graph attention module, and a spatiotemporal attention fusion module; A privacy constraint setting module, used to place the traffic prediction problem in a federated learning scenario and set privacy constraints for the spatiotemporal attention-enhanced dynamic graph convolutional network model; an activation decomposition strategy implementation module, configured to implement an activation decomposition strategy on the spatiotemporal attention enhanced dynamic graph convolutional network model based on privacy constraints, wherein the activation decomposition strategy is to apply a transformation function to the dynamic graph convolutional recursive network in the spatiotemporal attention enhanced dynamic convolutional network model; The traffic prediction module is used to perform traffic prediction on traffic data collected by sensors using a spatiotemporal attention-enhanced dynamic graph convolutional network model in a federated learning scenario and implementing an activation decomposition strategy.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the federated spatiotemporal attention adaptive graph learning method as described in any one of claims 1 to 8.
Citation Information
Cited By
Self-evolution federal element learning method for cross-domain heterogeneous space-time intelligence
CN121279362A
Machine abnormal sound detection method based on feature enhancement dynamic graph convolution
CN121483303A
Machine abnormal sound detection method based on feature enhancement dynamic graph convolution
CN121483303B