Traffic prediction method based on multi-scale multi-graph convolutional network

By combining multi-scale multi-graph convolutional networks with techniques such as kernel density estimation and diffuse causal convolution, the shortcomings in modeling spatial dependencies and temporal trends in traffic forecasting are addressed, resulting in more accurate traffic state predictions and resolving the problems of unbalanced and complex traffic flow distribution.

CN121545337APending Publication Date: 2026-02-17FUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410669902.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Existing traffic prediction models struggle to accurately capture spatial dependencies and temporal trends when faced with unbalanced traffic flow distribution and complex and diverse traffic flow patterns, leading to overfitting and inaccurate predictions.

Method used

A traffic prediction model is constructed by using a multi-scale multi-graph convolutional network, combining kernel density estimation, diffuse causal convolution, multi-head attention mechanism and adaptive adjacency matrix. The model captures the spatial correlation and temporal trend between road segments through frequency feature layer, multi-scale multi-graph convolutional layer and output layer.

Benefits of technology

It improves the accuracy and adaptability of traffic forecasting, reduces overfitting problems, comprehensively models spatial dependencies, enhances the interaction of spatiotemporal features at different time scales, and achieves more accurate traffic state prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121545337A_ABST
    Figure CN121545337A_ABST
Patent Text Reader

Abstract

The invention provides a traffic prediction method based on a multi-scale multi-graph convolutional network, and the method comprises a prediction model which comprises a frequency feature layer, a multi-scale multi-graph convolutional layer and an output layer. The prediction model is based on road section cross section speed data collected by an urban road network detector, extracts frequency characteristics of historical traffic data in combination with a kernel density estimation method, and assists in prediction. A diffusion causal convolutional network, a graph convolutional network and a multi-head attention mechanism are used for capturing and interacting multi-scale spatial-temporal characteristics, complex spatial association between road sections on an urban large-scale road network is accurately modeled, and a nonlinear trend in a time dimension is accurately perceived. By applying the technical scheme, road section traffic prediction on a large-scale road network can be realized, the contradiction between traffic supply and demand is relieved, a basis is provided for traffic management, and modernized, intelligent and precise decision support is provided for urban traffic congestion management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of deep learning and traffic state perception technology, and in particular to a traffic prediction method based on multi-scale multi-graph convolutional networks. Background Technology

[0002] Urban transportation systems are facing numerous management and coordination challenges that urgently need to be addressed. The emergence of intelligent transportation systems (ITS) alleviates this problem. Traffic forecasting, a branch of ITS, predicts future traffic conditions by extrapolating the trends of traffic state time series, thus providing a better data foundation for transportation departments to formulate strategies and offering route selection options for drivers, thereby reducing congestion and improving urban traffic. The comprehensive development of traffic data collection equipment and data application terminals, along with the continuous advancement of urban sensing technology, is the real reason for the rapid rise of ITS. Traffic big data provides a sufficient data foundation for ITS. Simultaneously, the increasing development of deep learning algorithms in artificial intelligence technology [8-10] provides algorithmic support for traffic forecasting.

[0003] Therefore, when faced with abundant and diverse traffic big data, how to effectively mine the vast amount of potential traffic travel characteristics and demand change information within this data using deep learning models to predict future traffic conditions on large-scale road networks has become a current research hotspot. However, traffic forecasting still faces two main challenges: firstly, uneven traffic flow distribution is a common characteristic of traffic flow, such as... Figure 1 As shown, the data is mainly concentrated in the [20-35] and [60-70] frequency bands. The linear shape in these concentrated segments is complex, which leads to overfitting during the learning phase and reduces the ability of deep learning networks to discriminate data.

[0004] Secondly, traffic flow patterns exhibit complex and diverse characteristics. For example... Figure 2 As shown, although congestion period G at node 10 and congestion period H at node 30 have similar levels of congestion, their durations are drastically different. This difference indicates that even with different congestion periods, periods G and H still exhibit similar traffic patterns. However, many models based on recurrent neural networks (RNNs) or time-attention mechanisms rely solely on spatiotemporal feature interactions within the same time frame when predicting future traffic conditions.

[0005] Finally, a major research trend lies in utilizing graph convolutional neural networks to capture the spatial characteristics of traffic states. However, in constructing adjacency matrices, researchers often focus only on the topological adjacency relationships of road segments within the road network, failing to fully consider important spatial correlation factors such as the potential correlation between nodes and the similarity of traffic state change patterns. This approach weakens the accuracy and completeness of modeling the spatial correlation features of urban road network traffic states to some extent. Consequently, the constructed predictive models are inadequate in describing spatiotemporal correlation features and struggle to fully reflect the dynamic evolution of actual traffic conditions. To further improve the predictive capabilities of these models, future research needs to delve deeper into and integrate these neglected spatial correlation factors. Summary of the Invention

