Deep learning traffic flow prediction method based on time perception hypergraph

Through the deep learning method based on time-aware hypergraph, the space-time correlation and high-order spatial dependence of traffic flow data are captured, and the information details loss and calculation complexity of traffic flow prediction in the existing technology are solved, and the traffic flow is realized. Accurate prediction provides a scientific basis for transportation planning.

CN118968784APending Publication Date: 2024-11-15BEIJING UNIV OF TECH

Patent Information

Application Number
CN202410983411.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Existing traffic flow prediction methods are difficult to effectively capture the complex spatial and temporal correlation and high-order spatial dependencies in traffic flow data, resulting in loss of information details and increased computational complexity, and it is impossible to accurately predict traffic flow in urban road networks.

Method used

Using a deep learning method based on time-aware hypergraph, time dependencies are captured through time encoder and time attention network, combined with spectral domain spatial hypergraph encoder and hypergraph attention network to capture higher-order spatial dependencies, and using feature fusion devices Fusion of spatiotemporal features and finally use a full connection layer to predict traffic flow.

Benefits of technology

It realizes accurate prediction of traffic conditions in different time periods and road sections, provides scientific basis for traffic planning, and improves traffic efficiency and quality of life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118968784A_ABST
    Figure CN118968784A_ABST
Patent Text Reader

Abstract

The invention discloses a deep learning traffic flow prediction method based on a time perception hypergraph, and the method comprises the steps: constructing a mixed hypergraph through traffic flow data, so as to describe the space structure information of a traffic network, including the position information of nodes and the high-order relation between the nodes; and constructing a time-aware hypergraph to represent the dynamic periodic characteristics of the traffic flow data. Secondly, in combination with space structure information and dynamic periodic characteristics of a traffic road network, a time module based on a time encoder and a time attention network is used for extracting and mining a time dependency relationship in traffic flow data; a spatial module based on a spectral domain spatial hypergraph encoder and a hypergraph attention network is used for deeply mining a spatial dependency relationship in traffic flow data, and a multi-layer perceptron feature fusion device is used for fusing various time and spatial features into a space-time dependency relationship. And finally, mapping the space-time dependency relationship into a future traffic flow predicted value by using a predictor based on a full connection layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to spatiotemporal big data, attention mechanism, time coding, space coding, and neural network technology, and in particular to a deep learning traffic flow prediction method based on time-aware hypergraph. Background Art

[0002] In recent years, the urbanization process has been accelerating, and urban traffic problems have become increasingly prominent. In order to solve the problem of urban traffic congestion and improve the efficiency of urban traffic operation, traffic flow prediction in traffic planning has become crucial.

[0003] Traffic flow data is not only closely related to time, but key indicators such as the number of vehicles, speed, road occupancy and location will fluctuate in real time as traffic conditions change dynamically. At the same time, these data also show significant correlation in the spatial dimension, because the operation status of vehicles on the road is deeply affected by road conditions. Faced with such a complex and changing traffic environment, especially considering its spatiotemporal correlation and highly nonlinear characteristics, how to accurately predict the traffic flow of urban road networks is a difficult problem currently faced.

[0004] First, although traffic flow data has dynamic characteristics that change over time, these dynamic characteristics also have certain periodicity due to people's travel habits and life patterns. For example, during the morning and evening commuting peaks, traffic flow will reach a peak, while in the late night and early morning hours, traffic flow is relatively low. Therefore, considering the periodic changes in traffic flow data can better understand and predict the dynamic trend of traffic flow. Secondly, existing traffic flow prediction methods mainly use deep learning technologies such as convolutional neural networks, recurrent neural networks and their variants, and attention mechanisms to capture the spatiotemporal dependencies in traffic flow data. Although there are many existing prediction models and traffic flow prediction research has made phased progress, these methods still have shortcomings. For example, graph convolutional neural networks, which are widely used to extract spatial dependencies, are limited to capturing low-order spatial dependencies between two adjacent nodes. Although more complex high-order spatial dependencies between nodes can be explored with increasing depth, it is easy to cause over-smoothing, resulting in the loss of information details, and cannot effectively explore the complex nonlinear relationships between traffic flow data, accompanied by a significant increase in computational complexity.

[0005] To this end, this patent proposes a deep learning traffic flow prediction method based on time-aware hypergraph. This method targets the complex and changeable spatiotemporal correlations in traffic flow data, fully considers the dynamic periodic characteristics of traffic flow data, and the spatial structure information of the road network, including the location information of nodes and the high-order relationships between nodes. A time module based on a time encoder and a time attention network and a spatial module based on a spectral domain spatial hypergraph encoder and a hypergraph attention network are used to deeply explore the temporal and spatial dependencies in traffic flow data, and a feature fuser is used to fuse various temporal and spatial features into spatiotemporal dependencies. Finally, a prediction module based on a fully connected layer is used to achieve accurate prediction of traffic flow. This method can help governments and transportation departments better plan and manage urban traffic, improve traffic conditions, improve traffic efficiency, and provide a scientific theoretical basis for improving the quality of life of urban residents. Summary of the invention

[0006] The technical problem solved by the present invention is: to propose a deep learning traffic flow prediction method based on time-aware hypergraph to achieve accurate prediction of traffic flow, so as to monitor the traffic conditions in different time periods and different road sections, and provide a scientific basis for traffic planning.

[0007] The technical solution of the present invention is: the present invention proposes a deep learning traffic flow prediction method based on time-aware hypergraph. First, the time information of the traffic flow data is encoded using a time encoder to assist the time attention network in extracting the time dependency of the traffic flow data. Secondly, a hybrid hypergraph and a time-aware hypergraph are constructed based on historical traffic flow data, and the spectral domain spatial hypergraph encoder and the hypergraph attention network are used to effectively capture the spatial location information of the traffic network and the high-order spatial dependencies in its traffic flow data, respectively. Then, a feature fuser is used to fuse the various extracted temporal and spatial features, including temporal dependencies, spatial location information, and high-order spatial dependencies, into spatiotemporal dependencies in the traffic flow data. Finally, a predictor is used to map the spatiotemporal dependencies into predicted values ​​for future traffic flow data. The following steps are included:

