Traffic flow prediction and model training method based on federal space-time diagram learning
Through the federated spatiotemporal graph learning method, spatiotemporal dependencies are generated and aggregated, which solves the problems of time-varying spatiotemporal dependencies and data privacy protection in traffic flow prediction, and achieves efficient and accurate traffic prediction.
Patent Information
- Application Number
- CN202510829142.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-26
AI Technical Summary
Existing technologies have difficulty in effectively capturing the time-varying nature of spatiotemporal dependencies in urban traffic networks in traffic flow forecasting, and there are issues with data privacy protection.
A method based on federated spatiotemporal graph learning is adopted. The node feature matrix of the spatiotemporal graph is generated locally, and the spatiotemporal dependency is determined by combining the pre-trained node embedding matrix and time embedding matrix. The matrix is aggregated on the server side, and the traffic is predicted using a prediction model.
Under the premise of protecting data privacy, the spatiotemporal dependencies between and within clients are effectively captured, which improves the accuracy and efficiency of traffic flow prediction.
Smart Images

Figure CN120708397A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and more particularly to a traffic flow prediction and model training method based on federated spatiotemporal graph learning. Background Art
[0002] Traffic flow forecasting is crucial for improving road utilization and alleviating congestion. However, with the increasing complexity of urban traffic networks, the challenges faced by traffic flow forecasting are becoming increasingly significant. These challenges are mainly reflected in three aspects. First, the traffic flow data generated by each node in the traffic network (such as roads, sensors, and monitoring equipment) will change dynamically over time due to constantly changing traffic conditions. Second, there are complex spatiotemporal dependencies between traffic flow data of different nodes, which means that the traffic flow data at a specific location is not only affected by its own historical traffic data, but also by neighboring nodes. Third, the spatiotemporal dependencies between nodes will also change over time, which means that the relationship between different locations is not static, but will adjust as traffic patterns change. Summary of the Invention
[0003] The embodiments of the present disclosure propose a traffic flow prediction and model training method and device based on federated spatiotemporal graph learning.
[0004] In a first aspect, an embodiment of the present disclosure provides a traffic flow prediction method based on federated spatiotemporal graph learning, comprising: generating a node feature matrix of a spatiotemporal graph based on historical traffic flow stored in a local client; determining spatiotemporal dependencies based on the node feature matrix, a pre-trained node embedding matrix, and a pre-trained time embedding matrix; sending the spatiotemporal dependencies to a server, and receiving aggregated spatiotemporal dependencies returned by the server, wherein the aggregated spatiotemporal dependencies are obtained by the server aggregating spatiotemporal dependencies from different clients; and determining future traffic flow based on the aggregated spatiotemporal dependencies through a pre-trained prediction model.
[0005] In some embodiments, the spatiotemporal dependency is determined based on the node feature matrix, the pre-trained node embedding matrix and the pre-trained time embedding matrix, including: determining the self-learning matrix by calculating the inner product of the node embedding matrix; determining the trend factor based on the time embedding matrix by performing matrix multiplication; determining the periodic discriminant function matrix by calculating the nonlinear transformation of the inner product of the node feature matrix; determining the spatiotemporal dependency based on the self-learning matrix, the trend factor and the periodic discriminant function matrix.
[0006] In some embodiments, the spatiotemporal dependency is sent to a server, and the aggregated spatiotemporal dependency returned by the server is received, including: reconstructing the spatiotemporal dependency to obtain a first dependency associated with a node embedding matrix and a second dependency associated with a node feature matrix; sending the first dependency and the second dependency to the server, and receiving the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency returned by the server, wherein the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency are obtained by the server aggregating the first dependencies and the second dependencies from different clients respectively; and restoring the aggregated spatiotemporal dependency based on the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency.
[0007] In some embodiments, the spatiotemporal dependency is reconstructed to obtain a first dependency associated with the node embedding matrix and a second dependency associated with the node feature matrix, including: transforming the node feature matrix in the spatiotemporal dependency based on a polynomial approximation algorithm to obtain a first dependency associated with the node embedding matrix and a second dependency associated with the node feature matrix.
[0008] In a second aspect, an embodiment of the present disclosure provides a model training method, including: obtaining training samples, an initial node embedding matrix, and an initial time embedding matrix, wherein the training samples include traffic flow in a first time period and traffic flow in a second time period, and the second time period is an adjacent time period after the first time period; generating a node feature matrix of a spatiotemporal graph based on the traffic flow in the first time period; determining spatiotemporal dependencies based on the node feature matrix, the initial node embedding matrix, and the initial time embedding matrix; sending the spatiotemporal dependencies to a server, and receiving aggregated spatiotemporal dependencies returned by the server, wherein the aggregated spatiotemporal dependencies are obtained by the server aggregating spatiotemporal dependencies from different clients; determining a traffic flow prediction value through a prediction model based on the aggregated spatiotemporal dependencies; and adjusting the network parameters, node embedding matrix, and time embedding matrix of the prediction model based on the difference between the traffic flow prediction value and the traffic flow in the second time period.
[0009] In a third aspect, an embodiment of the present disclosure provides a traffic flow prediction device based on federated spatiotemporal graph learning, comprising: a first generation unit, configured to generate a node feature matrix of a spatiotemporal graph based on historical traffic flow stored in a local client; a first determination unit, configured to determine the spatiotemporal dependency based on the node feature matrix, a pre-trained node embedding matrix, and a pre-trained time embedding matrix; a first aggregation unit, configured to send the spatiotemporal dependency to a server, and receive the aggregated spatiotemporal dependency returned by the server, wherein the aggregated spatiotemporal dependency is obtained by the server aggregating spatiotemporal dependencies from different clients; a first prediction unit, configured to determine the future traffic flow based on the aggregated spatiotemporal dependency through a pre-trained prediction model.
[0010] In some embodiments, the first determination unit is further configured to: determine the self-learning matrix by calculating the inner product of the node embedding matrix; determine the trend factor based on the time embedding matrix by performing matrix multiplication; determine the periodic discriminant function matrix by calculating the nonlinear transformation of the inner product of the node feature matrix; determine the spatiotemporal dependency based on the self-learning matrix, the trend factor and the periodic discriminant function matrix.
[0011] In some embodiments, the first aggregation unit is further configured to: reconstruct the spatiotemporal dependency to obtain a first dependency associated with the node embedding matrix and a second dependency associated with the node feature matrix; send the first dependency and the second dependency to the server, and receive the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency returned by the server, wherein the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency are obtained by the server aggregating the first dependencies and the second dependencies from different clients respectively; and restore the aggregated spatiotemporal dependency based on the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency.
[0012] In some embodiments, the first aggregation unit is further configured to: transform the node feature matrix in the spatiotemporal dependency relationship based on a polynomial approximation algorithm to obtain a first dependency relationship associated with the node embedding matrix and a second dependency relationship associated with the node feature matrix.
[0013] In a fourth aspect, an embodiment of the present disclosure provides a model training device, comprising: an acquisition unit, configured to acquire training samples, an initial node embedding matrix, and an initial time embedding matrix, wherein the training samples include traffic flow in a first time period and traffic flow in a second time period, and the second time period is an adjacent time period after the first time period; a second generation unit, configured to generate a node feature matrix of a spatiotemporal graph based on the traffic flow in the first time period; a second determination unit, configured to determine the spatiotemporal dependency based on the node feature matrix, the initial node embedding matrix, and the initial time embedding matrix; a second aggregation unit, configured to send the spatiotemporal dependency to a server, and receive the aggregated spatiotemporal dependency returned by the server, wherein the aggregated spatiotemporal dependency is obtained by the server aggregating spatiotemporal dependencies from different clients; a second prediction unit, configured to determine a traffic flow prediction value through a prediction model based on the aggregated spatiotemporal dependency; an adjustment unit, configured to adjust the network parameters, node embedding matrix, and time embedding matrix of the prediction model based on the difference between the traffic flow prediction value and the traffic flow in the second time period.
[0014] In a fifth aspect, an embodiment of the present disclosure provides an electronic device comprising: one or more processors; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processors, the one or more processors implement a method as described in any one of the first aspect or the second aspect.
[0015] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method as described in any one of the first aspect or the second aspect is implemented.
[0016] In a seventh aspect, an embodiment of the present disclosure provides a computer program product, comprising a computer program, which implements the method as described in any one of the first aspect or the second aspect when executed by a processor.
[0017] The disclosed embodiments provide a method and apparatus for traffic flow prediction and model training based on federated spatiotemporal graph learning. This method constructs local spatiotemporal dependencies using a node feature matrix, a node embedding matrix, and a time embedding matrix. These are then aggregated and sent to a server. The aggregated spatiotemporal dependencies are then used to perform traffic flow prediction using a model. Federated learning enables multiple data owners (also known as clients) to collaborate on model training without sharing the original data. It also preserves the time-varying characteristics of spatiotemporal dependencies between and within clients, thereby improving the accuracy of traffic flow predictions.
[0018] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Other features, objects and advantages of the present disclosure will become more apparent from a reading of the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied; Figure 2 is a flowchart of an embodiment of a traffic flow prediction method based on federated spatiotemporal graph learning according to the present disclosure; Figure 3 is a flowchart of an embodiment of a model training method according to the present disclosure; Figure 4 is a schematic diagram of an application scenario of the traffic flow prediction and model training method based on federated spatiotemporal graph learning according to the present disclosure; Figure 5 is a structural diagram of an embodiment of a traffic flow prediction device based on federated spatiotemporal graph learning according to the present disclosure; Figure 6 is a structural diagram of an embodiment of a model training device according to the present disclosure; Figure 7 It is a schematic diagram of the structure of a computer system of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0020] The present disclosure will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.
[0021] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0022] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of the traffic flow prediction and model training method based on federated spatiotemporal graph learning or the traffic flow prediction and model training device based on federated spatiotemporal graph learning of the present disclosure can be applied.
[0023] like Figure 1As shown, system architecture 100 may include multiple clients (e.g., client 101, client 102, and client 103), a network 104, and a server 105. The network is a medium used to provide a communication link between the client and the server. The network may include various connection types, such as wired and wireless communication links.
[0024] The server is the business side of federated learning, and the client is the modeling participant. In theory, the server, as the business side, owns the label variables (dependent variables) and some independent variables, while the other participants own the remaining independent variables. The interaction process often involves the server exchanging encrypted dependent variables (or independent variables) and the ciphertext value of the dependent variables after calculating constants with the participants.
[0025] When multiple data owners (such as enterprises, governments, and other institutions) want to combine their respective data to train models, they must ensure that the original data owned by each party does not leave the local area while building a unified model.
[0026] The application scenario of this disclosure is federated learning, where a server receives feature data from different clients, aggregates it, and then returns it to each client. The clients can be devices used to store traffic flow data collected by roads, sensors, and monitoring equipment, and are distributed in different areas.
[0027] It should be noted that a server can be either hardware or software. When a server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When a server is software, it can be implemented as multiple software programs or software modules (for example, multiple software programs or software modules used to provide distributed services), or as a single software program or software module. This is not specifically limited here.
[0028] It should be noted that the method for traffic flow prediction based on federated spatiotemporal graph learning provided in the embodiments of this application can be executed by a client. Accordingly, the device for traffic flow prediction based on federated spatiotemporal graph learning can be provided in the client. The model training method provided in the embodiments of this application can be executed by a client. Accordingly, the model training device can be provided in the client. This is not specifically limited here.
[0029] It should be understood that Figure 1 The number of clients, networks, and servers in the embodiment is merely illustrative. Any number of clients, networks, and servers may be used depending on the implementation requirements.
[0030] Table 1 shows some of the symbols used in this application.
[0031]
[0032] Table 1
[0033] Continue to refer Figure 2 , shows a process 200 of an embodiment of a traffic flow prediction method based on federated spatiotemporal graph learning according to the present disclosure. The traffic flow prediction method based on federated spatiotemporal graph learning includes the following steps: Step 201: Generate a node feature matrix of a spatiotemporal graph based on historical traffic flow stored in a local client; In this embodiment, the execution body of the traffic flow prediction method based on federated spatiotemporal graph learning (e.g. Figure 1 The client shown in the figure can store historical traffic flow data of multiple nodes. Each node usually records traffic flow every 15 minutes. The time series data of traffic flow corresponding to the node is the feature of the node.
[0034] To represent the complex adjacency relationships between nodes, complex topological structures can be stored in the form of a spatiotemporal graph. Traffic flow has strong cyclical patterns on daily and weekly cycles. Taking into account the cyclical nature of traffic flow, a spatiotemporal graph convolutional network can be used to generate a global spatiotemporal graph based on the adjacency relationships between nodes.
[0035] In the traffic flow prediction based on federated spatiotemporal graph, the global spatiotemporal graph is divided into multiple non-overlapping clients. Specifically, let represents a set of non-overlapping clients, where each client Have a subgraph .in, Represents the client The set of nodes owned by the client The total number of nodes owned is , then the node data of all clients is ; Represents the client The set of edges owned; Is the client In time The adjacency matrix captures the spatiotemporal dependencies between nodes in the subgraph. Have a local dataset ,in Representing the client The time series of the recorded node feature matrix.
[0036] Step 202: determining spatiotemporal dependencies based on the node feature matrix, the pre-trained node embedding matrix, and the pre-trained time embedding matrix; In this embodiment, the present disclosure proposes a novel federated graph learning framework. It aims to effectively capture spatiotemporal dependencies between and within clients for traffic flow forecasting. This disclosure integrates time-aware learning to capture trend characteristics and utilizes periodic discriminant functions to model cyclical changes.
[0037] The spatiotemporal dependencies can be determined using a spatiotemporal graph model based on a node feature matrix, a pre-trained node embedding matrix, and a pre-trained temporal embedding matrix. The spatiotemporal graph model can be a graph convolutional neural network, such as a spatiotemporal synchronized graph convolutional network (STSGCN).
[0038] In some optional implementations of this embodiment, the spatiotemporal dependency is determined based on the node feature matrix, the pre-trained node embedding matrix and the pre-trained time embedding matrix, including: determining the self-learning matrix by calculating the inner product of the node embedding matrix; determining the trend factor based on the time embedding matrix by performing matrix multiplication; determining the periodic discriminant function matrix by calculating the nonlinear transformation of the inner product of the node feature matrix; and determining the spatiotemporal dependency based on the self-learning matrix, the trend factor and the periodic discriminant function matrix.
[0039] like Figure 4 As shown in the figure, this framework is divided into several key parts: a time-aware traffic flow prediction basic model, a time-aware spatiotemporal dependency reconstruction module, and a model training aggregation process.
[0040] The time-aware traffic flow prediction basic model can be divided into two parts: a time-aware graph structure learning module and a graph convolution-based gated recurrent unit (GCGRU).
[0041] Time-aware graph structure learning module. It combines self-learning graph construction, temporal representation, and periodicity discrimination to effectively capture time-varying spatiotemporal dependencies within graph structures.
[0042] first, represents the node embedding matrix, represents the time embedding matrix, represents the node feature matrix, and are all learnable and can be learned through the model training process shown in process 300. The self-learning matrix is used Indicated by Scalar obtained by matrix multiplication Represents the trend factor, and the period discriminant function matrix is used Represents. Function Is the sigmoid activation function, operation represents the Hadamard product, parameter is a saturation factor that adjusts the impact of periodic effects on the current spatial correlation. In the basic model, the calculation process of spatiotemporal dependence is as follows:
[0043] Among them, the self-learning matrix The similarity between nodes is captured by computing the inner product of the node embedding matrix. By embedding the time matrix Perform matrix multiplication to enhance the perception of time. By calculating the inner product of the node feature matrix and applying nonlinear transformation, the association between the node features is preserved. Finally, by comprehensively considering the above factors, we can get Represents the spatiotemporal dependency of nodes in the spatiotemporal graph, that is, the connection relationship between any two nodes.
[0044] Step 203: Send the spatiotemporal dependency relationship to the server, and receive the aggregated spatiotemporal dependency relationship returned by the server.
[0045] In this embodiment, each client sends the locally calculated spatiotemporal dependency to the server, which aggregates the spatiotemporal dependencies from different clients to obtain an aggregated spatiotemporal dependency, and then sends the aggregated spatiotemporal dependency to each client.
[0046] The spatiotemporal dependencies from different clients can be aggregated using the federated averaging algorithm.
[0047] Step 204 : Determine the future traffic flow using a pre-trained prediction model based on the aggregated spatiotemporal dependencies.
[0048] In this embodiment, the prediction model may be a neural network, such as a gated recurrent unit (GRU), a graph convolutional gated recurrent unit (GCGRU), or the like.
[0049] By replacing the linear layer in the traditional GRU and introducing the time-aware graph structure learning module, the graph convolution gated recurrent unit GCGRU can be expressed as:
[0050] Here, represents the adjacency matrix normalized by softmax, The node embedding matrix and the time embedding matrix are concatenated and combined to represent the node. Symbol and They correspond to the update gate, reset gate, and candidate state in GRU respectively. Each gate contains both the previous hidden state and the current input, and has learnable parameters. Represent the weight matrix and Respectively represent the offset.
[0051] The prediction model outputs the traffic flow sequence for a period of time in the future.
[0052] The methods provided by the above-described embodiments of the present disclosure effectively capture spatiotemporal dependencies between and within clients while protecting data privacy. By integrating temporal difference learning and periodic discriminant functions, the present disclosure is able to model the time-varying spatial and temporal dependencies inherent in urban transportation networks, overcoming the limitations of existing federated learning-based graph models, which rely on static representations of spatiotemporal dependencies.
[0053] In some optional implementations of this embodiment, the spatiotemporal dependencies are sent to a server, and the aggregated spatiotemporal dependencies returned by the server are received, including: reconstructing the spatiotemporal dependencies to obtain a first dependency associated with a node embedding matrix and a second dependency associated with a node feature matrix; sending the first dependency and the second dependency to the server, and receiving the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency returned by the server, wherein the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency are obtained by the server aggregating the first dependencies and the second dependencies from different clients respectively; and restoring the aggregated spatiotemporal dependency based on the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency.
[0054] In the context of federated learning, the node embedding matrix and node feature matrix Distributed across multiple clients, this makes it difficult to learn time-varying spatial and temporal dependencies across clients without directly sharing the data. and Expressed as , the output component of GRU is represented as ,gather represents a non-overlapping set of clients. In this setting, the node embedding matrix Divided into , node feature matrix Partitioned into , the input component of GRU Divided into , and the output component of GRU Divided into .also, Also partitioned into:
[0055] From a single client From this perspective, the computations within a gate unit can be combined into the following general form:
[0056] Among them, Activate (·) represents the activation function, Represents the client during model training The spatiotemporal dependence of the required time variation. Substituting the above basic model into it, we get the following formula:
[0057] This formula shows that learning time-varying spatiotemporal dependencies requires using and The node embedding matrix and node feature matrix of , so the first dependency relationship associated with the node embedding matrix (referred to as the P part) and the second dependency relationship associated with the node feature matrix (referred to as the Q part) can be disassembled.
[0058] In the federated learning setting, data cannot be shared between clients, which limits the learning process. Therefore, the following algorithm flow is executed.
[0059]
[0060] Table 2 Spatiotemporal dependency reconstruction algorithm
[0061] In some optional implementations of this embodiment, the spatiotemporal dependency relationship is reconstructed to obtain a first dependency relationship associated with the node embedding matrix and a second dependency relationship associated with the node feature matrix, including: transforming the node feature matrix in the spatiotemporal dependency relationship based on a polynomial approximation algorithm to obtain a first dependency relationship associated with the node embedding matrix and a second dependency relationship associated with the node feature matrix.
[0062] The following is a further detailed explanation based on Table 2. First, the client performs a local transformation of the node feature matrix. This paper introduces a transformation method based on the principle of polynomial approximation, which simplifies the nonlinear calculation process involving the feature vector.
[0063]
[0064] in, represents the order of the polynomial, represents the coefficients of the polynomial expansion, Represents the node features at time t Transformation of . Operator By using the Converts the matrix dimensions by a Cartesian power.
[0065] Then, substituting the above transformation into , we get the following form:
[0066] in represent Part of the calculation, represent Part of the calculation.
[0067] against Part, each client Perform calculations locally , and then sends the result to the server. The server returns the following calculation results to each client:
[0068] After each client gets the aggregation results, it further performs local calculations The client obtains the calculation result of part Q according to the following principle:
[0069] against Each client first executes locally The server performs the following aggregation operations and then returns them to the client:
[0070] Therefore, further calculations are performed locally get:
[0071] Afterwards, and The complete , the formula is as follows:
[0072] Finally, the calculated complete Integrate and substitute into the GRU calculation process to complete the local model prediction process.
[0073]
[0074] in, These are all learnable parameters of the client.
[0075] Continue to see Figure 3 , which shows a process 300 of an embodiment of a model training method. The process 300 of the model training method includes the following steps: Step 301: Obtain training samples, an initial node embedding matrix, and an initial time embedding matrix.
[0076] In this embodiment, the training sample includes the traffic flow of the first time period and the traffic flow of the second time period, and the second time period is the adjacent time period after the first time period. For example, the traffic flow on Monday is used as the traffic flow of the first time period, and the traffic flow on Tuesday is used as the traffic flow of the second time period.
[0077] The initial node embedding matrix is a randomly initialized vector, which is a representation vector of the node. As many such vectors are initialized as there are nodes. The embedding vectors of all nodes will form an embedding matrix, which will be updated during the training process until it can well represent a node.
[0078] The initial time embedding matrix is a randomly initialized time vector, which is also updated during the learning process and ultimately represents the relationship between time well.
[0079] Step 302: Generate a node feature matrix of a spatiotemporal graph based on the traffic flow in the first time period; Step 303: determining the spatiotemporal dependency relationship based on the node feature matrix, the initial node embedding matrix, and the initial time embedding matrix; Step 304: Send the spatiotemporal dependency relationship to the server, and receive the aggregated spatiotemporal dependency relationship returned by the server.
[0080] Step 305, determining a traffic flow prediction value through a prediction model based on the aggregated spatiotemporal dependency; Steps 302-305 are substantially the same as steps 201-204 and therefore will not be described in detail.
[0081] The following is a detailed description of the execution process of the model training method in conjunction with Table 3.
[0082]
[0083] Table 3 Model training method
[0084] This paper provides a federated graph spatiotemporal fusion framework that aims to achieve efficient traffic flow prediction through a federated learning mechanism. The framework first initializes the global model weights, including the weight matrix , bias , polynomial coefficients and the time embedding matrix . Subsequently, each client In parallel, use its personalized node embedding matrix Initialize. In the global round In , each client receives the global model weights from the server to update its local model weights Then, in the local round In [1], the client performs time-aware spatiotemporal modeling, aggregates the spatiotemporal dependencies between clients according to a specific equation, and updates the local model weights using gradient descent. After the update is complete, the client sends its local model weights to the server. The server aggregates the received client model weights by executing the FedAvg (federated average) algorithm to update the global model weights. Finally, each client obtains its trained model weights. Through this algorithm framework, the present disclosure achieves accurate prediction of traffic flow while protecting client data privacy.
[0085] Step 306 : adjusting the network parameters, node embedding matrix, and time embedding matrix of the prediction model based on the difference between the traffic flow prediction value and the traffic flow in the second time period.
[0086] In this embodiment, if Figure 4 As shown, the traffic flow in the second time period is { , ,…, }, is the predicted time period. The traffic flow prediction value is { , ,…, A root mean square error loss function can be used to calculate the loss value based on the difference between the traffic flow prediction value and the traffic flow in the second time period. Other loss functions can also be used, and are not limited here. The network parameters, node embedding matrix, and time embedding matrix of the prediction model are adjusted based on the gradient descent method until the loss value converges to a minimum value or a predetermined number of iterations is reached.
[0087] This paper addresses key challenges in traffic flow prediction by proposing a novel federated graph learning framework. While protecting data privacy, this paper effectively captures spatiotemporal dependencies between and within clients. By integrating temporal difference learning and periodic discriminant functions, this paper is able to model the time-varying spatial and temporal dependencies inherent in urban traffic networks, overcoming the limitations of existing federated learning-based graph models, which rely on static representations of spatial dependencies. Furthermore, the proposed polynomial-based nonlinear function decomposition mechanism further reduces computational requirements across clients and ensures privacy throughout the learning process.
[0088] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a traffic flow prediction device based on federated spatiotemporal graph learning. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0089] like Figure 5 As shown, the traffic flow prediction device 500 based on federated spatiotemporal graph learning of this embodiment includes: a first generation unit 501, a first determination unit 502, a first aggregation unit 503, and a first prediction unit 504. The first generation unit 501 is configured to generate a node feature matrix of the spatiotemporal graph based on the historical traffic flow stored in the local client; the first determination unit 502 is configured to determine the spatiotemporal dependency based on the node feature matrix, a pre-trained node embedding matrix, and a pre-trained time embedding matrix; the first aggregation unit 503 is configured to send the spatiotemporal dependency to the server and receive the aggregated spatiotemporal dependency returned by the server, wherein the aggregated spatiotemporal dependency is obtained by the server aggregating the spatiotemporal dependencies from different clients; and the first prediction unit 504 is configured to determine the future traffic flow using a pre-trained prediction model based on the aggregated spatiotemporal dependency.
[0090] In this embodiment, the specific processing of the first generation unit 501, the first determination unit 502, the first aggregation unit 503 and the first prediction unit 504 of the traffic flow prediction device 500 based on federated spatiotemporal graph learning can be referred to Figure 2This corresponds to step 201, step 202, step 203 and step 204 in the embodiment.
[0091] In some optional implementations of this embodiment, the first determination unit 502 is further configured to: determine the self-learning matrix by calculating the inner product of the node embedding matrix; determine the trend factor by performing matrix multiplication based on the time embedding matrix; determine the periodic discriminant function matrix by calculating the nonlinear transformation of the inner product of the node feature matrix; determine the spatiotemporal dependency relationship based on the self-learning matrix, the trend factor and the periodic discriminant function matrix.
[0092] In some optional implementations of this embodiment, the first aggregation unit 503 is further configured to: reconstruct the spatiotemporal dependency to obtain a first dependency associated with the node embedding matrix and a second dependency associated with the node feature matrix; send the first dependency and the second dependency to the server, and receive the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency returned by the server, wherein the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency are obtained by the server aggregating the first dependencies and the second dependencies from different clients respectively; and restore the aggregated spatiotemporal dependency based on the first aggregated spatiotemporal dependency and the second aggregated spatiotemporal dependency.
[0093] In some optional implementations of this embodiment, the first aggregation unit 503 is further configured to: transform the node feature matrix in the spatiotemporal dependency relationship based on a polynomial approximation algorithm to obtain a first dependency relationship associated with the node embedding matrix and a second dependency relationship associated with the node feature matrix.
[0094] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a model training device. Figure 3 Corresponding to the method embodiment shown, the model training device can be specifically applied to various electronic devices.
[0095] like Figure 6As shown, the model training device 600 of this embodiment includes: an acquisition unit 601, a second generation unit 602, a second determination unit 603, a second aggregation unit 604, a second prediction unit 605 and an adjustment unit 606. Among them, the acquisition unit 601 is configured to acquire training samples, an initial node embedding matrix and an initial time embedding matrix, wherein the training samples include traffic flow in a first time period and traffic flow in a second time period, and the second time period is an adjacent time period after the first time period; the second generation unit 602 is configured to generate a node feature matrix of the spatiotemporal graph based on the traffic flow in the first time period; the second determination unit 603 is configured to determine the spatiotemporal dependency based on the node feature matrix, the initial node embedding matrix and the initial time embedding matrix; the second aggregation unit 604 is configured to send the spatiotemporal dependency to the server and receive the aggregated spatiotemporal dependency returned by the server, wherein the aggregated spatiotemporal dependency is obtained by the server aggregating the spatiotemporal dependencies from different clients; the second prediction unit 605 is configured to determine the traffic flow prediction value through the prediction model based on the aggregated spatiotemporal dependency; the adjustment unit 606 is configured to adjust the network parameters, node embedding matrix and time embedding matrix of the prediction model based on the difference between the traffic flow prediction value and the traffic flow in the second time period.
[0096] In this embodiment, the specific processing of the acquisition unit 601, the second generation unit 602, the second determination unit 603, the second aggregation unit 604, the second prediction unit 605 and the adjustment unit 606 of the model training device 600 can be referred to. Figure 3 This corresponds to steps 301-306 in the embodiment.
[0097] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, and storage of user personal information involved in the technical solutions disclosed herein all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken with respect to user personal information to prevent unauthorized access to user personal information data and to safeguard the security of user personal information, network security, and national security.
[0098] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device and a readable storage medium.
[0099] An electronic device comprises: one or more processors; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processors, the one or more processors implement the method described in process 200 or 300.
[0100] A computer-readable medium stores a computer program, wherein the computer program implements the method described in process 200 or 300 when executed by a processor.
[0101] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0102] like Figure 7 As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. RAM 703 may also store various programs and data required for the operation of device 700. Computing unit 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to bus 704.
[0103] Various components in device 700 are connected to I / O interface 705, including an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0104] The computing unit 701 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as the road zone planning method. For example, in some embodiments, the road zone planning method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed onto the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the road zone planning method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the road zone planning method via any other suitable means (e.g., via firmware).
[0105] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0106] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0107] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0108] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0109] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0110] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a server in a distributed system or a server integrated with blockchain. The server may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. The server may be a server in a distributed system or a server integrated with blockchain. The server may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
[0111] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.
[0112] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A traffic flow prediction method based on federated spatiotemporal graph learning, comprising: Generate node feature matrix of spatiotemporal graph based on historical traffic flow stored in local client; Determining spatiotemporal dependencies based on the node feature matrix, the pre-trained node embedding matrix, and the pre-trained time embedding matrix; Sending the spatiotemporal dependency relationship to a server, and receiving an aggregated spatiotemporal dependency relationship returned by the server, wherein the aggregated spatiotemporal dependency relationship is obtained by the server aggregating spatiotemporal dependency relationships from different clients; The future traffic flow is determined by a pre-trained prediction model based on the aggregated spatiotemporal dependencies.
2. The method according to claim 1, wherein The determining of the spatiotemporal dependency relationship based on the node feature matrix, the pre-trained node embedding matrix, and the pre-trained time embedding matrix includes: Determining a self-learning matrix by calculating the inner product of the node embedding matrix; Determine a trend factor by performing matrix multiplication based on the time embedding matrix; Determine a periodic discriminant function matrix by calculating a nonlinear transformation of the inner product of the node feature matrix; A spatiotemporal dependency relationship is determined based on the self-learning matrix, the trend factor, and the periodic discriminant function matrix.
3. The method according to claim 1, wherein The sending of the spatiotemporal dependency relationship to a server and receiving an aggregated spatiotemporal dependency relationship returned by the server includes: Reconstructing the spatiotemporal dependency relationship to obtain a first dependency relationship associated with the node embedding matrix and a second dependency relationship associated with the node feature matrix; Sending the first dependency relationship and the second dependency relationship to a server, and receiving a first aggregated spatiotemporal dependency relationship and a second aggregated spatiotemporal dependency relationship returned by the server, wherein the first aggregated spatiotemporal dependency relationship and the second aggregated spatiotemporal dependency relationship are obtained by the server by aggregating the first dependency relationships and the second dependency relationships from different clients respectively; An aggregated spatiotemporal dependency relationship is restored based on the first aggregated spatiotemporal dependency relationship and the second aggregated spatiotemporal dependency relationship.
4. The method according to claim 3, wherein: The reconstructing the spatiotemporal dependency relationship to obtain a first dependency relationship associated with the node embedding matrix and a second dependency relationship associated with the node feature matrix includes: The node feature matrix in the spatiotemporal dependency relationship is transformed based on a polynomial approximation algorithm to obtain a first dependency relationship associated with the node embedding matrix and a second dependency relationship associated with the node feature matrix.
5. A model training method comprising: Obtaining a training sample, an initial node embedding matrix, and an initial time embedding matrix, wherein the training sample includes traffic flow in a first time period and traffic flow in a second time period, where the second time period is an adjacent time period after the first time period; generating a node feature matrix of a spatiotemporal graph based on the traffic flow in the first time period; Determining spatiotemporal dependencies based on the node feature matrix, the initial node embedding matrix, and the initial time embedding matrix; Sending the spatiotemporal dependency relationship to a server, and receiving an aggregated spatiotemporal dependency relationship returned by the server, wherein the aggregated spatiotemporal dependency relationship is obtained by the server aggregating spatiotemporal dependency relationships from different clients; Determining a traffic flow prediction value through a prediction model based on the aggregated spatiotemporal dependency; The network parameters of the prediction model, the node embedding matrix, and the time embedding matrix are adjusted based on the difference between the traffic flow prediction value and the traffic flow in the second time period.
6. A traffic flow prediction device based on federated spatiotemporal graph learning, comprising: A first generating unit is configured to generate a node feature matrix of a spatiotemporal graph based on historical traffic flows stored in a local client; a first determining unit configured to determine a spatiotemporal dependency relationship based on the node feature matrix, a pre-trained node embedding matrix, and a pre-trained time embedding matrix; A first aggregation unit is configured to send the spatiotemporal dependency relationship to a server and receive an aggregated spatiotemporal dependency relationship returned by the server, wherein the aggregated spatiotemporal dependency relationship is obtained by the server aggregating spatiotemporal dependency relationships from different clients; The first prediction unit is configured to determine the future traffic flow through a pre-trained prediction model based on the aggregated spatiotemporal dependency.
7. A model training device comprising: an acquisition unit configured to acquire a training sample, an initial node embedding matrix, and an initial time embedding matrix, wherein the training sample includes traffic flow in a first time period and traffic flow in a second time period, the second time period being an adjacent time period after the first time period; a second generating unit configured to generate a node feature matrix of a spatiotemporal graph based on the traffic flow in the first time period; a second determining unit configured to determine a spatiotemporal dependency relationship based on the node feature matrix, the initial node embedding matrix, and the initial time embedding matrix; a second aggregation unit configured to send the spatiotemporal dependency relationship to a server and receive an aggregated spatiotemporal dependency relationship returned by the server, wherein the aggregated spatiotemporal dependency relationship is obtained by the server aggregating spatiotemporal dependency relationships from different clients; a second prediction unit configured to determine a traffic flow prediction value through a prediction model based on the aggregated spatiotemporal dependency; An adjustment unit is configured to adjust the network parameters of the prediction model, the node embedding matrix, and the time embedding matrix based on the difference between the traffic flow prediction value and the traffic flow in the second time period.
8. An electronic device comprising: one or more processors; a storage device having one or more computer programs stored thereon, When the one or more computer programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer-readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Cited By
Federal learning-based dynamic space-time diagram traffic flow prediction method and related device
CN121904994A