[0006] In view of this, the purpose of this invention is to provide a traffic prediction method based on multi-scale multi-graph convolutional networks, which can realize traffic prediction on road segments of large-scale road networks, so as to alleviate the contradiction between traffic supply and demand and provide a basis for traffic management, thereby providing modern, intelligent and precise decision support for urban traffic congestion management.

[0007] To achieve the above objectives, the present invention adopts the following technical solution: a traffic prediction method based on multi-scale multi-graph convolutional networks, comprising a prediction model, wherein the prediction model includes a frequency feature layer, a multi-scale multi-graph convolutional layer, and an output layer; the prediction model is based on the cross-sectional speed data of road segments collected by urban road network detectors, and combines the kernel density estimation method to extract the frequency features of historical traffic data to assist in prediction; it employs diffuse causal convolutional networks, graph convolutional networks, and multi-head attention mechanisms to capture and interact with multi-scale spatiotemporal features, accurately model the complex spatial relationships between road segments on large-scale urban road networks, and accurately perceive nonlinear trends in the time dimension.

[0008] In a preferred embodiment, in the frequency feature layer, a kernel density estimation algorithm is used to provide complete traffic time series data X = [x1, x2, ..., x...]. t-1 ,x t ], where x i ∈[T max ,T min [i = 0, 1, ..., t]; F(x) is the probability density function of traffic flow; the real-time probability distribution function estimation formula based on kernel density estimation is as follows:

[0009]

[0010] At time t-1, f t-1 (x) is the historical probability distribution, while f t (x) is the probability distribution at the current time. Assume x t K(x) is the kernel density function.t ), h is the bandwidth, which determines the smoothness of the probability density, T max and T min These are the maximum and minimum values ​​of the traffic flow time series data X;

[0011] Each modal distribution of traffic flow data is expanded and contracted according to its probability distribution function, as shown in formula (3):

[0012]

[0013] Where T1 and T2 are thresholds reflecting the connection between two adjacent distributions, T max and T min These are the maximum and minimum values ​​of traffic flow time series data X; each speed value will generate a corresponding frequency embedding m; T1, T2, T are continuously updated and selected through real-time input. max and T min The process of obtaining the value of m involves first combining the input with historical data, then using kernel density estimation to obtain the real-time probability distribution function, and finally updating and obtaining T1, T2, and T. max and T min Finally, the velocity value is mapped to the m value through formula (3).

[0014] In a preferred embodiment, in a multi-scale multi-graph convolutional network, multiple spatiotemporal layers are stacked using multiple diffraction-causal convolutions with increasing diffraction factors to perceive spatiotemporal information at different time scales. In each spatiotemporal layer, causal diffraction is used to extract spatiotemporal features at different time scales, and a multi-graph convolutional model is used to capture the spatial correlation between nodes at different time scales. Finally, a temporal attention network is used to capture their temporal trends. Then, the output of each spatiotemporal layer is mapped to a high-dimensional space and fused through skip connections to complete the interaction between spatiotemporal features at multiple scales.

[0015] In a preferred embodiment, the diffractive causal convolutional layer utilizes dilated convolution to extract spatiotemporal features across multiple time scales and compress the temporal dimension; residual connections are introduced; and the dilated convolution and residual connections are generalized to Equations (4) and (5), as follows:

[0016]

[0017] Among them, X input ∈R N×T×d =X||m represents the concatenation of the model's initial input X and the frequency feature m; and It is a matrix with learnable parameters; It is the input of each spatiotemporal layer; Corresponding to the output of each dilated causal convolutional layer; variable T l Refers to the time dimension within each layer, while T L =1 indicates the time dimension in the last layer; d dil Represents the feature dimension, while and This represents a specific learnable parameter in our model; using the expansion factor d l We use tanh(·) as the activation function and σ(·) as the activation function. σ(·) is a sigmoid function that is responsible for removing redundant information. Crop(·) refers to performing a pruning operation to remove any extra time segments.

[0018] In a preferred embodiment, the spatial adjacency matrix is ​​created using the positional relationship between two detectors to characterize the spatial dependency between them; based on the spatial distance between the two detectors, a negative correlation function is constructed between the spatial distance between the detectors and the spatial dependency weight parameter using a negative exponential function; the spatial adjacency matrix is ​​represented as follows. Let represent the weight parameters between node i and node j, where the calculation formulas are shown in equations (5) and (6):