[0008] (1) The sensors installed in the traffic network are regarded as nodes of the topological graph, the connection relationship between the nodes is regarded as the edge, the traffic flow data recorded by the sensors is regarded as the node attribute, the traffic flow data is represented, the hybrid hypergraph and the time-aware hypergraph are constructed, and the problem solved by this patent is defined;

[0009] (2) Using the temporal module to model the temporal dependencies in traffic flow data, the temporal encoder encodes the temporal information of traffic flow data to assist the temporal attention network in extracting temporal dependencies from traffic flow data;

[0010] (3) Combining the hybrid hypergraph obtained in step (1) and using the spectral domain spatial hypergraph encoder to effectively capture the spatial location information of the traffic network;

[0011] (4) Combining the time-aware hypergraph obtained in step (1) with the temporal dependencies obtained in step (2), a hypergraph attention network is used to capture high-order spatial dependencies in traffic flow data;

[0012] (5) combining the temporal dependency obtained in step (2), the spatial location information obtained in step (3), and the high-order spatial dependency obtained in step (4), and using a feature fusion device to fuse various temporal and spatial features to obtain the temporal and spatial dependency in the traffic flow data;

[0013] (6) combining the spatiotemporal dependency relationship obtained in step (5), using a predictor on the time dimension of the spatiotemporal dependency relationship to derive a future traffic flow prediction value, and determining a model for traffic flow prediction;

[0014] (7) Using the model determined in step (6), training and parameter optimization are performed and applied to traffic flow prediction.

[0015] Furthermore, the step (1) specifically comprises the following steps:

[0016] 1a). Define the traffic network as an undirected graph G = (V, E, A), where the point set V = {v i} represents all nodes in the graph (e.g., sensors), and the edge set E = {e ij} represents the pairwise connection relationship between all nodes, and the matrix A = {a ij}∈R N×N Represents the adjacency matrix of graph G. If node v i Connect node v j , then a ij =1, otherwise a ij = 0. |V| = N, |·| represents the number of set elements.

[0017] 1b). Traffic flow data. Given a traffic network G = (V, E, A) and T historical time steps of traffic flow data X :T ={X1,…,X t ,…,X T}∈R T×N×c ,in represents the traffic flow data of all nodes at time t, Represents node v i Traffic flow data at time t.

[0018] 1c). Construct a hybrid hypergraph. Given a traffic network G and traffic flow data X :T, calculate the average value of historical traffic flow data, and obtain the average traffic flow data of each node. The formula is as follows:

[0019]

[0020] in, represents the average traffic flow data of the i-th node, and T represents the sequence length of the historical traffic flow data. Using K-Nearest

[0021] Neighbor (KNN) algorithm calculates the K neighboring nodes of each node as the associated nodes of the node. The steps of constructing a hybrid hypergraph based on the KNN algorithm are described as follows:

[0022] 1) Prepare data containing feature vectors

[0023] 2) Calculate the distance. For each node, use the Euclidean distance calculation formula to calculate the distance between it and other nodes. and The Euclidean distance between them is calculated as follows:

[0024]

[0025] in, and Respectively represent nodes and Average traffic flow data.

[0026] 3) Select the value of K. It represents the number of nearest neighbors of each node in the hypergraph, and the value of K is selected through experiments.

[0027] 4) Constructing the hypergraph G h =(V,ε,A h ,W). V={v i} represents the point set, ε={e j} represents a set of hyperedges, each hyperedge is assigned a weight, W∈R |ε|×|ε| A diagonal matrix representing the hyperedge weights. For each node v i ∈V, according to v i The Euclidean distance between other nodes determines v i The K neighboring nodes of the node are used as the associated nodes of the node in the hypergraph. Each node and its associated nodes form a hyperedge, using the association matrix A h ∈R N×N Represents the relationship between all nodes and all hyperedges, where a row corresponds to the associated nodes of a node and a column corresponds to a hyperedge. iIn the super edge j In the case of h Elements is 1 if the value is true, otherwise it is 0.

[0028] 5) Finally, construct the hybrid hypergraph G mix =(V,ε mix ,A mix ,W mix ), ε mix and A mix Respectively represent G mix The hyperedge set and incidence matrix, W mix A is a diagonal matrix representing the weights of the hyperedges in the hybrid hypergraph. mix The calculation formula is described as follows:

[0029] A mix =A h +A(3)

[0030] A hybrid hypergraph mix The many-to-many connection relationship between nodes driven by historical traffic flow data (correlation matrix A h The high-order relationship represented by the adjacency matrix A) and the pairwise connection relationship between nodes in the traffic network (the connection relationship between adjacent nodes represented by the adjacency matrix A) can more flexibly describe the complex spatial relationship on the traffic network.

[0031] 1d). Constructing a time-aware hypergraph Hypergraphs can flexibly represent many-to-many connections (high-order relationships) between nodes. By constructing hypergraphs at different times, i.e., time-aware hypergraphs, updating the weights of hyperedges or adding new hyperedges, the dynamic nature of traffic flow data over time can be captured. At the same time, since the changes in traffic flow data are closely related to people's daily life patterns, working hours and other factors, there will be periodic peaks and troughs on working days and non-working days in a week and at different times of the day. Using the obvious periodicity of traffic flow data to construct a time-aware hypergraph can save memory space and improve computing efficiency. Given a traffic network G and traffic flow data X, :T ∈R T×N×c , consider various period granularities of traffic flow series data, for example, a period of length S = 2016 is composed of 5 minutes per hour (12), hours per day (24) and days per week (7). The time series length T has a total of periods, divide all sequences by their period and store them in a matrix:

[0032] B=[B1;…;B s ;…;B S ]∈R S×N×(c×O) (4)

[0033] Among them, B s ∈R N×(c×O) Represents the historical traffic flow data of the sth time (5 minutes) of all cycles, and a total of O historical traffic flow data are recorded. s As a node attribute, the KNN algorithm is used to construct the hypergraph of the time The hypergraphs of all times in a cycle constitute a hypergraph library For a given P historical time step of traffic flow data X = {X1 , …,X t ,…,X P}∈R P×N×c , extract the corresponding P hypergraph sequences from the hypergraph library and record them as time-aware hypergraphs s t Represents the time within the period corresponding to time t.

