A OD traffic flow matrix prediction method and system
Through the CDGCN model, combined with continuous LSTM and Hawkes process, using graph convolutional neural network and multi-head attention mechanism, it solves the problem of difficult to capture spatiotemporal dependence in OD matrix prediction, and achieves more accurate traffic network dynamic modeling and OD traffic forecast.
Patent Information
- Application Number
- CN202410635741.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-05-22
AI Technical Summary
Existing OD matrix prediction methods are difficult to effectively capture the spatiotemporal dependence in transportation networks, especially when dealing with irregular-shaped areas and dense events, and the accuracy of spatiotemporal dependence modeling is not high.
The OD traffic flow matrix prediction model (CDGCN) based on continuous dynamics is used to adjust the adjacency matrix of the traffic flow sequence through continuous LSTM and Hawkes process, and uses the graph convolutional neural network for convolution processing, combined with the multi-head attention mechanism to calculate the nodes The attention weights between them generate the final OD traffic flow matrix.
It improves the spatiotemporal dependence modeling accuracy of OD matrix prediction, can better capture the dynamics of the traffic network and the impact of historical events on current traffic flow, and solves the problems of coarse-grained and separate establishment of spatiotemporal dependence modeling.
Smart Images

Figure CN118228894B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of OD matrix prediction, and in particular to an OD traffic flow matrix prediction method and system. Background Art
[0002] Origin-destination matrix (OD) matrix prediction refers to predicting the traffic flow matrix between a certain place and other places in the next time period based on historical OD data (e.g., taxi order data, subway order data). The OD matrix provides information on the traffic pattern or traffic demand from one place (origin) to another place (destination). The OD matrix can help decision makers understand the travel patterns, traffic demand and utilization of the transportation network between different regions. It is very important for transportation planning, traffic management, transportation models and market research. However, since each node pair has a time series, OD matrix prediction is a unique and challenging task.
[0003] The prior art provides the following solutions:
[0004] GEML: Inspired by modeling on graphs and graph convolution, the origin-destination records of passengers associated with geographic areas are represented in a graph, where nodes represent geographic areas (defined as grids), links between nodes represent the existence of passenger demand, and weights on links represent the number of orders. Using the defined grid, the OD matrix for a given time slot can be constructed. It considers two types of neighbors, which are geographical neighbors and semantic neighbors based on whether the two grids are geographically close or connected by passenger demand. The former is used to measure the intrinsic closeness between the grid and its neighbors, while the semantic neighbors are used to describe the semantic strength of the business flow between the source and destination nodes in the grid network. The aggregation function defined in the graph convolutional network is then used to capture the information flow from neighbors to nodes.
[0005] CMOD: A new continuous-time and multi-level dynamic graph representation learning framework is proposed. The framework maintains a continuously updated node memory, which is used to compress and save historical transaction information to represent the vector of node state. In each prediction process, the previous memory is used as input and updated according to the newly occurred transactions. In particular, the newly occurred transactions are first utilized to generate messages and update the station-level node memory. Then, the station-level messages are projected to the cluster level and region level through the relations between them to update the corresponding memories. Finally, the updated multi-level memories are fused for the final prediction, and they also serve as the context for the next prediction.
[0006] HMOD: A hierarchical memory dynamic graph representation learning framework is proposed. First, a hierarchical memory updater is designed to integrate continuous time information and multi-level discrete time information. The updater avoids the limitation of time information loss in previous discrete time methods. At the same time, the memory is continuously updated through a message passing mechanism to achieve dynamic node representation, and a message fusion mechanism is provided to integrate hierarchical memories. Secondly, a spatiotemporal propagation module is designed to aggregate neighbor node representations. Based on real-time requirements, this module regards the origin and destination as two different semantic entities, which can effectively exploit the similarity relationship between the origins instead of the mixed relationship between the origins and the destinations.
[0007] However, the above existing solutions have the following defects:
[0008] GEML divides an area into regularly shaped grids and uses convolutional neural networks to capture their spatial dependencies, but in many cases, OD requirements are associated with irregularly shaped areas on the network. Although these methods can handle both spatial dependencies and temporal dynamics, the requirement of the grid limits their application. At the same time, it abstracts the traffic network into a series of snapshots based on predefined intervals. The problem is the coarse-grained representation generated by the predefined intervals. If an event occurs in the middle of two snapshots, the impact of such events on traffic may not be captured. Obviously, reducing the size of the interval can increase the number of snapshots and reduce the temporal granularity. However, in this case, the computational cost will increase linearly with the size of the interval.
[0009] CMOD and HMOD treat edges in dynamic graphs as flow time-stamped events, updating node representations when events involving nodes occur. Although this architecture can handle temporal dependencies and maintain trend information, these studies lack components to handle challenges in traffic, including implicit spatial dependencies and more dense events. Summary of the invention
[0010] The main purpose of the present invention is to provide an OD traffic flow matrix prediction method and system to solve the above problems.
[0011] To achieve the above object, the present invention provides an OD traffic flow matrix prediction method, the method comprising the following steps:
[0012] S1: Acquire historical traffic order data, process the historical traffic order data, and obtain a node traffic flow sequence;
[0013] S2: Based on the node traffic flow sequence, define the initial adjacency matrix of the traffic flow sequence and use continuous LSTM and Hawkes process to adjust the strength to obtain the target adjacency matrix, use graph convolutional neural network to convolve the target adjacency matrix and the node traffic flow sequence, and generate the final representation of the node based on the convolution processing result and time period information;
[0014] S3: Calculate the similarity between nodes to obtain the attention weights between nodes, and perform multi-head attention calculation on each node based on the attention weights;
[0015] S4: According to the multi-head attention calculation results, the final representations of nodes are concatenated as the edges of nodes to obtain the od traffic flow matrix.
[0016] Optionally, step S1: obtaining historical traffic order data, processing the historical traffic order data, and obtaining a node traffic flow sequence, specifically includes:
[0017] S11: Get historical traffic order data , using the time window to divide the historical traffic order data into an od matrix sequence ;in, ;
[0018] S12: Calculate the row sum and column sum of the obtained od matrix sequence, and add the row sum result and column sum result to obtain the node traffic flow sequence ;in, .
[0019] Optionally, in step S12: the expressions for obtaining the row sum and column sum of the obtained od matrix sequence are specifically:
[0020] ;
[0021] ;
[0022] in, In order to seek action and results, To find the column and result.
[0023] Optionally, step S2: based on the node traffic flow sequence, define the initial adjacency matrix of the traffic flow sequence and use continuous LSTM and Hawkes process to adjust the intensity to obtain the target adjacency matrix, use graph convolutional neural network to convolve the target adjacency matrix and the node traffic flow sequence, and generate the final representation of the node based on the convolution processing result and time period information, specifically including:
[0024] S21: Define the traffic flow sequences of vertices i and j at a given time t as follows: , get the initial adjacency matrix ;
[0025] S22: Using continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix ;
[0026] S23: Using graph convolutional neural network to map the target adjacency matrix and node traffic flow sequence Perform convolution processing to obtain the convolution processing result ;
[0027] S24: Based on the convolution processing results and time period information , generating the final representation of the node .
[0028] Optionally, in step S21, the initial adjacency matrix The expression is:
[0029] ;
[0030] in, represents the inverse of the distance matrix, Represents the similarity function.
[0031] Optionally, the step S22 specifically includes:
[0032] S221: Define adjustment event types; wherein the adjustment events include correlation enhancement, correlation weakening, and unchanged correlation strength. The definition expression of the adjustment event type is specifically:
[0033] ;
[0034] in, is the threshold that controls event sparsity, Indicates related enhancement, Indicates that the correlation is weakened. Indicates that the strength of association remains unchanged. represents the OD demand from node i to node j in the OD matrix at time t;
[0035] S222: Use Hawkes process to determine at event t The type k on the adjustment event is defined as:
[0036] ;
[0037] in, is the basic intensity of type k events, is the impact of type l event on type k event. Type l event is a general term for all types of events in historical traffic data. To simulate the exponential decay function of the impact of past events on current events, represents the decay rate of the impact of historical type l events on type k events, t represents the time when the current type k event occurs, Indicates the time when a historical l type event occurs;
[0038] S223: Using continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix, whose expression is as follows:
[0039] ;
[0040] in, is the target adjacency matrix, are learnable parameters.
[0041] Optionally, in step S23, the convolution processing result The expression is:
[0042] ;
[0043] in, is the result of convolution processing, GCN (·) is the graph convolutional neural network, and They represent the target adjacency matrix and node traffic flow sequence in the convolution process respectively;
[0044] In step S24, the final representation of the node The expression is:
[0045] ;
[0046] ;
[0047] ;
[0048] ;
[0049] ;
[0050] ;
[0051] ;
[0052] in, Pointing to the connection of quantity, It is the time representation within the time window, that is, the sum of the order time of the transaction records within the time window, D is the defined daily cycle time constant, and W is the defined weekly cycle time constant.
[0053] Optionally, the step S3: calculating the similarity between nodes to obtain the attention weights between the nodes, and performing multi-head attention calculation on each node based on the attention weights, specifically includes:
[0054] S31: For a given node u and its corresponding adjacent node set N(u), the node features are divided into three parts: query, key, and value, and the expression represented by them is obtained through linear transformation, specifically:
[0055] ;
[0056] ;
[0057] ;
[0058] in, is the node representation of the adjacent node set N(u) of node u, , , are three different learnable parameters;
[0059] S32: Perform multi-head attention calculation on each node. The expression is as follows:
[0060] ;
[0061] ;
[0062] ;
[0063] in, is the embedding vector representation of node u, is the intensity function obtained by Hawkes process, d is Dimension.
[0064] Optionally, in step S4, according to the multi-head attention calculation result, the final representation of the node and the node are concatenated as the expression of the edge of the node, specifically:
[0065] ;
[0066] in, are learnable parameters.
[0067] In addition, in order to achieve the above-mentioned purpose, the present invention also provides an OD traffic flow matrix prediction system, the system comprising:
[0068] An input module, used to obtain historical traffic order data, process the historical traffic order data, and obtain a node traffic flow sequence;
[0069] A continuous spatiotemporal dependency modeling module, which is used to define an initial adjacency matrix of the traffic flow sequence based on the node traffic flow sequence and use continuous LSTM and Hawkes process to perform intensity adjustment to obtain a target adjacency matrix, use a graph convolutional neural network to perform convolution processing on the target adjacency matrix and the node traffic flow sequence, and generate a final representation of the node based on the convolution processing result and time period information;
[0070] A multi-head attention mechanism module is used to calculate the similarity between nodes to obtain the attention weights between nodes, and perform multi-head attention calculation on each node based on the attention weights;
[0071] The fusion module is used to splice the final representations of nodes as the edges of nodes according to the multi-head attention calculation results to obtain the OD traffic flow matrix.
[0072] The beneficial effects of the present invention are as follows: a OD traffic flow matrix prediction method and system are proposed, by proposing an OD traffic flow matrix prediction model (CDGCN) based on a continuous dynamic method, the network is regarded as a continuous dynamic network, a continuous modeling method is used to model the network dynamics, and a coupling method is used to model the spatiotemporal dependency, so that CDGCN has better prediction performance than current research, solves the problem that the previous prediction of the departure-destination matrix is coarse-grained in time granularity and the spatiotemporal dependency is established separately, can well model the dynamics of the traffic network, accurately capture the impact of historical events on the current traffic flow, effectively solves the problem of low accuracy in spatiotemporal dependency modeling, and also increases the capture of the dynamics of the traffic network. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 Schematic diagram of the flow chart of the traffic flow matrix prediction method according to an embodiment of the present invention;
[0074] Figure 2 FIG. 4 is a schematic diagram of the structure of the OD traffic flow matrix prediction system according to an embodiment of the present invention.
[0075] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0076] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0077] The embodiment of the present invention provides an od traffic flow matrix prediction method, referring to Figure 1 , Figure 1 It is a flow chart of an embodiment of the OD traffic flow matrix prediction method of the present invention.
[0078] In this embodiment, the OD traffic flow matrix prediction method includes the following steps:
[0079] S1: Acquire historical traffic order data, process the historical traffic order data, and obtain a node traffic flow sequence;
[0080] S2: Based on the node traffic flow sequence, define the initial adjacency matrix of the traffic flow sequence and use continuous LSTM and Hawkes process to adjust the strength to obtain the target adjacency matrix, use graph convolutional neural network to convolve the target adjacency matrix and the node traffic flow sequence, and generate the final representation of the node based on the convolution processing result and time period information;
[0081] S3: Calculate the similarity between nodes to obtain the attention weights between nodes, and perform multi-head attention calculation on each node based on the attention weights;
[0082] S4: According to the multi-head attention calculation results, the final representations of nodes are concatenated as the edges of nodes to obtain the od traffic flow matrix.
[0083] In a preferred embodiment, step S1: obtaining historical traffic order data, processing the historical traffic order data, and obtaining a node traffic flow sequence specifically includes:
[0084] S11: Get historical traffic order data , using the time window to divide the historical traffic order data into an od matrix sequence ;in, ;
[0085] S12: Calculate the row sum and column sum of the obtained od matrix sequence, and add the row sum result and column sum result to obtain the node traffic flow sequence ;in, .
[0086] In a preferred embodiment, in step S12: the obtained od matrix sequence is subjected to row sum and column sum expressions, specifically:
[0087] ;
[0088] ;
[0089] in, In order to seek action and results, To find the column and result.
[0090] In a preferred embodiment, step S2: based on the node traffic flow sequence, define the initial adjacency matrix of the traffic flow sequence and use continuous LSTM and Hawkes process to adjust the strength, obtain the target adjacency matrix, use graph convolutional neural network to convolve the target adjacency matrix and the node traffic flow sequence, and generate the final representation of the node based on the convolution processing result and time period information, specifically including:
[0091] S21: Define the traffic flow sequences of vertices i and j at a given time t as follows: , get the initial adjacency matrix ;
[0092] S22: Using continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix ;
[0093] S23: Using graph convolutional neural network to map the target adjacency matrix and node traffic flow sequence Perform convolution processing to obtain the convolution processing result ;
[0094] S24: Based on the convolution processing results and time period information , generating the final representation of the node .
[0095] In a preferred embodiment, in step S21, the initial adjacency matrix The expression is:
[0096] ;
[0097] in, represents the inverse of the distance matrix, Represents the similarity function.
[0098] In a preferred embodiment, the step S22 specifically includes:
[0099] S221: Define adjustment event types; wherein the adjustment events include correlation enhancement, correlation weakening, and unchanged correlation strength. The definition expression of the adjustment event type is specifically:
[0100] ;
[0101] in, is the threshold that controls event sparsity, Indicates related enhancement, Indicates that the correlation is weakened. Indicates that the strength of association remains unchanged. represents the OD demand from node i to node j in the OD matrix at time t;
[0102] S222: Use Hawkes process to determine at event t The type k on the adjustment event is defined as:
[0103] ;
[0104] in, is the basic intensity of type k events, is the impact of type l event on type k event. Type l event is a general term for all types of events in historical traffic data. To simulate the exponential decay function of the impact of past events on current events, represents the decay rate of the impact of historical type l events on type k events, t represents the time when the current type k event occurs, Indicates the time when a historical l type event occurs;
[0105] S223: Using continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix, whose expression is as follows:
[0106] ;
[0107] in, is the target adjacency matrix, are learnable parameters.
[0108] In a preferred embodiment, in step S23, the convolution processing result The expression is:
[0109] ;
[0110] in, is the result of convolution processing, GCN (·) is the graph convolutional neural network, and They represent the target adjacency matrix and node traffic flow sequence in the convolution process respectively;
[0111] In step S24, the final representation of the node The expression is:
[0112] ;
[0113] ;
[0114] ;
[0115] ;
[0116] ;
[0117] ;
[0118] ;
[0119] in, Pointing to the connection of quantity, It is the time representation within the time window, that is, the sum of the order time of the transaction records within the time window, D is the defined daily cycle time constant, and W is the defined weekly cycle time constant.
[0120] In a preferred embodiment, the step S3: calculating the similarity between nodes to obtain the attention weights between nodes, and performing multi-head attention calculation on each node based on the attention weights, specifically includes:
[0121] S31: For a given node u and its corresponding adjacent node set N(u), the node features are divided into three parts: query, key, and value, and the expression represented by them is obtained through linear transformation, specifically:
[0122] ;
[0123] ;
[0124] ;
[0125] in, is the node representation of the adjacent node set N(u) of node u, , , are three different learnable parameters;
[0126] S32: Perform multi-head attention calculation on each node. The expression is as follows:
[0127] ;
[0128] ;
[0129] ;
[0130] in, is the embedding vector representation of node u, is the intensity function obtained by Hawkes process, and d is Dimension.
[0131] In a preferred embodiment, in step S4, according to the multi-head attention calculation results, the final representations of the nodes are concatenated as the edge expressions of the nodes, specifically:
[0132] ;
[0133] in, are learnable parameters.
[0134] like Figure 2 As shown, the embodiment of the present invention also proposes an OD traffic flow matrix prediction system, including:
[0135] An input module 10 is used to obtain historical traffic order data, process the historical traffic order data, and obtain a node traffic flow sequence;
[0136] A continuous spatiotemporal dependency modeling module 20, for defining an initial adjacency matrix of the traffic flow sequence based on the node traffic flow sequence and performing intensity adjustment using continuous LSTM and Hawkes process to obtain a target adjacency matrix, performing convolution processing on the target adjacency matrix and the node traffic flow sequence using a graph convolutional neural network, and generating a final representation of the node based on the convolution processing result and time period information;
[0137] A multi-head attention mechanism module 30, used to calculate the similarity between nodes to obtain the attention weights between nodes, and perform multi-head attention calculation on each node based on the attention weights;
[0138] The fusion module 40 is used to splice the final representations of nodes as the edges of the nodes according to the multi-head attention calculation results to obtain the OD traffic flow matrix.
[0139] Other embodiments or specific implementations of the OD traffic flow matrix prediction system of the present invention can refer to the above-mentioned method embodiments and will not be repeated here.
[0140] This embodiment proposes an OD traffic flow matrix prediction method and system. By proposing an OD traffic flow matrix prediction model (CDGCN) based on a continuous dynamic method, the network is regarded as a continuous dynamic network, a continuous modeling method is used to model the network dynamics, and a coupled method is used to model the spatiotemporal dependency. This makes CDGCN have better prediction performance than current research, and solves the problem that the previous prediction of the departure-destination matrix is coarse-grained in time granularity and the spatiotemporal dependency is established separately. It can well model the dynamics of the traffic network, accurately capture the impact of historical events on the current traffic flow, and effectively solve the problem of low accuracy in spatiotemporal dependency modeling, while also increasing the capture of the dynamics of the traffic network. As a result, the following beneficial technical effects can be achieved:
[0141] (1) The problem that the previous prediction of the departure-destination matrix was coarse-grained in time granularity and the spatiotemporal dependencies were established separately was solved. The method achieved fine-grained processing in time granularity, that is, the OD matrix was predicted based on events, and the spatiotemporal dependencies were established in a coupled manner.
[0142] (2) For the coarse granularity in time, a solution based on the neural Hawkes process is proposed. Unlike previous methods, this method no longer fixes the research and feature extraction on the static graph. Instead, it analyzes traffic events and combines deep learning with the neural Hawkes method to extract the impact of past traffic events on the current OD matrix. It can well model the dynamics of the traffic network and accurately capture the impact of historical events on current traffic flow;
[0143] (3) A coupled approach is used to capture the spatiotemporal dependencies in the traffic network. The spatial dependencies of the traffic network are captured using a graph neural network. While capturing the spatial dependencies, the temporal information is explicitly utilized, and the temporal information is incorporated into the modeling of spatial dependencies. This effectively solves the problem of low accuracy in spatiotemporal dependency modeling, while also increasing the capture of the dynamics of the traffic network.
[0144] In order to explain the present application more clearly, the application process of the OD traffic flow matrix prediction scheme in a specific example is provided below.
[0145] This specific example proposes a traffic flow matrix prediction model (CDGCN) based on a continuous dynamic method. The core idea of the overall framework of the CDGCN is to first capture the network dynamics of the traffic network, and then capture the spatiotemporal dependencies while capturing the node dynamics. Finally, with the help of the Multi-Head Attenetion mechanism in the Transformer, the degree of attention between nodes is dynamically adjusted to capture more accurate spatial dependencies. The model specifically includes four modules: input module (InputBlock), continuous spatiotemporal dependency modeling module (CSTDMB), multi-head attention module (MHA), and fusion module (FusionBlock). Specifically:
[0146] 1. For input module:
[0147] Given historical taxi order data , we can get the dynamic transaction graph , use the time window to divide E into an OD matrix sequence ,in, .
[0148] Then the obtained OD matrix sequence , and process the row and column sums:
[0149] ;
[0150] ;
[0151] Then add the row sum and column sum + , get the node traffic flow sequence ,in .
[0152] 2. For the continuous spatiotemporal dependency modeling module:
[0153] Continuous spatiotemporal dependency modeling module, including:
[0154] (1) Definition of adjacency matrix:
[0155] For a given time t, the traffic flow sequences of vertices i and j are defined as and , the adjacency matrix is expressed as follows:
[0156] ;
[0157] in represents the inverse of the distance matrix, Represents the similarity function, and the cosine similarity function is used in this paper. A relatively simple adjacency matrix definition method is adopted to solve the problem of excessive calculation of the adjacency matrix of continuous dynamic networks.
[0158] (2) Network dynamics modeling:
[0159] In order to reduce the amount of calculation, unlike most network dynamics modeling, which defines the continuous change of the topological structure of the traffic network as the adjustment event of the adjacency matrix, the adjustment event is directly defined by the difference of the OD matrix over time. It is assumed that there are three types of adjustment events on the OD matrix: correlation enhancement, correlation reduction, and unchanged correlation strength. The type of adjustment event at time t is defined as:
[0160] ;
[0161] in is the threshold that controls event sparsity. Indicates related enhancement, Indicates that the correlation is weakened. Indicates that the strength of association remains unchanged. The event flow on can be defined as:
[0162] ;
[0163] The Hawkes process is then used to simulate the impact of historical events on future events in the traffic network. According to the Hawkes process, at event t The intensity of a type k adjustment event on is defined as:
[0164] ;
[0165] in is the basic intensity of type k events, is the effect of type l events on type k events, It is an exponential decay function that simulates the impact of past events on current events.
[0166] Due to the limitations of the traditional Hawkes process, continuous LSTM is used to simulate the self-excitation phenomenon and relax the and The positive constraint of , allowing them to take real values. This is because historical adjustment events are believed to have both incentive and inhibitory effects on future events. Specifically, the intensity function simulated by continuous LSTM is defined as
[0167] ;
[0168] represents the LSTM model, Similar to the LSTM model , which is updated according to the memory cell c(t), Indicates learnable parameters. In the process of using cLSTM simulation, GCN is used to define the initial value of the hidden state, and the accuracy of cLSTM is enhanced by introducing graph neural network.
[0169] ;
[0170] in, represents the OD flow sequence of the node, Represents the initial adjacency matrix obtained in the above definition .
[0171] The memory unit c(t) is divided into two parts, the typical state and the steady state. The typical state is responsible for describing the intensity function being excited or suppressed or remaining unchanged due to the occurrence of a new event. At the same time, the impact value will decay to the steady state over time, and the decay rate can be learned by a delta function. Indicates a typical state, using Representing the steady state, the process function c(t) of the continuous-time LSTM state decaying over time is defined as:
[0172] ;
[0173] According to the continuous LSTM, , and The definition is as follows, where the softplus function to ensure a positive output, and Represents the activation function:
[0174] ;
[0175] ;
[0176] ;
[0177] ;
[0178] ;
[0179] ;
[0180] ;
[0181] Where x represents the input, parameter s is an optional scaling factor used to adjust the slope of the function, and W (·) , U(·) and d (·) These are all learnable parameters.
[0182] For a given historical adjustment event stream, the Hawkes process of the continuous LSTM is used to predict the adjacency matrix. Specifically, the adjacency matrix is defined as:
[0183] .
[0184] (3) Spatiotemporal dependency modeling:
[0185] Node dynamics refers to the process of updating node features over time, and this process needs to consider the dependencies between nodes. In order to capture node dynamics, GCN is used. The two main reasons for choosing GCN are: (1) GCN uses local neighbor information for convolution, which means that it can focus on the local neighbor relationship of each node. In actual traffic networks, the state and behavior of traffic nodes are usually closely related to their neighbor nodes. (2) The network receptive field can be increased by stacking GCN, and multi-layer information transmission can capture node dynamics at different scales. The specific operations are as follows:
[0186] ;
[0187] When capturing node dynamics, in order to more accurately capture the time dependency of the traffic network and to make full use of time information, Time2Vec is used to model the time dependency. The daily and weekly cycle information of the traffic network is captured in the Time2Vec method. Specifically, the order time of transaction records in a certain area within the time window is added as the time representation of the area within the time window:
[0188] ;
[0189] Then define the daily cycle time constant D=24*60*60 and the weekly cycle time constant W=7*24*60*60, and then calculate the daily cycle time information and weekly cycle time information of a certain area respectively. Specifically, divide the time cycle information into sin type and cos type, so that the correctness of the cycle information can be more accurately guaranteed.
[0190] ;
[0191] ;
[0192] ;
[0193] ;
[0194] ;
[0195] It refers to the connection of vectors. Then the node vector obtained by GCN and the time vector with extracted time period information are connected to get the final representation of the node:
[0196] .
[0197] 3. For the multi-head attention mechanism module:
[0198] In this part, the multi-head attention mechanism is used to analyze the spatiotemporal feature sequence under a certain time window. Perform dynamic weight allocation. The attention weights between nodes are obtained by calculating the similarity between nodes. This similarity calculation can be regarded as establishing associations between nodes in the graph. By performing multiple attention calculations on each node (i.e., multiple attention heads), each head can focus on different relevant information, thereby introducing diverse and multi-perspective representation learning. Through the parallel calculation of multiple attention heads, it can focus on the associations between different nodes, thereby extracting diverse spatial features and strengthening the modeling of the relationship between nodes, thereby improving the performance and representation of graph neural networks.
[0199] Specifically, for a given node u and its corresponding adjacent node set N(u), the node features are divided into three parts: query, key, and value, and their representations are obtained through linear transformation:
[0200] ;
[0201] ;
[0202] ;
[0203] in is the node representation of the adjacent node set N(u) of node u. Then the embedding vector of node u is expressed as:
[0204] ;
[0205] ;
[0206] Different from the usual Function, and also introduce the intensity function obtained by the neural Hawkes process into it, which can better capture the spatial dependence.
[0207] .
[0208] 4. For the fusion module:
[0209] The final representations of the two nodes are concatenated to represent the OD edge.
[0210] .
[0211] Therefore, the OD traffic flow matrix prediction solution proposed in this embodiment has the following advantages:
[0212] (1) Using Neural Hawkes Process to simulate the dynamics of traffic networks, where network dynamics are modeled as the impact of consecutive events on the adjacency matrix;
[0213] (2) We propose a framework that simultaneously models temporal and spatial dependencies. We use GCN to process the adjacency matrix obtained through NeuralHawkes Process to capture node representations. We then fuse the obtained temporal period features with the node representation to obtain the final node representation.
[0214] (3) The method proposed in this embodiment uses the OD traffic flow matrix prediction model based on the continuous dynamic method to solve the problem. First, the time information is explicitly used. The Time2Vec method is used to fully utilize the time information in the data to effectively capture the periodic characteristics of time, solving the problem of inaccurate capture of time dependence in previous studies; second, it solves the problem of excessive granularity in capturing traffic events in previous studies, no longer ignoring traffic events between time windows, and accurately capturing the impact of previous events to avoid traffic events being smoothed out by other events; third, the spatiotemporal dependency is established in a coupled manner, making the capture of spatiotemporal dependency more accurate.
[0215] It is understood that, in the description of this specification, the description with reference to the terms "one embodiment", "another embodiment", "other embodiments", or "first to Nth embodiments" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0216] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0217] The above are only preferred 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 specification 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 OD traffic flow matrix prediction method, characterized in that: The following steps are involved: S1: Acquire historical traffic order data, process the historical traffic order data, and obtain a node traffic flow sequence; S2: Based on the node traffic flow sequence, define the initial adjacency matrix of the traffic flow sequence and use continuous LSTM and Hawkes process to adjust the strength to obtain the target adjacency matrix, use graph convolutional neural network to convolve the target adjacency matrix and the node traffic flow sequence, and generate the final representation of the node based on the convolution processing result and time period information; S3: Calculate the similarity between nodes to obtain the attention weights between nodes, and perform multi-head attention calculation on each node based on the attention weights; S4: According to the multi-head attention calculation results, the final representations of nodes are concatenated as the edges of nodes to obtain the od traffic flow matrix; Among them, step S2: based on the node traffic flow sequence, define the initial adjacency matrix of the traffic flow sequence and use continuous LSTM and Hawkes process to adjust the intensity to obtain the target adjacency matrix, use graph convolutional neural network to convolve the target adjacency matrix and the node traffic flow sequence, and generate the final representation of the node based on the convolution processing result and time period information, specifically including: S21: Define the traffic flow sequences of vertices i and j at a given time t as follows: and , get the initial adjacency matrix ; S22: Using continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix ; S23: Use graph convolutional neural network to target adjacency matrix and node traffic flow sequence Perform convolution processing to obtain the convolution processing result ; S24: Based on the convolution processing results and time period information , generating the final representation of the node ; Among them, in step S21, the initial adjacency matrix The expression is: ; in, represents the inverse of the distance matrix, represents the similarity function; Wherein, the step S22 specifically includes: S221: Define adjustment event types; wherein the adjustment events include correlation enhancement, correlation weakening, and unchanged correlation strength. The definition expression of the adjustment event type is specifically: ; in, is the threshold that controls event sparsity, Indicates related enhancement, Indicates that the correlation is weakened. Indicates that the strength of association remains unchanged. represents the OD demand from node i to node j in the OD matrix at time t; S222: Use Hawkes process to determine at event t The type k on the adjustment event is defined as: ; in, is the basic intensity of type k events, is the impact of type l event on type k event. Type l event is a general term for all types of events in historical traffic data. To simulate the exponential decay function of the impact of past events on current events, represents the decay rate of the impact of historical type l events on type k events, t represents the time when the current type k event occurs, Indicates the time when a historical l type event occurs; S223: Using continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix, whose expression is as follows: ; in, is the target adjacency matrix, is a learnable parameter; Among them, in step S23, the convolution processing result The expression is: ; in, is the result of convolution processing, GCN (·) is the graph convolutional neural network, and They represent the target adjacency matrix and node traffic flow sequence in the convolution process respectively; In step S24, the final representation of the node The expression is: ; ; ; ; ; ; ; in, Pointing to the connection of quantity, It is the time representation within the time window, that is, the sum of the order time of the transaction records within the time window, D is the defined daily cycle time constant, and W is the defined weekly cycle time constant.
2. The od traffic flow matrix prediction method as claimed in claim 1, characterized in that: Step S1: Obtain historical traffic order data, process the historical traffic order data, and obtain a node traffic flow sequence, specifically including: S11: Get historical traffic order data , using the time window to divide the historical traffic order data into an od matrix sequence ;in, ; S12: Calculate the row sum and column sum of the obtained od matrix sequence, and add the row sum result and column sum result to obtain the node traffic flow sequence ;in, .
3. The od traffic flow matrix prediction method as claimed in claim 2, characterized in that: In step S12: the obtained od matrix sequence is subjected to the row sum and column sum expressions, which are specifically: ; ; in, In order to seek action and results, To find the column and result.
4. The od traffic flow matrix prediction method as claimed in claim 1, characterized in that: The step S3: calculating the similarity between nodes to obtain the attention weights between nodes, and performing multi-head attention calculation on each node based on the attention weights, specifically includes: S31: For a given node u and its corresponding adjacent node set N(u), the node features are divided into three parts: query, key, and value, and the expression represented by them is obtained through linear transformation, specifically: ; ; ; in, is the node representation of the adjacent node set N(u) of node u, , , are three different learnable parameters; S32: Perform multi-head attention calculation on each node. The expression is as follows: ; ; ; in, is the embedding vector representation of node u, is the intensity function obtained by Hawkes process, d is Dimension.
5. The od traffic flow matrix prediction method as claimed in claim 1, characterized in that: In step S4, according to the multi-head attention calculation results, the final representations of the nodes are concatenated as the edge expressions of the nodes, specifically: ; in, are learnable parameters.
6. An OD traffic flow matrix prediction system, characterized in that: include: An input module, used to obtain historical traffic order data, process the historical traffic order data, and obtain a node traffic flow sequence; A continuous spatiotemporal dependency modeling module, which is used to define an initial adjacency matrix of the traffic flow sequence based on the node traffic flow sequence and use continuous LSTM and Hawkes process to perform intensity adjustment to obtain a target adjacency matrix, use a graph convolutional neural network to perform convolution processing on the target adjacency matrix and the node traffic flow sequence, and generate a final representation of the node based on the convolution processing result and time period information; A multi-head attention mechanism module is used to calculate the similarity between nodes to obtain the attention weights between nodes, and perform multi-head attention calculation on each node based on the attention weights; The fusion module is used to splice the final representations of nodes as the edges of nodes according to the multi-head attention calculation results to obtain the OD traffic flow matrix; Among them, based on the node traffic flow sequence, the initial adjacency matrix of the traffic flow sequence is defined and the strength is adjusted using continuous LSTM and Hawkes process to obtain the target adjacency matrix, and the target adjacency matrix and the node traffic flow sequence are convolved using a graph convolutional neural network. Based on the convolution processing result and time period information, the final representation of the node is generated, which specifically includes: Define a given time t, the traffic flow sequences of vertices i and j are and , get the initial adjacency matrix ; Use continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix ; Use graph convolutional neural network to map the target adjacency matrix and node traffic flow sequence Perform convolution processing to obtain the convolution processing result ; Based on the convolution processing results and time period information , generating the final representation of the node ; Among them, the initial adjacency matrix The expression is: ; in, represents the inverse of the distance matrix, represents the similarity function; Among them, the initial adjacency matrix is transformed using continuous LSTM and Hawkes process. Perform strength adjustment to obtain the target adjacency matrix , including: Define an adjustment event type; wherein the adjustment event includes correlation enhancement, correlation weakening, and unchanged correlation strength. The definition expression of the adjustment event type is specifically: ; in, is the threshold that controls event sparsity, Indicates related enhancement, Indicates that the correlation is weakened. Indicates that the strength of association remains unchanged. represents the OD demand from node i to node j in the OD matrix at time t; Use the Hawkes process to determine at event t The type k on the adjustment event is defined as: ; in, is the basic intensity of type k events, is the impact of type l event on type k event. Type l event is a general term for all types of events in historical traffic data. To simulate the exponential decay function of the impact of past events on current events, represents the decay rate of the impact of historical type l events on type k events, t represents the time when the current type k event occurs, Indicates the time when a historical l type event occurs; Use continuous LSTM and Hawkes process to initialize the adjacency matrix Perform strength adjustment to obtain the target adjacency matrix, whose expression is as follows: ; in, is the target adjacency matrix, is a learnable parameter; Among them, the convolution processing result The expression is: ; in, is the result of convolution processing, GCN (·) is the graph convolutional neural network, and They represent the target adjacency matrix and node traffic flow sequence in the convolution process respectively; Final representation of the node The expression is: ; ; ; ; ; ; ; in, Pointing to the connection of quantity, It is the time representation within the time window, that is, the sum of the order time of the transaction records within the time window, D is the defined daily cycle time constant, and W is the defined weekly cycle time constant.
Citation Information
Patent Citations
Traffic flow prediction method and device, electronic equipment and storage medium
CN115423162A
Traffic flow long-time prediction method and system based on improved Transform model
CN115587454A
Traffic flow prediction system and method based on space-time convolution and dynamic graph
CN116153089A
Traffic flow prediction system and method based on continuous dynamic ordinary differential equation
CN116363878A
Traffic flow forecasting method based on deep graph gaussian processes
US20230058520A1