[0019]

[0020] in It is the square of the distance between node i and node j; It is the adjacency matrix of the control space. The hyperparameters of sparsity; Control the size of the matrix.

[0021] In a preferred embodiment, the Dynamic Time Warping (DTW) algorithm is given two time series P = (p1, p2, ..., p...). i ,…,p m ) and Q = (q1, q2, ..., q j ,…,q n The Dynamic Time Warping (DTW) algorithm is defined as follows:

[0022] γ(i,j)=d(p i ,q j )+min(γ(i-1,j),γ(i,j-1),γ(i-1,j-1))

[0023] Where γ(i,j) represents the shortest distance between subsequences, d(p i ,q j ) is node p i and node q jThe absolute distance between them; finally, γ(i,j) is the output of DTW(P,Q), which represents the similarity between two time series P and Q;

[0024] The Dynamic Time Warping (DTW) algorithm is used to define the time series similarity matrix. As shown in formulas (7) and (8):

[0025]

[0026] Where X i It is the time series of node i; X j It is the time series of node j; λ is a hyperparameter used to control the time series similarity matrix. Sparsity.

[0027] In a preferred embodiment, the adaptive matrix is ​​calculated from the trainable parameter matrix. During the model training process, the correlation weights between nodes are continuously optimized and adjusted, as shown in Equation (9).

[0028]

[0029] Where, E∈R 1×N Represents a trainable row vector (N represents the number of nodes in the dataset), E T It is the transpose of E. This represents an adaptive adjacency matrix.

[0030] In a preferred embodiment, the spatial adjacency matrix constructed above is... Time series similarity matrix Adaptive Adjacency Matrix It is applied in multi-graph convolutional networks to aggregate and update node information; the multi-graph convolutional layer is following the diffuse causal convolutional layer and is used to process the spatial dependencies of the multi-scale spatiotemporal features of nodes. That is, the multi-scale spatiotemporal features output by the diffuse causal convolutional layer are the input of the multi-graph convolutional layer. The specific formula is shown in formula (10):

[0031]

[0032] in, It is the output of the multi-graph convolutional layer in the Lth spatiotemporal layer, and its spatial adjacency matrix. Time series similarity matrix Adaptive Adjacency Matrix Represents three different adjacency matrices; Indicates the trainable parameters; N represents the number of road segments in the road network; T l-1 This represents the time dimension of the (l-1)th spatiotemporal layer; d gcn This represents the feature dimension of the graph convolutional layer.

[0033] In a preferred embodiment, the computation process of the multi-head temporal attention mechanism in each spatiotemporal layer is as follows: First, the output of the multi-graph convolutional layer is passed through three different fully connected layers in each head to generate a query Q, a key K, and a value V. Then, Q and K are multiplied by a dot product to generate a weight matrix, which is then weighted and summed to output the results of each head. Finally, the results of each head are concatenated and passed through a fully connected layer to output the result of the multi-head temporal attention layer. The specific formula is as follows:

[0034]

[0035]

[0036]

[0037]

[0038]

[0039] in, It is a learnable parameter matrix, where l represents the l-th spatiotemporal layer; The feature dimension is represented by h; the number of attention points is h. This represents the query, key, and value in the i-th attention head; It is the output of the multi-head spatiotemporal attention layer in the l-th spatiotemporal layer; It is a self-learning parameter matrix;

[0040] Skip connections are used to aggregate spatiotemporal features across multiple time scales; the skip connections map the spatiotemporal features at each time scale to a high-dimensional space, calculated as follows:

[0041]

[0042] in It is the output of the Lth layer skip connection; and It is a learnable parameter; d skip P represents the feature dimension. 0 =0.

[0043] In a preferred embodiment, the hidden state P of the velocity is obtained. L Then, two fully connected layers are used in the output layer to perform multi-step predictions on future data; the first fully connected layer changes the feature dimension of the model, increases the number of parameters, and enhances the model's predictive ability; the second fully connected layer is responsible for storing the hidden state P L The effect of mapping to the output space is calculated using the following formula:

[0044]

[0045] in, This indicates the prediction for the next time step ω. b output ∈R ω These are the learnable parameters of two fully connected layers; ReLU(·) is an activation function;

[0046] Given the true value Y∈R N×ω We choose Mean Absolute Error (MAE) as the training loss function for the model, and calculate it as follows:

[0047]

[0048] in, and Y i ∈R N×1 Let represent the predicted and true values ​​at the next i time steps, respectively; by using the mini-batch gradient descent algorithm, the loss function is minimized to update all learnable parameters of the proposed model.

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

[0050] (1) To address the problem of model overfitting to frequency bands in the data caused by uneven traffic flow distribution, this invention employs kernel density estimation to construct a real-time probability distribution function for speed. An equivalent transformation formula is then used to combine the real-time probability distribution function with the speed value to convert it into a feature representing the frequency of the speed value, thereby assisting the model in prediction. Through this frequency feature, the model can perceive the frequency band where the data is located. Compared to previous methods that only extrapolated future time series trends from the perspective of time series linearity, this method combining frequency and linearity can reduce the overfitting problem caused by the model overfitting to complex linearities in concentrated sections due to uneven data distribution.

[0051] (2) To ensure that the model can comprehensively and accurately capture spatial dependencies, this invention carefully designs three graph structures. First, based on the distance between road network detectors, we construct a functional relationship between spatial correlation weights and distance, and then create a spatial adjacency matrix. Second, based on the dynamic regularization algorithm, this invention constructs a time series similarity matrix between nodes by the similarity of the historical time series of nodes, and explores the correlation between road segments with similar traffic patterns globally. Finally, this invention uses the powerful data mining capabilities of deep learning algorithms to construct an adaptive adjacency matrix to perceive the potential spatiotemporal correlation between road segments, and then constructs a more comprehensive and complete spatial dependency between road segments.

[0052] (3) To capture the homogeneity of urban traffic patterns across different time scales and enhance the interaction between spatiotemporal features at different time scales, this invention employs a diffuse causal convolution stacked spatiotemporal layer to effectively capture diverse spatiotemporal signals at various time scales. Simultaneously, within each spatiotemporal layer, a multi-graph convolutional network and a multi-head attention mechanism are used to help the model perceive the spatial dependencies between nodes at different time scales and the temporal trends in the time series. Finally, skip connections are used to realize the interaction between spatiotemporal features at multiple time scales. This cross-timescale correlation modeling can effectively help the model perceive the spatiotemporal characteristics of road segments across different time spans, thereby enabling accurate prediction of future time series. Attached Figure Description

[0053] Figure 1 This is a schematic diagram of traffic speed distribution in the existing technology;

[0054] Figure 2 This is a schematic diagram illustrating the potential correlations between nodes across different time spans in existing technologies.

[0055] Figure 3 This is a schematic diagram of a multi-graph convolution model that integrates multi-scale spatiotemporal features according to a preferred embodiment of the present invention. Detailed Implementation

[0056] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0057] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0058] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this application; as used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise; furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.