[0034] 1e) Traffic flow prediction problem: Given P historical time steps of traffic flow data X = {X1, X2, ..., X P}∈R P×N×c , predict the traffic flow of all nodes in the future Q time steps, and the predicted value is recorded as The true value is recorded as Y = {X (P+1) ,X (P+2) ,…,X (P+Q)}∈R Q×N×c .

[0035] Further, the step (2) specifically comprises the following steps:

[0036] 2a). Considering the dynamic periodicity in traffic flow data, the label is encoded by sequence coding. Taking the 5-minute interval as an example, there are 288 specific time periods in a day, and the label value range is 1 to 288; and the week label value range is 1 to 7. The label value of the specific time period and the week label value in the traffic flow data X are respectively expressed as and Represented, and the concatenation of the two is input into a multi-layer perceptron to obtain the time coding information E tp , the calculation formula is as follows:

[0037]

[0038] Here, MLP(·) represents a multi-layer perceptron and || represents a concatenation operation.

[0039] 2b) The obtained time coding information E tp Fusion with traffic flow data X, the calculation formula is as follows:

[0040] X'=Etp +X(6)

[0041] 2c). Input X' as a time series into the temporal attention network. The temporal attention network is a neural network based on the self-attention mechanism. It models the temporal dependency in traffic flow data by exploring the relationship between different times in the sequence. For each time, the correlation weight between the time and other times is calculated, and the weighted sum of the features of all times is taken to obtain the temporal dependency X. tp The specific formula is:

[0042]

[0043] Among them, TempAttention(·) represents the temporal attention network, Q = linear Q (X'), K = linear K (X'), V = linear V (X') represent query vector, key vector and value vector respectively, linear Q , linear K and linear V Both represent linear transformations, d k = d represents the dimension of the key vector, and Softmax(·) represents the activation function that maps the input to the interval [0, 1].

[0044] Further, step (3) specifically includes the following steps:

[0045] 3a). Combine the hybrid hypergraph G obtained in step 1c) mix , and its corresponding hypergraph Laplacian matrix is Where I represents the identity matrix, D v represents the node degree matrix, D e represents the hyperedge degree matrix, A mix Denote the hybrid hypergraph G mix The correlation matrix, W mix Represents the diagonal matrix of the mixed hypergraph containing the hyperedge weights. The hypergraph Laplacian matrix Δ can be characteristically decomposed into:

[0046]

[0047] Among them, U=[u1,u2,…,u N ] is the eigenvector matrix, Λ=Diag(λ1,λ2,…,λ N ) is a diagonal matrix containing nonnegative eigenvalues.

[0048] 3b). Given a bandpass wavelet kernel defined in the hypergraph domain By stretching the kernel at different scales A set of bandpass filters can be generated. A stretched filter with scale b>0 can be represented as a diagonal matrix:

[0049]

[0050] in, λ i is the i-th largest eigenvalue of the hypermap matrix.

[0051] 3c). Stretching filter with scale b in the hypergraph domain and the corresponding hypergraph Laplacian matrix eigenvector U :d =[u1,,u2,…,u d ], at time t, the spatial position information of the traffic network nodes can be obtained through a spectral domain spatial hypergraph encoder, and the calculation formula is:

[0052]

[0053] It is worth noting that The dot product of its transpose is exactly equal to the hypergraph wavelet basis That is, the Laplacian eigenvector of the graph is obtained from the stretched filter The central node of the hypergraph spreads outward, which not only contains the high-order relationships of the hypergraph, but also reflects the positioning characteristics of the hypergraph. Every time t has consistent spatial location information, and the spatial location information of all times can be expressed as:

[0054]

[0055] Further, step (4) specifically includes the following steps:

[0056] 4a). Combine the time dependency X obtained in step (2) tp , initialize node V 0 =X tp , which provides input to the hypergraph attention network that extracts high-order spatial dependencies in traffic flow data. The hypergraph attention network consists of a point-level attention layer AGGR node and edge-level attention layer AGGR edge Composition,In order to improve the expressiveness and learning ability of the model, a two-layer hypergraph attention network is used.

[0057] 4b). Combine the time-aware hypergraph constructed in step (1) Using point-level attention layer AGGR node Aggregate node information into hyperedge representation. Specifically, given the hypergraph at time t For each node v i , point-level attention layer AGGRnode Learn all about Medium i The associated hyperedge set ε i For any e j ∈ε i Hyperedge representation of The calculation formula can be simply written as:

[0058]

[0059] in, Use the attention mechanism to collect relevant node information Aggregation into hyperedge representation is node v i Node representation at the output of layer l-1. Hyperedge representation The specific calculation formula is:

[0060]

[0061] Among them, σ(·) represents the activation function, M1 represents the trainable weight matrix, and α ji Represents node v i In the super edge j The attention coefficient in is calculated as:

[0062]

[0063] in, is a trainable weight vector that measures the importance of a node, and LeakyReLU(·) represents the activation function.

[0064] 4c). Using edge-level attention layer Learning layer l v i Node representation Simply written as:

[0065]

[0066] in, Use the attention mechanism to integrate relevant hyper-edge information Aggregate into nodes That is, node v i The output representation of layer l is calculated as follows:

[0067]

[0068] Among them, M2 is the trainable weight matrix, β ij Represents the hyperedge e j For node v iThe attention coefficient is calculated as follows:

[0069]

[0070] in, is a trainable weight vector measuring the importance of the hyperedge.

[0071] 4d). Combining the associations between nodes and hyperedges in the time-aware hypergraph, the hypergraph attention network captures the high-order spatial dependencies in traffic flow data. where v i,t Represents node v i The output of the last layer of the hypergraph attention network at time t. The high-order spatial dependencies of all P time steps can be expressed as Z hsp :

[0072]

[0073] Furthermore, step (5) combines the time dependency X obtained in step (2) tp , the spatial position information E obtained in step (3) pos And the high-order spatial dependency Z obtained in step (4) hsp , the splicing of the three is input into the feature fusion device (i.e., multi-layer perceptron) to obtain the spatiotemporal dependency Z in the traffic flow data. The calculation formula is as follows:

[0074] Z=MLP([X tp ||E pos ||Z hsp ])∈R P×N×c (twenty one)