[0059] refer to Figure 3The proposed model consists of three key sub-modules: a frequency feature layer, a multi-scale multi-graph convolutional layer, and an output layer. In the design of the frequency feature layer, to enhance the model's ability to recognize centralized data, a real-time probability distribution generator incorporating kernel density estimation methods is employed. This mechanism can acquire the probability distribution of the input data in real time, and then transform the velocity values ​​into frequency features through the frequency feature mapping layer combined with the real-time probability distribution, thus providing powerful assistance to the prediction process. Through this design, we aim to improve the model's prediction accuracy and adaptability to meet the application needs in complex data environments. The multi-scale multi-graph convolutional network involves stacking L spatiotemporal layers with increasing expansion factors to extract multi-scale spatiotemporal features across different time spans. Each spatiotemporal layer includes a multi-graph convolutional network and a multi-head temporal attention mechanism, designed to perceive the spatial dependencies between nodes and the temporal trends across different time spans. Three graph structures are used in the multi-graph convolutional network to model the correlations between nodes from multiple perspectives. Subsequently, skip convolution is applied to fuse the outputs of each spatiotemporal layer, promoting the interaction between spatiotemporal features across different time spans. Finally, in the output layer, we utilize two fully connected layers to map the hidden state to the output space. The invention will be further described in detail below with specific implementation steps and illustrations.

[0060] Frequency feature layer

[0061] Kernel density estimation is a nonparametric statistical method used to estimate unknown probability density functions. It smooths sample data using a kernel function, increasing the probability density near observed data points and decreasing it away from them. Kernel density estimation is not limited by the data distribution, can estimate multidimensional data, and does not require hypothesis testing. Free parameters of kernel density estimation include kernel type and kernel bandwidth, which need to be selected and adjusted using methods such as cross-validation. Ultimately, the kernel density estimation algorithm provides an estimate of the probability density function, offering strong support for data analysis and statistical inference.

[0062] To efficiently generate probability distribution functions, this invention utilizes a kernel density estimation algorithm. This algorithm can be used to estimate the real-time probability distribution function of traffic conditions with high accuracy, while effectively reducing computational complexity. The specific calculation is as follows: given complete traffic time series data X = [x1, x2, ..., x...]... t-1 ,x t ], where x i ∈[T max ,T min [i = 0, 1, ..., t]. F(x) is the probability density function of traffic flow. The real-time probability distribution function estimation formula based on kernel density estimation is as follows:

[0063]

[0064]

[0065] At time t-1, f t-1 (x) is the historical probability distribution, while f t (x) is the probability distribution at the current time. Assume x t K(x) is the kernel density function. t ), where h is the bandwidth, which determines the smoothness of the probability density, and T max and T min These are the maximum and minimum values ​​of the traffic flow time series data X.

[0066] To alleviate the overfitting problem caused by the uneven distribution of traffic, a novel frequency feature mapping layer transforms speed data values ​​into frequency features through a real-time probability distribution function, providing the model with frequency information of speed to assist in prediction. Typically, as a multimodal distribution, each modal distribution of traffic flow data can be expanded and contracted according to its probability distribution function, as shown in formula (3):

[0067]

[0068] Where T1 and T2 are thresholds reflecting the connection between two adjacent distributions, T max and T min These are the maximum and minimum values ​​of the traffic flow time series data X. Clearly, through such an equivalent mapping process, each speed value will generate a corresponding frequency embedding m. Typically, T1, T2, and T are continuously updated and selected based on real-time input. max and T min Therefore, the process of obtaining the value of m involves first combining the input with historical data, then obtaining the real-time probability distribution function using the kernel density estimation method, and finally updating and obtaining T1, T2, and T... max and T min Finally, the velocity value is mapped to the m value through formula (3).

[0069] Multi-scale multi-graph convolutional networks

[0070] To fully perceive the complex spatiotemporal dependencies between time series and achieve the interaction of spatiotemporal features at different time scales, this module utilizes multiple stacked spatiotemporal layers with increasing diffusion factors and diffusing causal convolutions to perceive spatiotemporal information at different time scales. Within each spatiotemporal layer, causal diffusing convolutions are used to extract spatiotemporal features at different time scales, and a multi-graph convolutional model is employed to capture the spatial correlations between nodes at different time scales. Finally, a temporal attention network is used to capture their temporal trends. The outputs of each spatiotemporal layer are then mapped to a high-dimensional space and fused through skip connections to complete the interaction between spatiotemporal features at multiple scales. The following sections will detail each component...

[0071] 1. Diffusion-causal convolutional layer

[0072] In this embodiment, dilated convolution is used to extract spatiotemporal features across multiple time scales and compress the temporal dimension. Furthermore, residual connections are introduced to mitigate information loss and gradient vanishing problems caused by deep networks. The dilated convolution and residual connections are generalized to Equations (4) and (5), as follows:

[0073]

[0074] Among them, X input ∈R N×T×d =X||m represents the concatenation of the initial input of the model and the frequency features, where N represents the number of road segments in the road network, T represents the length of the input time step, and d represents the feature dimension of the input; and It is a matrix with learnable parameters. It is the input of each spatiotemporal layer. This corresponds to the output of each dilated causal convolutional layer. Variable T l Refers to the time dimension within each layer, while T L =1 indicates the time dimension in the last layer. Furthermore, d dil Represents the feature dimension, while and This represents a specific learnable parameter in our model. Furthermore, we use an expansion factor (determined by d). l The expression (represented by tanh(·)) is used as the activation function, and σ(·) is a sigmoid function responsible for removing redundant information. Finally, Crop(·) refers to performing a pruning operation to remove any unnecessary time segments.

[0075] 2. Multi-graph structure construction

[0076] Spatial adjacency matrix based on detector distance

[0077] Traffic flows detected by detectors that are close to each other exhibit similar traffic patterns because they share similar geographical environments and travel distributions, and the transmission of changes in traffic characteristics between them is instantaneous. This leads to a strong correlation between the time series of traffic states detected by detectors located close to each other. Therefore, using the positional relationship between two detectors to create a spatial adjacency matrix can effectively characterize the spatial dependency between the two detectors. This invention uses the spatial distance between two detectors as a basis and constructs a negative correlation function between the spatial distance between detectors and the spatial dependency weight parameter through a negative exponential function. The spatial adjacency matrix can be represented as follows: The weight parameter between node i and node j (decreases as the distance increases) is represented by equations (5) and (6):

[0078]

[0079] in It is the square of the distance between node i and node j; It is the control space matrix The hyperparameters of sparsity. It is a hyperparameter that controls the size of the parameter value.