[0075] Furthermore, step (6) implements multi-step traffic flow prediction, using the predictor on the time dimension of the spatiotemporal dependency Z to derive the future traffic flow prediction value The formula of the predictor is described as follows:

[0076]

[0077] Among them, FCL(·) represents a fully connected layer, each of whose neurons will be connected to all neurons in the previous layer and has trainable parameters, and σ(·) is a nonlinear activation function that enables the model to better model complex relationships.

[0078] Furthermore, step (7) combines the prediction model determined in step (6) to construct a loss function, perform model training and parameter optimization. The specific steps are as follows: 7a). Use mean absolute error as the loss function The formula is described as follows:

[0079]

[0080] in, represents the true value of traffic flow at the i-th node at time t, Represents the traffic flow prediction value of the i-th node at time t.

[0081] 7b). Use Adaptive Moment Estimation Optimizer (Adam). Adam is a gradient-based adaptive learning rate optimizer that combines the ideas of momentum optimizer and adaptive learning rate. It not only considers the first-order moment (mean) of the gradient, but also the second-order moment (variance). The optimization steps of the optimizer are as follows:

[0082] 1) Calculate the loss function: Compare the model's prediction results with the true values ​​and calculate the value of the loss function. This step measures the performance of the model under the current parameters;

[0083] 2) Calculate the gradient: Calculate the gradient of the loss function to the model parameters through the back-propagation algorithm. The gradient indicates the rate of change of the loss function at the current parameter value, that is, the direction and magnitude of the parameter adjustment;

[0084] 3) Update model parameters: Use the optimizer to update model parameters based on gradient information. The optimizer determines the specific adjustment method of the parameters based on the defined update rules and learning rate. The parameter update formula can be expressed as: new parameter = old parameter - learning rate × gradient;

[0085] 4) Repeated iteration: Repeat the above steps until the stopping condition is reached (such as reaching the maximum number of iterations, the loss function converges, or the training set is traversed). By updating the parameters through multiple iterations, the optimizer will gradually adjust the model parameters so that the value of the loss function continues to decrease, thereby improving the performance of the model.

[0086] 7c). Hyperparameter tuning mainly includes:

[0087] 1) Selection of K value in KNN algorithm;

[0088] 2) Choice of learning rate;

[0089] 3) Batch size;

[0090] 4) Number of iterations. BRIEF DESCRIPTION OF THE DRAWINGS

[0091] Figure 1 It is a flow chart of the overall steps of the present invention.

[0092] Figure 2 It is a detailed diagram of the hypergraph attention network part of the present invention. DETAILED DESCRIPTION

[0093] In order to enable persons skilled in the art to better understand the solutions of the embodiments of the present invention, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and implementation methods.

[0094] like Figure 1 , Figure 2 As shown, the present invention comprises the following steps:

[0095] (1) The sensors installed in the traffic network are regarded as nodes of the topological graph, the connection relationship between the nodes is regarded as the edge, the traffic flow data recorded by the sensors is regarded as the node attribute, the traffic flow data is represented, the hybrid hypergraph and the time-aware hypergraph are constructed, and the problem solved by this patent is defined;

[0096] (2) Using the temporal module to model the temporal dependencies in traffic flow data, the temporal encoder encodes the temporal information of traffic flow data to assist the temporal attention network in extracting temporal dependencies from traffic flow data;

[0097] (3) Combining the hybrid hypergraph obtained in step (1) and using the spectral domain spatial hypergraph encoder to effectively capture the spatial location information of the traffic network;

[0098] (4) Combining the time-aware hypergraph obtained in step (1) with the temporal dependencies obtained in step (2), a hypergraph attention network is used to capture high-order spatial dependencies in traffic flow data;

[0099] (5) combining the temporal dependency obtained in step (2), the spatial location information obtained in step (3), and the high-order spatial dependency obtained in step (4), and using a feature fusion device to fuse various temporal and spatial features to obtain the temporal and spatial dependency in the traffic flow data;

[0100] (6) combining the spatiotemporal dependency relationship obtained in step (5), using a predictor on the time dimension of the spatiotemporal dependency relationship to derive a future traffic flow prediction value, and determining a model for traffic flow prediction;

[0101] (7) Using the model determined in step (6), training and parameter optimization are performed and applied to traffic flow prediction.

[0102] Furthermore, the step (1) specifically comprises the following steps:

[0103] 1a). Define the traffic network as an undirected graph G = (V, E, A), where the point set V = {v i} represents all nodes in the graph (e.g., sensors), and the edge set E = {e ij} represents the pairwise connection relationship between all nodes, and the matrix A = {a ij}∈R N×N Represents the adjacency matrix of graph G. If node v i Connect node v j , then a ij =1, otherwise a ij = 0. |V| = N, |·| represents the number of set elements.

[0104] 1b). Traffic flow data. Given a traffic network G = (V, E, A) and T historical time steps of traffic flow data X :T ={X1,…,X t ,…,X T}∈R T×N×c ,in represents the traffic flow data of all nodes at time t, Represents node v i Traffic flow data at time t.

[0105] 1c). Construct a hybrid hypergraph. Given a traffic network G and traffic flow data X :T , calculate the average value of historical traffic flow data, and obtain the average traffic flow data of each node. The formula is as follows:

[0106]

[0107] in, represents the average traffic flow data of the i-th node, and T represents the sequence length of the historical traffic flow data. Using K-Nearest

[0108] Neighbor (KNN) algorithm calculates the K neighboring nodes of each node as the associated nodes of the node. The steps of constructing a hybrid hypergraph based on the KNN algorithm are described as follows:

[0109] 1) Prepare data containing feature vectors

[0110] 2) Calculate the distance. For each node, use the Euclidean distance calculation formula to calculate the distance between it and other nodes. and The Euclidean distance between them is calculated as follows:

[0111]

[0112] in, and Respectively represent nodes and Average traffic flow data.

[0113] 3) Select the value of K. It represents the number of nearest neighbors of each node in the hypergraph, and the value of K is selected through experiments.

[0114] 4) Constructing the hypergraph G h =(V,ε,A h ,W). V={v i} represents the point set, ε={e j} represents a set of hyperedges, each hyperedge is assigned a weight, W∈R |ε|×|ε| A diagonal matrix representing the hyperedge weights. For each node v i ∈V, according to v i The Euclidean distance between other nodes determines v i The K neighboring nodes of the node are used as the associated nodes of the node in the hypergraph. Each node and its associated nodes form a hyperedge, using the association matrix A h ∈R N×N Represents the relationship between all nodes and all hyperedges, where a row corresponds to the associated nodes of a node and a column corresponds to a hyperedge. i In the super edge j In the case of h Elements is 1 if the value is true, otherwise it is 0.

[0115] 5) Finally, construct the hybrid hypergraph G mix =(V,ε mix ,A mix ,W mix ), ε mix and A mix Respectively represent G mix The hyperedge set and incidence matrix, W mix A is a diagonal matrix representing the weights of the hyperedges in the hybrid hypergraph. mix The calculation formula is described as follows:

[0116] A mix =A h +A(3)

[0117] A hybrid hypergraph mix The many-to-many connection relationship between nodes driven by historical traffic flow data (correlation matrix A h The high-order relationship represented by the adjacency matrix A) and the pairwise connection relationship between nodes in the traffic network (the connection relationship between adjacent nodes represented by the adjacency matrix A) can more flexibly describe the complex spatial relationship on the traffic network.

[0118] 1d). Constructing a time-aware hypergraph Hypergraphs can flexibly represent many-to-many connections between nodes (high-order relations

[0119] By constructing hypergraphs at different times, i.e., time-aware hypergraphs, updating the weights of hyperedges or adding new hyperedges, we can capture the dynamics of traffic flow data over time. At the same time, since the changes in traffic flow data are closely related to people's daily life patterns, working hours and other factors, there will be periodic peaks and troughs on working days and non-working days in a week and at different times of the day. Using the obvious periodicity of traffic flow data to construct a time-aware hypergraph can save memory space and improve computing efficiency. Given a traffic network G and traffic flow data X :T ∈R T×N×c , consider various period granularities of traffic flow series data, for example, a period of length S = 2016 is composed of 5 minutes per hour (12), hours per day (24) and days per week (7). The time series length T has a total of periods, divide all sequences by their period and store them in a matrix:

[0120] B=[B1;…;B s ;…;B S ]∈R S×N×(c×O) (4)

[0121] Among them, B s ∈R N×(c×O) Represents the historical traffic flow data of the sth time (5 minutes) of all cycles, and a total of O historical traffic flow data are recorded. s As a node attribute, the KNN algorithm is used to construct the hypergraph of the time The hypergraphs of all times in a cycle constitute a hypergraph library For a given P historical time step of traffic flow data X = {X1,…,X t ,…,X P}∈R P×N×c , extract the corresponding P hypergraph sequences from the hypergraph library and record them as time-aware hypergraphs s t Represents the time within the period corresponding to time t.

[0122] 1e) Traffic flow prediction problem: Given P historical time steps of traffic flow data X = {X1, X2, …, X P}∈R P×N×c , predict the traffic flow of all nodes in the future Q time steps, and the predicted value is recorded as The true value is recorded as Y = {X (P+1) ,X (P+2) ,…,X (P+Q)}∈R Q×N×c .

[0123] Further, the step (2) specifically comprises the following steps:

[0124] 2a). Considering the dynamic periodicity in traffic flow data, the label is encoded by sequence coding. Taking the 5-minute interval as an example, there are 288 specific time periods in a day, and the label value range is 1 to 288; and the week label value range is 1 to 7. The label value of the specific time period and the week label value in the traffic flow data X are respectively expressed as and Represented, and the concatenation of the two is input into a multi-layer perceptron to obtain the time encoding information E tp , the calculation formula is as follows:

[0125]

[0126] Here, MLP(·) represents a multi-layer perceptron and || represents a concatenation operation.

[0127] 2b) The obtained time coding information E tp Fusion with traffic flow data X, the calculation formula is as follows:

[0128] X'=E tp +X(6)

[0129] 2c). Input X' as a time series into the temporal attention network. The temporal attention network is a neural network based on the self-attention mechanism. It models the temporal dependency in traffic flow data by exploring the relationship between different times in the sequence. For each time, the correlation weight between the time and other times is calculated, and the weighted sum of the features of all times is taken to obtain the temporal dependency X. tp The specific formula is:

[0130]

[0131] Among them, TempAttention(·) represents the temporal attention network, Q = linear Q (X'), K = linear K (X'), V = linear V (X') represent query vector, key vector and value vector respectively, linear Q , linear K and linear V Both represent linear transformations, d k = d represents the dimension of the key vector, and Softmax(·) represents the activation function that maps the input to the interval [0, 1].

[0132] Further, step (3) specifically includes the following steps:

[0133] 3a). Combine the hybrid hypergraph G obtained in step 1c) mix , and its corresponding hypergraph Laplacian matrix is Where I represents the identity matrix, D v represents the node degree matrix, D e represents the hyperedge degree matrix, A mix Denote the hybrid hypergraph G mix The correlation matrix, W mix Represents the diagonal matrix of the mixed hypergraph containing the hyperedge weights. The hypergraph Laplacian matrix Δ can be characteristically decomposed into:

[0134]

[0135] Among them, U=[u1,u2,…,u N ] is the eigenvector matrix, Λ=Diag(λ1,λ2,…,λ N ) is a diagonal matrix containing nonnegative eigenvalues.

[0136] 3b). Given a bandpass wavelet kernel defined in the hypergraph domain By stretching the kernel at different scales A set of bandpass filters can be generated. A stretched filter with scale b>0 can be represented as a diagonal matrix:

[0137]

[0138] in, λ i is the i-th largest eigenvalue of the hypermap matrix.

[0139] 3c). Stretching filter with scale b in the hypergraph domain and the corresponding hypergraph Laplacian matrix eigenvector U :d =[u1,,u2,…,u d ], at time t, the spatial position information of the traffic network nodes can be obtained through a spectral domain spatial hypergraph encoder, and the calculation formula is:

[0140]

[0141] It is worth noting that The dot product of its transpose is exactly equal to the hypergraph wavelet basis That is, the Laplacian eigenvector of the graph is obtained from the stretched filter The central node of the hypergraph spreads outward, which not only contains the high-order relationships of the hypergraph, but also reflects the positioning characteristics of the hypergraph.