[0080] Time series similarity matrix based on dynamic time warping algorithm

[0081] Dynamic Time Warping (DTW) is an algorithm that solves the matching problem when time series have different lengths or speeds on the time axis, thereby quantifying the similarity between the time series. DTW uses dynamic programming to find the optimal matching path between two time series, maximizing their similarity. The core idea of ​​the algorithm is to calculate the distance between each point in the two series and find the optimal matching path while preserving the chronological order, ultimately quantifying the similarity between the two time series. Specifically, given two time series P = (p1, p2, ..., p...),... i ,…,p m ) and Q = (q1, q2, ..., q j ,…,q n The DTW algorithm can be defined as follows:

[0082] γ(i,j)=d(p i ,q j )+min(γ(i-1,j),γ(i,j-1),γ(i-1,j-1))

[0083] Where γ(i,j) represents the shortest distance between subsequences, d(pi ,q j ) is node p i and node q j The absolute distance between them. Finally, γ(i,j) is the output of DTW(P,Q), which represents the similarity between two time series P and Q.

[0084] Therefore, we apply the Dynamic Time Warping (DTW) algorithm to define the time series similarity matrix. As shown in formulas (7) and (8):

[0085]

[0086] Where X i It is the time series of node i; X j is the time series of node j; λ is a hyperparameter (set to 0.2 in this invention) used to control the matrix. Sparsity.

[0087] 3. Data-driven adaptive adjacency matrix

[0088] The data-driven adaptive adjacency matrix adaptively mines the potential correlations between nodes through the self-learning capability of the deep learning model. The adaptive matrix is ​​calculated from the trainable parameter matrix and can be continuously optimized and adjusted during the training process of the model to adjust the correlation weights between nodes, as shown in formula (9).

[0089]

[0090] Where, E∈R 1×N Represents a trainable row vector (N represents the number of nodes in the dataset), E T It is the transpose of E.

[0091] 3. Multi-graph convolutional layers based on graph neural networks

[0092] This invention utilizes the three graph structures and spatial adjacency matrices constructed above. Time series similarity matrix Adaptive Adjacency Matrix It is applied in multi-graph convolutional networks to aggregate and update node information. The multi-graph convolutional layer follows the diffuse causal convolutional layer and is used to process the spatial dependencies of the multi-scale spatiotemporal features of nodes. That is, the multi-scale spatiotemporal features output by the diffuse causal convolutional layer are the input of the multi-graph convolutional layer. The specific formula is shown in formula (10):

[0093]

[0094] in, It is the output of the multi-graph convolutional layer in the Lth spatiotemporal layer, and its spatial adjacency matrix. Time series similarity matrix Adaptive Adjacency Matrix This represents three different adjacency matrices. This represents the trainable parameters. N represents the number of road segments in the road network, and T represents the number of road segments in the network. l-1 This represents the time dimension of the l-1 spacetime layer, d gcn This represents the feature dimension in the graph layer.

[0095] 4. Multi-head time attention layer

[0096] The temporal trends of spatiotemporal features differ across time scales. To model the evolution of traffic speed information at different time scales, it is necessary to compare the similarity of time points at different time scales and aggregate them according to the generated weights. The computation process of the multi-head temporal attention mechanism in each spatiotemporal layer involves first passing the output of the multi-graph convolutional layer through three different fully connected layers in each head to generate a query Q, key K, and value V. Then, Q and K are multiplied by a dot product to generate a weight matrix, which is then summed with weights to output the results of each head. Finally, the results of each head are concatenated and passed through a fully connected layer to output the result of the multi-head temporal attention layer. The specific formula is as follows:

[0097]

[0098] in, It is a learnable parameter matrix, where l represents the l-th spatiotemporal layer; The feature dimension is represented by h; the number of attention points is h. This represents the query, key, and value in the i-th attention head; It is the output of the multi-head spatiotemporal attention layer in the l-th spatiotemporal layer; It is a self-learning parameter matrix.

[0099] 5. Multi-head time attention layer

[0100] In this embodiment, this skip connection is used to aggregate spatiotemporal features across multiple time scales, effectively mitigating the overlap problem between information at different time scales caused by residual connections. The skip connection maps the spatiotemporal features at each time scale to a high-dimensional space, improving the model's data mining capabilities for spatiotemporal features across multiple time scales, thereby enhancing the model's representational power. This submodule can be computed as follows:

[0101]

[0102] in It is the output of the Lth layer skip connection; and It is a learnable parameter. d skip P represents the feature dimension. 0 =0.

[0103] Output layer and loss function

[0104] Output layer

[0105] In the hidden state P where velocity is obtained L Subsequently, this invention uses two fully connected layers in the output layer to perform multi-step prediction of future data. The first fully connected layer changes the feature dimension of the model, increases the number of parameters, and enhances the model's predictive ability. The second fully connected layer is responsible for storing the hidden state P L The effect of mapping to the output space is calculated using the following formula:

[0106]

[0107] in, This indicates the prediction for the next time step ω. b output ∈R ω These are the learnable parameters of two fully connected layers; ReLU(·) is an activation function.

[0108] loss function

[0109] Given the true value Y∈R N×ω We choose the mean absolute error (MAE) as the training loss function for the model, and calculate it as follows:

[0110]

[0111] in, and Y i ∈R N×1 Let represent the predicted and true values ​​at the next i time steps, respectively. We minimize the loss function using the mini-batch gradient descent algorithm to update all learnable parameters of the proposed model.

Claims

1. A traffic prediction method based on a multi-scale multi-graph convolutional network, characterized in that The prediction model comprises a frequency feature layer, a multi-scale multi-graph convolution layer and an output layer; the prediction model is based on road section cross-section speed data collected by a city road network detector, extracts frequency features of historical traffic data in combination with a kernel density estimation method, and assists in prediction; The diffusion causal convolution network, the graph convolution network and the multi-head attention mechanism are used to capture and interact multi-scale spatio-temporal features, accurately model complex spatial correlations between road sections on a large-scale city road network and accurately perceive nonlinear trends in the time dimension.

2. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 1, characterized in that, In the frequency feature layer, the kernel density estimation algorithm is used to provide complete traffic time series data X = [x1, x2, ..., x]. t-1 ,x t ], where x i ∈[T max ,T min [i = 0, 1, ..., t]; F(x) is the probability density function of traffic flow; the real-time probability distribution function estimation formula based on kernel density estimation is as follows: At time t - 1, f t-1 (x) is the historical probability distribution, and f t (x) is the current time probability distribution, assuming x t is the kernel density function K(xt), h is the bandwidth, which determines the degree of smoothing of the probability density, T max and T min are the maximum and minimum values of the traffic flow time series data X; Each modal distribution of traffic flow data is expanded and contracted according to its probability distribution function, as shown in equation (3): where T1 and T2 are the threshold values reflecting the connection between two adjacent distributions, T max and T min are the maximum and minimum values of the traffic flow time series data X; each speed value will generate a corresponding frequency embedding m; T1, T2, T max and T min are constantly updated by real-time input; the process of obtaining m value is to combine the input with the historical data and then obtain the real-time probability distribution function according to the kernel density estimation method, and update T1, T2, T max and T min , and finally the speed value is mapped to the m value through formula (3).

3. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 1, characterized in that, In the multi-scale multi-graph convolution network, multiple diffusion causal convolution stacks with increasing diffusion factors are used to stack multi-scale spatio-temporal layers to perceive spatio-temporal information at different time scales; in each spatio-temporal layer, causal dilation convolution is used to extract spatio-temporal features at different time scales, and a multi-graph convolution model is used to capture spatial correlations between nodes at different time scales, and finally a time attention network is used to capture their time trends; then the output of each spatio-temporal layer is mapped to a high-dimensional space and fused through a skip connection to complete the interaction between spatio-temporal features at multiple scales.

4. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 3, characterized in that, In the diffusion causal convolution layer, dilation convolution is used to extract spatio-temporal features at multiple time scales and compress the time dimension; a residual connection is introduced; the dilation convolution and the residual connection are generalized to equations (4) and (5) as follows: where X input ∈ R N×T×d = X||m represents the concatenation of the initial input X of the model with the frequency feature m, where N represents the number of road segments in the road network, T represents the length of the input time step, and d represents the input feature dimension; and are matrices with learnable parameters; is the input of each spatio-temporal layer; corresponds to the output of each dilated causal convolutional layer; variable T l refers to the time dimension within each layer, while T L = 1 indicates the time dimension in the last layer; d dil represents the feature dimension, and and represent specific learnable parameters in our model; using a dilation factor d l , tanh(·) as the activation function, and σ(·), which is a sigmoid function responsible for removing redundant information; Crop(·) refers to the cropping operation to remove any excess time segments.

5. The traffic prediction method based on multi-scale multi-graph convolutional network according to claim 4, characterized in that, The spatial adjacency matrix is created using the positional relationship between the two detectors to represent the spatial dependence relationship between the two detectors; Based on the spatial distance between two detectors, a negative exponential function is used to construct a negative correlation function between the spatial distance between the detectors and the spatial dependence weight parameter; the spatial adjacency matrix is represented as The weight parameter between node i and node j is represented as Wij, and the calculation formula is shown in formula (5) and formula (6): wherein is the square of the distance between node i and node j; is the control space adjacency matrix hyperparameter of sparsity; is a hyperparameter of control parameter value size.

6. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 5, characterized in that, The dynamic time warping algorithm DTW is defined for two time series P = (p1, p2,..., pn) and Q = (q1, q2,..., qn) as follows: i DTW(P, Q) = min{DTW(P, Q, 1, 1)} m where j DTW(P, Q, i, j) = min{DTW(P, Q, i + 1, j) + d(pi, qj), DTW(P, Q, i, j + 1) + d(pi, qj)} n and d(pi, qj) is the distance between pi and qj. γ(i,j) = d(p i , q j ) + min(γ(i-1,j), γ(i,j-1), γ(i-1,j-1)) where γ(i,j) represents the shortest distance between subsequences, d(p i ,q j ) is the absolute distance between node p i and node q j ; finally, γ(i,j) is the output result of DTW(P,Q), which represents the similarity of two time series P and Q; A dynamic time warping algorithm (DTW) is applied to define a time series similarity matrix As shown in equations (7), (8): where X i is the time series of node i; X j is the time series of node j; and λ is a hyperparameter that controls the sparsity of the time series similarity matrix .

7. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 6, characterized in that, The adaptive matrix is calculated by a trainable parameter matrix, and in the training process of the model, the correlation weight between nodes is constantly optimized and adjusted, as shown in equation (9) where E ∈ R 1×N represents a trainable row vector (N represents the number of nodes of the data set), E T is the transpose of E, represents an adaptive adjacency matrix.

8. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 7, characterized in that, The spatial adjacency matrix constructed above Time series similarity matrix Adaptive adjacency matrix In the multi-graph convolution network, it is used for aggregating and updating node information. The multi-graph convolution layer is connected after the diffusion causal convolution layer and is used for processing the spatial dependence of the multi-scale spatio-temporal features, that is, the multi-scale spatio-temporal features output by the diffusion causal convolution layer are the input of the multi-graph convolution layer. The specific formula is shown in formula (10): wherein, is the output of the multi-graph convolutional layer in the Lth spatio-temporal layer, the spatial adjacency matrix is the temporal similarity matrix is the adaptive adjacency matrix represent three different adjacency matrices; denotes trainable parameters; N represents the number of road segments in the road network, T l-1 represents the temporal dimension of the l-1th spatio-temporal layer, d gcn represents the feature dimension in the graph convolutional layer.

9. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 8, characterized in that, The calculation process of the multi-head time attention mechanism in each spatio-temporal layer is to pass the output of the multi-graph convolution layer through three different fully connected layers in each head to generate queries Q, keys K and values V, then perform dot product on Q and K to generate a weight matrix and weighted sum to output the results of each head; finally, the results of each head are spliced and passed through a fully connected layer to output the results of the multi-head time attention layer; the specific formula is as follows: wherein, is a learnable parameter matrix, l denotes the l-th spatio-temporal layer; denotes the feature dimension; h is the number of attentions; denotes the query, key and value in the i-th attention head; is the output of the multi-head spatio-temporal attention layer in the l-th spatio-temporal layer; is a self-learning parameter matrix; The skip connection is used to aggregate spatio-temporal features at multiple time scales; the skip connection maps spatio-temporal features at each time scale to a high-dimensional space, as shown in the following calculation: wherein is the output of the Lth layer skip connection; and are learnable parameters; d skip denotes the feature dimension, P 0 = 0.

10. The traffic prediction method based on a multi-scale multi-graph convolutional network according to claim 1, characterized in that, The hidden state P of the velocity is obtained L After that, two fully connected layers are used at the output layer to make multi-step predictions of the future data; The first fully connected layer changes the feature dimension of the model, enhances the parameter quantity, and strengthens the prediction ability of the model. The second fully connected layer undertakes the role of mapping the hidden state P L to the output space, and the specific calculation formula is as follows: wherein, denotes the prediction for the next ω time step; b output ∈R ω are the learnable parameters of two fully connected layers; Relu(·) is an activation function; Given the true value Y ∈ R N×ω We choose the mean absolute error MAE as the training loss function of the model, which is calculated as follows: where, and Y i ∈ R N×1 represent the predicted and true values at future i time steps, respectively; by using a mini-batch gradient descent algorithm, the loss function is minimized to update all the learnable parameters of the proposed model.