[0142] Location information, the spatial location information of all time can be expressed as:

[0143]

[0144] Further, step (4) specifically includes the following steps:

[0145] 4a). Combine the time dependency X obtained in step (2) tp , initialize node V 0 =X tp , which provides input to the hypergraph attention network that extracts high-order spatial dependencies in traffic flow data. The hypergraph attention network consists of a point-level attention layer AGGR node and edge-level attention layer AGGR edge Composition,In order to improve the expressiveness and learning ability of the model, a two-layer hypergraph attention network is used.

[0146] 4b). Combine the time-aware hypergraph constructed in step (1) Using point-level attention layer AGGR node Aggregate node information into hyperedge representation. Specifically, given the hypergraph at time t For each node v i , point-level attention layer AGGR node Learn all about Medium i The associated hyperedge set ε i For any e j ∈ε i Hyperedge representation of The calculation formula can be simply written as:

[0147]

[0148] in, Use the attention mechanism to collect relevant node information Aggregation into hyperedge representation is node v i Node representation at the output of layer l-1. Hyperedge representation The specific calculation formula is:

[0149]

[0150] Among them, σ(·) represents the activation function, M1 represents the trainable weight matrix, and α ji Represents node v i In the super edge j The attention coefficient in is calculated as:

[0151]

[0152] in, is a trainable weight vector that measures the importance of a node, and LeakyReLU(·) represents the activation function.

[0153] 4c). Using edge-level attention layer Learning layer l v i Node representation Simply written as:

[0154]

[0155] in, Use the attention mechanism to integrate relevant hyper-edge information Aggregate into nodes That is, node v i The output representation of layer l is calculated as follows:

[0156]

[0157] Among them, M2 is the trainable weight matrix, β ij Represents the hyperedge e j For node v i The attention coefficient is calculated as follows:

[0158]

[0159] in, is a trainable weight vector measuring the importance of the hyperedge.

[0160] 4d). Combining the associations between nodes and hyperedges in the time-aware hypergraph, the hypergraph attention network captures the high-order spatial dependencies in traffic flow data. where v i,t Represents node v i The output of the last layer of the hypergraph attention network at time t. The high-order spatial dependencies of all P time steps can be expressed as Z hsp :

[0161]

[0162] Furthermore, step (5) combines the time dependency X obtained in step (2) tp , the spatial position information E obtained in step (3) pos And the high-order spatial dependency Z obtained in step (4) hsp , the splicing of the three is input into the feature fusion device (i.e., multi-layer perceptron) to obtain the spatiotemporal dependency Z in the traffic flow data. The calculation formula is as follows:

[0163] Z=MLP([X tp ||E pos ||Z hsp ])∈R P×N×c (twenty one)

[0164] Furthermore, step (6) implements multi-step traffic flow prediction, using the predictor on the time dimension of the spatiotemporal dependency Z to derive the future traffic flow prediction value The formula of the predictor is described as follows:

[0165]

[0166] Among them, FCL(·) represents a fully connected layer, each of whose neurons will be connected to all neurons in the previous layer and has trainable parameters, and σ(·) is a nonlinear activation function that enables the model to better model complex relationships.

[0167] Furthermore, step (7) combines the prediction model determined in step (6) to construct a loss function, perform model training and parameter optimization. The specific steps are as follows: 7a). Use mean absolute error as the loss function The formula is described as follows:

[0168]

[0169] in, represents the true value of traffic flow at the i-th node at time t, Represents the traffic flow prediction value of the i-th node at time t.

[0170] 7b). Use Adaptive Moment Estimation Optimizer (Adam). Adam is a gradient-based adaptive learning rate optimizer that combines the ideas of momentum optimizer and adaptive learning rate. It not only considers the first-order moment (mean) of the gradient, but also the second-order moment (variance). The optimization steps of the optimizer are as follows:

[0171] 1) Calculate the loss function: Compare the model's prediction results with the true values ​​and calculate the value of the loss function. This step measures the performance of the model under the current parameters;

[0172] 2) Calculate the gradient: Calculate the gradient of the loss function to the model parameters through the back-propagation algorithm. The gradient indicates the rate of change of the loss function at the current parameter value, that is, the direction and magnitude of the parameter adjustment;

[0173] 3) Update model parameters: Use the optimizer to update model parameters based on gradient information. The optimizer determines the specific adjustment method of the parameters based on the defined update rules and learning rate. The parameter update formula can be expressed as: new parameter = old parameter - learning rate × gradient;

[0174] 4) Repeated iteration: Repeat the above steps until the stopping condition is reached (such as reaching the maximum number of iterations, the loss function converges, or the training set is traversed). By updating the parameters through multiple iterations, the optimizer will gradually adjust the model parameters so that the value of the loss function continues to decrease, thereby improving the performance of the model.

[0175] 7c). Hyperparameter tuning mainly includes:

[0176] 1) Selection of K value in KNN algorithm;

[0177] 2) Choice of learning rate;

[0178] 3) Batch size;

[0179] 4) Number of iterations.

Claims

1. A deep learning traffic flow prediction method based on time-aware hypergraph, characterized by Here are the steps: (1) Represent traffic flow data and construct hybrid hypergraphs and time-aware hypergraphs based on traffic flow data; (2) Using the temporal module to model the temporal dependencies in traffic flow data, the temporal encoder encodes the temporal information of traffic flow data to assist the temporal attention network in extracting temporal dependencies from traffic flow data; (3) Combining the hybrid hypergraph and time-aware hypergraph obtained in step (1) with the temporal dependency obtained in step (2), The spectral domain spatial hypergraph encoder and hypergraph attention network are used to capture the spatial location information of the road network and the high-order spatial dependencies in the traffic flow data respectively. (4) combining the temporal dependency obtained in step (1), the spatial location information obtained in step (3), and the high-order spatial dependency, and using a feature fusion device to fuse various temporal and spatial features to obtain the temporal and spatial dependency in the traffic flow data; (5) combining the spatiotemporal dependency relationship obtained in step (4), using a predictor on the time dimension of the spatiotemporal dependency relationship to derive a future traffic flow prediction value, and determining a model for traffic flow prediction; (6) Using the model determined in step (5), training and parameter optimization are performed and applied to traffic flow prediction.

2. The deep learning traffic flow prediction method based on time-aware hypergraph according to claim 1 is characterized in that: In the step (1), representing traffic flow data and constructing a hybrid hypergraph and a time-aware hypergraph include: (1) The traffic network is defined as an undirected graph G = (V, E, A), where the point set V = {v i } represents all nodes in the graph (e.g., sensors), and the edge set E = {e ij } represents the pairwise connection relationship between all nodes, and the matrix A = {a ij }∈R N×N Represents the adjacency matrix of graph G. If node v i Connect node v j , a ij =1, otherwise a ij =0; |V|=N, |·| represents the number of set elements; (2) Traffic flow data: Given a traffic network G = (V, E, A) and T historical time steps of traffic flow data X :T ={X1,…,X t ,…,X T }∈R T×N×c ,in represents the traffic flow data of all nodes at time t, Represents node v i Traffic flow data at time t; (3) Construct a hybrid hypergraph; given a traffic network G and traffic flow data X:T, calculate the average value of historical traffic flow data to obtain the average traffic flow data of each node. The formula is as follows: in, represents the average traffic flow data of the i-th node, T represents the sequence length of the historical traffic flow data; according to the average traffic flow data The K-nearest KNN algorithm is used to calculate the K neighboring nodes of each node as the associated nodes of the node; the steps of constructing a hybrid hypergraph based on the KNN algorithm are described as follows: 1) Prepare data containing feature vectors 2) Calculate the distance: For each node, use the Euclidean distance calculation formula to calculate the distance between the two nodes. and The Euclidean distance between them is calculated as follows: in, and Respectively represent nodes and Average traffic flow data; 3) Select the K value; it represents the number of nearest neighbors of each node in the hypergraph, and the K value is selected through experiments; 4) Constructing the hypergraph G h =(V,ε,A h ,W); V = {v i } represents the point set, ε={e j } represents a set of hyperedges, each hyperedge is assigned a weight, W∈R |ε|×|ε| A diagonal matrix representing the hyperedge weights; for each node v i ∈V, according to v i The Euclidean distance between other nodes determines v i The K neighboring nodes of the node are used as the associated nodes of the node in the hypergraph; each node and its associated nodes form a hyperedge, using the association matrix A h ∈R N×N Represents the relationship between all nodes and all hyperedges, where a row corresponds to the associated nodes of a node and a column corresponds to a hyperedge; if a node v i In the super edge j In the case of h Elements is 1, otherwise it is 0; 5) Finally, construct the hybrid hypergraph G mix =(V,ε mix ,A mix ,W mix ), ε mix and A mix Respectively represent G mix The hyperedge set and incidence matrix, W mix A is the diagonal matrix representing the weights of the hyperedges of the hybrid hypergraph; mix The calculation formula is described as follows: A mix =A h +A(3) A hybrid hypergraph mix It combines the many-to-many connection relationship between nodes driven by historical traffic flow data and the pair-wise connection relationship between nodes in the traffic network; (4) Constructing a time-aware hypergraph Given a traffic network G and traffic flow data X :T ∈R T×N×c , considering the various period granularities of traffic flow sequence data, the time series length T is periods, divide all sequences by their period and store them in a matrix: B=[B1;…;B s ;…;B S ]∈R S×N×(c×O) (4) Among them, B s ∈R N×(c×O) Represents the historical traffic flow data of the sth time (5 minutes) of all cycles, and a total of O historical traffic flow data are recorded; the historical cycle traffic flow data of the node B s As a node attribute, the KNN algorithm is used to construct the hypergraph of the time The hypergraphs of all times in a cycle constitute a hypergraph library For a given P historical time step of traffic flow data X = {X1,…,X t ,…,X P }∈R P×N×c , extract the corresponding P hypergraph sequences from the hypergraph library and record them as time-aware hypergraphs s t Represents the time within the period corresponding to time t.

3. The deep learning traffic flow prediction method based on time-aware hypergraph according to claim 2 is characterized in that: In the step (2), using the time module to model the time dependency in the traffic flow data includes: (1) Considering the dynamic periodicity in traffic flow data, the labels are encoded using sequence coding. Every 5 minutes, there are 288 specific time periods in a day, and the label value range is 1 to 288; the weekday label value range is 1 to 7; the label value of the specific time period and the weekday label value in the traffic flow data X are respectively and Represented, and the concatenation of the two is input into a multi-layer perceptron to obtain the time encoding information E tp , the calculation formula is as follows: Where MLP(·) represents a multi-layer perceptron, and || represents a concatenation operation; (2) The obtained time coding information E tp Fusion with traffic flow data X, the calculation formula is as follows: X′=E tp +X (6) (3) Input X' as a time series into the temporal attention network; for each time, calculate the correlation weight between this time and other times, and perform weighted summation of the features of all times to obtain the temporal dependency X tp ; The specific formula is: Among them, TempAttention(·) represents the temporal attention network, Q = linear Q (X'), K = linear K (X'), V = liner V (X') represent query vector, key vector and value vector respectively, linear Q , linear K and liner V Both represent linear transformations, d k = d represents the dimension of the key vector, and Softmax(·) represents the activation function that maps the input to the interval [0, 1].

4. The deep learning traffic flow prediction method based on time-aware hypergraph according to claim 3 is characterized in that: In the step (3), using the spectral domain spatial hypergraph encoder to effectively capture the spatial location information of the traffic network and using the hypergraph attention network to capture the high-order spatial dependencies in the traffic flow data include: (1) The hybrid hypergraph G obtained by step (3) in claim 2 mix , and its corresponding hypergraph Laplacian matrix is Where I represents the identity matrix, D v represents the node degree matrix, D e represents the hyper-edge degree matrix, A mix Denote the hybrid hypergraph G mix The correlation matrix, W mix Represents a diagonal matrix of the mixed hypergraph containing hyperedge weights; the Laplacian matrix Δ of the hypergraph is decomposed into: Among them, U=[u1,u2,…,u N ] is the eigenvector matrix, Λ=Diag(λ1,λ2,…,λ N ) is a diagonal matrix containing non-negative eigenvalues; (2) Given a bandpass wavelet kernel defined in the hypergraph domain By stretching the kernel at different scales Generates a set of bandpass filters; the stretched filters with scale b>0 are represented as a diagonal matrix: in, λ i is the i-th largest eigenvalue of the hypermap matrix; (3) Stretching filter with scale b in the hypergraph domain and the corresponding hypergraph Laplacian matrix eigenvector U:d=[u1,,u2,…,u d ], at time t, the spatial position information of the traffic network nodes is obtained through a spectral domain spatial hypergraph encoder, and the calculation formula is: The dot product of its transpose is exactly equal to the hypergraph wavelet basis That is, the Laplacian eigenvector of the graph is obtained from the stretched filter The central node spreads outward; each time t has consistent spatial location information, and the spatial location information of all times is expressed as: (4) The time dependency X obtained in step (3) of claim 3 tp , initialization node represents V 0 =X tp , which provides input to the hypergraph attention network that extracts high-order spatial dependencies in traffic flow data; the hypergraph attention network consists of a point-level attention layer AGGR node and edge-level attention layer AGGR edge Composition,using a two-layer hypergraph attention network; (5) The time-aware hypergraph constructed in step (1) of claim 2 Using point-level attention layer AGGR node Aggregate node information into hyperedge representation; specifically, the hypergraph at a given time t For each node v i , point-level attention layer AGGR node Learn all about Medium i The associated hyperedge set ε i For any e j ∈ε i Hyperedge representation of The calculation formula is: in, Use the attention mechanism to collect relevant node information Aggregation into hyperedge representation is node v i Node representation at the output of layer l-1; hyperedge representation The specific calculation formula is: Among them, σ(·) represents the activation function, M1 represents the trainable weight matrix, and α ji Represents node v i In the super edge j The attention coefficient in is calculated as: in, is a trainable weight vector that measures the importance of a node, and LeakyReLU(·) represents the activation function; (6) Using edge-level attention layer Learning layer l v i Node representation Simply written as: in, Use the attention mechanism to integrate relevant hyper-edge information Aggregate into nodes That is, node v i The output representation of layer l is calculated as follows: Among them, M2 is the trainable weight matrix, β ij Represents the hyperedge e j For node v i The attention coefficient is calculated as follows: in, is a trainable weight vector measuring the importance of the hyperedge; (7) Combining the associations between nodes and hyperedges in the time-aware hypergraph, the hypergraph attention network captures the high-order spatial dependencies in traffic flow data. where v i,t Represents node v i The output of the last layer of the hypergraph attention network at time t; the high-order spatial dependencies of all P time steps are represented as Z hsp :

5. The deep learning traffic flow prediction method based on time-aware hypergraph according to claim 4 is characterized in that: In step (4), a feature fusion device is used to fuse various temporal and spatial features to obtain the temporal and spatial dependencies in the traffic flow data, including: The time dependency X obtained in step (1) of claim 3 tp , the spatial position information E obtained in step (3) of claim 4 pos And the high-order spatial dependency Z obtained in step (7) hsp , the splicing of the three is input into a feature fusion device (i.e., multi-layer perceptron) to obtain the spatiotemporal dependency Z in the traffic flow data. The calculation formula is as follows: Z=MLP([X tp |[E pos ||from hsp ])∈R P×N×C (21)。 6. The deep learning traffic flow prediction method based on time-aware hypergraph according to claim 5 is characterized in that: In step (5), based on the spatiotemporal dependency relationship obtained in step (4), using a predictor to derive a future traffic flow prediction value includes: Use the predictor on the time dimension of the spatiotemporal dependency Z to derive future traffic flow predictions The formula is described as follows: Among them, FCL(·) represents a fully connected layer, each of whose neurons will be connected to all neurons in the previous layer and has trainable parameters, and σ(·) is a nonlinear activation function that enables the model to better model complex relationships.

7. The deep learning traffic flow prediction method based on time-aware hypergraph according to claim 1 is characterized in that: In step (6), the model determined in step (5) is used for training and parameter optimization, and the application to traffic flow prediction includes: (1) Using mean absolute error as the loss function The formula is described as follows: in, represents the true value of traffic flow of the ith sensor at time t, represents the traffic flow prediction value of the i-th sensor at time t; (2) Using the adaptive moment estimation optimizer Adam, the optimization steps are as follows: 1) Calculate the loss function: Compare the model's prediction results with the true values ​​and calculate the value of the loss function; This step measures the performance of the model under the current parameters; 2) Calculate the gradient: The gradient of the loss function with respect to the model parameters is calculated through the back-propagation algorithm; the gradient indicates the rate of change of the loss function at the current parameter value, that is, the direction and magnitude of the parameter adjustment; 3) Update model parameters: Use the optimizer to update model parameters based on gradient information; the optimizer determines the specific adjustment method of the parameters based on the defined update rules and learning rate; the parameter update formula is expressed as: New parameter = old parameter - learning rate × gradient; 4) Repeated iteration: Repeat the above steps until the stopping condition is reached. By updating the parameters through multiple iterations, the optimizer will gradually adjust the model parameters so that the value of the loss function continues to decrease, thereby improving the performance of the model. (3) Hyperparameter tuning includes: 1) Selection of K value in KNN algorithm; 2) Choice of learning rate; 3) Batch size; 4) Number of iterations.

Citation Information

Patent Citations

  • Traffic flow prediction method based on space-time hypergraph neural network

    CN114944053A

  • Traffic prediction system and method based on time-space gating hypergraph convolutional network

    CN115905629A

  • Multi-view fusion space-time dynamic graph convolutional network urban traffic flow prediction method

    CN116935649A

  • Latent space model for road networks to predict time-varying traffic

    US20190180612A1

Cited By

  • Visual target detection method and system based on hypergraph calculation

    CN120543951A

  • A visual target detection method and system based on hypergraph computation

    CN120543951B

  • Traffic flow prediction method based on multi-scale dual hypergraph fusion

    CN120673587A

  • A Traffic Flow Prediction Method Based on Multi-Scale Dual Hypergraph Fusion

    CN120673587B

  • Traffic flow fundamental diagram construction and parameter estimation method fusing different time interval data

    CN121034081A