A Traffic Flow Prediction Method Based on Spatiotemporal Data Embedding

By using a spatiotemporal data embedding method, the STD2vec model and graph convolutional neural network are employed to extract the dynamic correlation of traffic flow. This solves the problem that existing models cannot accurately extract the spatial features of traffic networks and the changes in sensor correlation over time, thus achieving more accurate and stable traffic flow prediction.

CN114169649BActive Publication Date: 2026-05-26ZHEJIANG UNIV OF FINANCE & ECONOMICS
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV OF FINANCE & ECONOMICS
Filing Date
2022-01-17
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing deep learning models cannot accurately extract the complex spatial features of traffic networks in traffic flow prediction, nor can they effectively reflect the correlation between sensors over time.

Method used

A spatiotemporal data embedding-based approach is adopted. Traffic flow data is converted into a vector space using the STD2vec model to generate a dynamic correlation graph. A graph convolutional neural network is then used to extract the dynamic correlation between electronic police devices, construct the dynamic correlation graph, and make predictions.

Benefits of technology

It achieves accurate and stable prediction of traffic flow, improves the prediction accuracy and stability of the model in different time periods, and is superior to existing models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114169649B_ABST
    Figure CN114169649B_ABST
Patent Text Reader

Abstract

This invention discloses a traffic flow prediction method based on spatiotemporal data embedding, comprising: acquiring historical traffic flow data; performing spatiotemporal data embedding based on the historical traffic flow data, including: interval representation of traffic flow: determining the interval to which each traffic flow belongs and converting it into a corresponding traffic flow interval; generating traffic flow vectors: taking all traffic flow intervals as input data, and using a Word2vec model to convert the input data into embedded data, i.e., the corresponding traffic flow vectors; extracting time features from the traffic flow vectors to obtain a node feature matrix, and extracting the correlation between traffic enforcement devices to obtain a dynamic correlation graph; inputting the node feature matrix and the dynamic correlation graph into a graph convolutional neural network to obtain the prediction result output by the graph convolutional neural network. This method can quantify and measure the implicit correlation between traffic flows, extract high-level time features and dynamic correlation graphs for effective modeling, and obtain accurate and stable traffic flow predictions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of traffic flow prediction technology, specifically relating to a traffic flow prediction method based on spatiotemporal data embedding. Background Technology

[0002] Traffic flow forecasting is a typical task in spatiotemporal forecasting, aiming to predict future traffic flow based on historical traffic patterns. Traffic flow forecasting not only helps managers guide traffic in a timely manner by predicting potential road congestion, but also helps travelers plan ahead or adjust their routes. Therefore, achieving accurate and stable traffic flow forecasting is imperative. However, due to the complex spatiotemporal dependencies of traffic flow, obtaining accurate traffic flow forecast results remains a significant challenge.

[0003] Deep learning has been widely applied across various fields because it can combine simple yet nonlinear modules to generate multi-layered deep representations of raw input data. Recently, advanced deep learning models based on Convolutional Neural Networks (CNNs) or Graph Convolutional Neural Networks (GCNs) have been successfully applied to traffic prediction. Specifically, CNN-based models treat the traffic network as an image and extract spatial features in Euclidean space (such as a two-dimensional matrix or a regular grid). GCN-based models treat the traffic network as a graph structure, where nodes represent sensors (electronic police devices), weights represent the correlations between sensors, and spatial features are extracted by encoding the non-Euclidean topology of the traffic network. Compared to image-based CNNs, GCNs can better utilize the inherent topology of the traffic network and the heterogeneous correlations between sensors, thus achieving better prediction results.

[0004] However, the simple images in CNN models cannot accurately represent the true structure of traffic networks because traffic networks have irregular non-Euclidean topologies. Therefore, traditional CNNs cannot effectively extract the complex spatial features of traffic networks. Secondly, although most existing GCN-based research achieves good prediction results, they only construct a static graph with fixed weights, failing to accurately reflect the changing correlations between sensors over time. Therefore, existing research on deep learning-based traffic flow prediction still has some shortcomings. Summary of the Invention

[0005] The purpose of this application is to provide a traffic flow prediction method based on spatiotemporal data embedding to achieve accurate and stable traffic flow prediction.

[0006] To achieve the above objectives, the technical solution adopted in this application is as follows:

[0007] A traffic flow prediction method based on spatiotemporal data embedding includes:

[0008] Step 1: Obtain historical traffic flow data: Collect traffic flow data from N electronic traffic enforcement devices at M time points as historical traffic flow data;

[0009] Step 2: Perform spatiotemporal data embedding based on historical traffic flow data, including:

[0010] Step 2.1, Representation of traffic flow by interval:

[0011] Step 2.1.1: Take the maximum and minimum traffic flow values ​​from historical traffic flow data as the upper and lower limits of the traffic flow range, and divide the traffic flow range into P equal intervals, denoted by D. i Represents the i-th interval, 1≤i≤P;

[0012] Step 2.1.2: Determine the interval to which each traffic flow belongs in the historical traffic flow data, and represent each traffic flow as the interval symbol to which it belongs to, so as to convert it into the corresponding traffic flow interval;

[0013] Step 2.2, Generation of traffic flow vector:

[0014] Step 2.2.1: Take all traffic flow intervals within a preset time step from the historical traffic flow data as input data, denoted as... Where T represents the time step, the Word2vec model is used to process the input data. Convert to embedded data Where Z represents the embedding dimension of the traffic flow vector, which yields the corresponding traffic flow vector;

[0015] Step 3: Extract time features from the traffic flow vector obtained after embedding spatiotemporal data to obtain the node feature matrix;

[0016] Step 4: Extract the correlation between electronic police devices based on the traffic flow vector obtained after embedding spatiotemporal data to obtain a dynamic correlation graph;

[0017] Step 5: Input the node feature matrix and dynamic association graph into the graph convolutional neural network (GCN) to obtain the prediction result output by the GCN. The prediction result is the traffic flow of all electronic police devices at the next T′ time points.

[0018] Several alternative methods are provided below, but they are not intended as additional limitations on the overall solution above. They are merely further additions or optimizations. Provided there are no technical or logical contradictions, each alternative method can be combined individually with respect to the overall solution above, or multiple alternative methods can be combined with each other.

[0019] Preferably, the interval D i The lower bound of VR i,l and the upper realm VR i,u The calculation is as follows:

[0020]

[0021]

[0022] In the formula, vr min and VR max These represent the lower and upper limits of the traffic flow range, respectively.

[0023] Preferably, the step of extracting time features from the traffic flow vector obtained after spatiotemporal data embedding to obtain the node feature matrix includes:

[0024] Step 3.1: Use different electronic alarm devices to process the embedded data. The process involves partitioning the matrix into N embedding matrices.

[0025] Step 3.2: Select a filter bank containing filters with heights H1, H2, ..., H. G There are G different heights, and each height has R filters;

[0026] Step 3.3: Use filters of different heights to extract time features from each embedding matrix to obtain multiple feature maps. Concatenate and expand all feature maps to obtain high-level time features. Where LT represents the length of the time feature;

[0027] Step 3.4: Concatenate all the high-level temporal features corresponding to the embedding matrices to obtain the node feature matrix.

[0028] Preferably, the step of extracting temporal features from each embedding matrix using filters of different heights to obtain multiple feature maps includes:

[0029] Step 3.3.1: Select height H g R filters, g = 1, 2, ..., G, for the nth embedding matrix Perform time feature extraction, n = 1, 2, ..., N, and take the embedding matrix W. n The embedding matrix W obtained from the elements of row d to row e is n submatrix

[0030] Step 3.3.2: Set the filter width to the embedding dimension Z of the traffic flow vector, then the height is H. g The filter can be expressed as

[0031] Step 3.3.3, Pairing sub-matrix Apply one of its filters respectively To obtain the corresponding feature map FM, the following formula is applied:

[0032] fm s =f(θ⊙W) n [s:s+H g -1]+b s ),s=1,2,…,TH g +1

[0033]

[0034] In the formula, fm s Let f(·) represent the s-th component of the feature map FM, f(·) represent the activation function, ⊙ represent the dot product between the submatrix and the filter, and b s This indicates the bias term.

[0035] Preferably, the dynamic correlation graph obtained by extracting the correlation between electronic police devices based on the traffic flow vector obtained after embedding spatiotemporal data includes:

[0036] Step 4.1: Calculate the average traffic flow vector of the electronic traffic enforcement equipment:

[0037]

[0038] In the formula, This represents the average traffic flow vector of the x-th electronic traffic enforcement device within time step T; T represents the time step. This represents the t-th traffic flow vector of the x-th electronic police device within time step T;

[0039] Step 4.2: Calculate the similarity between the x-th and y-th electronic police devices:

[0040]

[0041] In the formula, Sim(x,y) represents the similarity between the x-th and y-th electronic alarm devices, where y = 1, 2, ..., N. and These represent the average traffic flow vectors respectively. and The z-th component;

[0042] Step 4.3: Calculate the distance Dis between the x-th and y-th electronic alarm devices. x,y ;

[0043] Step 4.4: Obtain dynamic correlation based on the similarity and distance between the x-th and y-th electronic police devices:

[0044]

[0045] In the formula, A x,y The dynamic correlation between the x-th and y-th electronic alarm devices is represented by α and β, where α and β represent weighting coefficients; σ1 represents the standard deviation of similarity; σ2 represents the standard deviation of distance; and ε represents the threshold.

[0046] Step 4.5: Obtain the dynamic association graph, which is a combination of weighted adjacency matrices A calculated at different time intervals. The time span of the time intervals corresponds to the time step. The weighted adjacency matrix A is a combination of weighted adjacency matrices A... x,y It is an N×N dimensional matrix with elements.

[0047] The traffic flow prediction method based on spatiotemporal data embedding provided in this application maps the original traffic flow data into a vector space and transforms each traffic flow data point into a corresponding vector representation to quantify and measure the implicit correlation between traffic flows. Furthermore, it fully utilizes the correlation information contained in the traffic flow vectors to obtain high-level temporal features and generates different dynamic correlation graphs for different time periods, thereby effectively modeling the dynamic correlation between traffic enforcement devices and achieving deep extraction of non-Euclidean spatial features to obtain accurate and stable traffic flow prediction results. Attached Figure Description

[0048] Figure 1 This is a flowchart of the traffic flow prediction method based on spatiotemporal data embedding according to this application;

[0049] Figure 2 This is a flowchart illustrating the interval representation of traffic flow in this application;

[0050] Figure 3 This is a flowchart illustrating the extraction of time features in this application;

[0051] Figure 4 This is a schematic diagram showing the prediction errors of the CLTFP, GCN, STGCN, and STDE-DGCN models over 24 hours in the experiments of this application. Detailed Implementation

[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] Unless otherwise defined, 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 belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application.

[0054] In one embodiment, this embodiment addresses the fact that most existing studies neglect the implicit correlations between traffic flows, making it difficult to effectively extract deep spatiotemporal dependency features. Furthermore, most studies merely construct a static graph with fixed weights to represent the correlations between sensors, ignoring the fact that the correlations between traffic enforcement devices change over time. Therefore, this embodiment proposes a traffic flow prediction method based on spatiotemporal data embedding.

[0055] Traffic flow forecasting aims to predict future traffic flow based on historical traffic flow data observed in a traffic network. To formally represent the traffic flow forecasting problem, this embodiment first defines some key concepts:

[0056] Definition 1: Traffic network graph. A weighted undirected graph G = (V, E, A) is used to represent a traffic network, where V represents a set of graph nodes and E represents a set of edges, indicating the connectivity between sensors. This represents a weighted adjacency matrix, indicating the correlation between sensors.

[0057] Definition 2: Characteristic Matrix. The traffic flow observed on graph G is represented by the characteristic matrix. This indicates that R represents the number of features contained in each node. Specifically, It is used to represent the characteristic matrix at time t.

[0058] Therefore, according to the above definition, the traffic prediction problem can be regarded as: learning the mapping function F based on the traffic network graph G and the feature matrix X, and predicting the traffic flow of all sensors at the next T′ time using formula (1).

[0059] [Y t+1 ,Y t+2 ,…,Y t+T′ ] = F(G; [X t-T+1 ,X t-T+2 ,…,X t (1)

[0060] Where T represents the sequence length of the historical time period, i.e., the time step. This represents the traffic flow predicted by the model at time t+1 from all sensors.

[0061] Specifically, such as Figure 1As shown, the traffic flow prediction method based on spatiotemporal data embedding in this embodiment includes the following steps:

[0062] Step 1: Obtain historical traffic flow data: Collect traffic flow data from N electronic traffic enforcement devices at M time points as historical traffic flow data.

[0063] Step 2: Perform spatiotemporal data embedding based on historical traffic flow data.

[0064] In spatiotemporal data embedding, the value of each traffic flow is first represented in the form of intervals, and an STD2vec method is proposed to generate a vector space containing a series of traffic flow vectors.

[0065] Step 2.1, Representation of traffic flow intervals.

[0066] Because some observed traffic flow values ​​occur with low frequency, this not only incurs high computational costs but also reduces the quality of the embedded traffic flow vector. Therefore, to reduce the complexity of the embedding representation and obtain high-quality traffic flow vectors, this embodiment groups traffic flow values ​​with similar frequencies together and represents them using a unified interval notation. For example... Figure 2 As shown, the specific steps include:

[0067] Step 2.1.1: Take the maximum and minimum traffic flow values ​​from historical traffic flow data as the upper and lower limits of the traffic flow range, and divide the traffic flow range into P equal intervals, denoted by D. i Represents the i-th interval, 1≤i≤P, where interval D i The lower bound of VR i,l and the upper realm VR i,u The calculation is as follows:

[0068]

[0069]

[0070] In the formula, vr min and VR max These represent the lower and upper limits of the traffic flow range, respectively.

[0071] Step 2.1.2: Determine the interval to which each traffic flow belongs in the historical traffic flow data, and represent each traffic flow as the interval symbol to which it belongs to, so as to convert it into the corresponding traffic flow interval.

[0072] Step 2.2: Generation of traffic flow vector.

[0073] Step 2.2.1: Take all traffic flow intervals within a preset time step from the historical traffic flow data as input data, denoted as... Where T represents the time step, the Word2vec model is used to process the input data. Convert to embedded data Where Z represents the embedding dimension of the traffic flow vector, which yields the corresponding traffic flow vector.

[0074] A document contains a series of words, while a sensor contains a series of traffic flow intervals at different historical time points. Based on this analogy, the STD2vec method in this embodiment treats each traffic flow interval at a given time point as a word and each sensor containing a traffic flow interval as a document. Then, the STD2vec method uses a Word2vec model to generate a vector space containing the associated information of the traffic flow intervals. Finally, based on the generated vector space, each traffic flow interval is converted into a corresponding traffic flow vector. The vector space generated in the spatiotemporal data embedding transforms the input data from two dimensions (i.e., sensor and time step) to three dimensions (i.e., sensor, time step, and vector dimension). If data is acquired every 5 minutes, a day contains 288 time points, i.e., M = 288. The time step can be determined according to actual needs, such as 12.

[0075] The Word2vec model is one of the most efficient methods for converting words into word vectors. It generates an embedding space where semantically similar words are grouped close together, and then learns the vector representations of each word. Word2vec can be implemented using two different models: the CBOW model and the Skip-Gram model. This embodiment uses the Skip-Gram model because it typically exhibits better performance when sufficient training data is available.

[0076] After obtaining traffic flow vectors, the correlation between two traffic flow vectors can be calculated using their vectors. Furthermore, the high correlation between two traffic flow vectors can be illustrated by analogy to the high correlation between two word vectors. Specifically, two highly correlated word vectors refer to two words that frequently appear adjacently in a document, or words surrounding them that are highly correlated. Similarly, the high correlation between two traffic flow vectors can be explained in two ways. The first is that the two traffic flows typically appear adjacent along the time dimension, indicating a short-term temporal correlation. The second is that the time span between the two traffic flows is relatively large, but the traffic flows surrounding them are highly correlated along the time dimension, thus making the two traffic flows highly correlated, indicating a long-term temporal correlation.

[0077] Therefore, compared with the original traffic flow, the traffic flow vector generated by the STD2vec method in this embodiment contains both short-term correlation and long-term temporal correlation, which is beneficial for deep learning models to further extract deep spatiotemporal dependency features.

[0078] Step 3: Extract time features from the traffic flow vector obtained after embedding spatiotemporal data to obtain the node feature matrix.

[0079] The example of extracting time features includes the following steps:

[0080] Step 3.1: Use different electronic alarm devices to process the embedded data. The process involves partitioning the matrix into N embedding matrices.

[0081] Step 3.2: Select a filter bank containing filters with heights H1, H2, ..., H. G There are G different heights, and each height has R filters;

[0082] Step 3.3: Use filters of different heights to extract time features from each embedding matrix to obtain multiple feature maps. Concatenate and expand all feature maps to obtain high-level time features. Where LT represents the length of the time feature. The dimension of the time feature is 1*X, where X is LT, representing the length of the time feature.

[0083] Step 3.3.1: Select height H g R filters, g = 1, 2, ..., G, for the nth embedding matrix Perform time feature extraction, n = 1, 2, ..., N, and take the embedding matrix W. n The embedding matrix W obtained from the elements of row d to row e is n submatrix

[0084] Step 3.3.2: Set the filter width to the embedding dimension Z of the traffic flow vector, then the height is H. g The filter can be expressed as

[0085] Step 3.3.3, Pairing sub-matrix Apply one of its filters respectively To obtain the corresponding feature map FM, the following formula is applied:

[0086] fm s =f(θ⊙W) n [s:s+H g -1]+b s ),s=1,2,…,TH g+1 (4)

[0087]

[0088] In the formula, fm s Let f(·) represent the s-th component of the feature map FM, f(·) represent the activation function, ⊙ represent the dot product between the submatrix and the filter, and b s This indicates the bias term.

[0089] Step 3.4: Concatenate all the high-level temporal features corresponding to the embedding matrices to obtain the node feature matrix.

[0090] Step 4: Extract the correlation between electronic police devices based on the traffic flow vector obtained after embedding spatiotemporal data to obtain a dynamic correlation graph.

[0091] Graph generation methods are crucial for the feature extraction capabilities of GCNs. Existing research mainly uses the distance between sensors to construct a static graph with fixed weights, ignoring the fact that the correlation between sensors changes over time. Therefore, this embodiment proposes a novel graph generation method to generate different dynamic correlation graphs for different time periods, thereby helping GCNs to effectively model the dynamic correlations between sensors.

[0092] Step 4.1: Calculate the average traffic flow vector of the electronic traffic enforcement equipment:

[0093]

[0094] In the formula, This represents the average traffic flow vector of the x-th electronic traffic enforcement device within time step T; T represents the time step. This represents the t-th traffic flow vector of the x-th electronic police device within time step T;

[0095] Step 4.2: Calculate the similarity between the x-th and y-th electronic police devices:

[0096]

[0097] In the formula, Sim(x,y) represents the similarity between the x-th and y-th electronic alarm devices, where y = 1, 2, ..., N. and These represent the average traffic flow vectors respectively. and The z-th component;

[0098] Step 4.3: Calculate the distance Dis between the x-th and y-th electronic alarm devices. x,y This location is close to Dis. x,yThe calculation is based on the geographical location of the sensors (electronic police equipment), that is, it is directly calculated based on the actual geographical coordinates between the electronic police equipment.

[0099] Step 4.4: Use a threshold-based Gaussian kernel to calculate the weighted adjacency matrix A corresponding to the dynamic association graph, that is, obtain the dynamic correlation based on the similarity and distance between the x-th and y-th electronic police devices:

[0100]

[0101] In the formula, A x,y This represents the dynamic correlation between the x-th and y-th electronic police devices, and also represents the elements in the weighted adjacency matrix A. α and β represent the weight coefficients; σ1 represents the standard deviation of similarity; σ2 represents the standard deviation of distance; and ε represents the threshold.

[0102] Step 4.5: Obtain the dynamic association graph, which is a combination of weighted adjacency matrices A calculated at different time intervals. The time span of the time intervals corresponds to the time step. The weighted adjacency matrix A is a combination of weighted adjacency matrices A... x,y It is an N×N dimensional matrix with elements.

[0103] Step 5: Input the node feature matrix and dynamic correlation graph into the Graph Convolutional Neural Network (GCN) to obtain the prediction result output by the GCN. The prediction result is the traffic flow of all electronic traffic enforcement devices at the next T′ time points. T′ can be determined according to the actual situation.

[0104] In this embodiment, the GCN uses a spectral formula to encode graph structure and node features, which is existing technology and will not be elaborated further. Normalized adjacency matrix The definition is shown in formula (9):

[0105]

[0106] In the formula, The degree matrix represents the graph. The entire graph convolution operation in this paper can be represented by formula (10):

[0107]

[0108] In the formula, F (q) W1 (q) W2 (q) and LM (q) Let represent the hidden features of the q-th layer, the two weight parameters, and the normalized adjacency matrix, respectively. Represents the identity matrix, U represents the input features of the first layer, and ReLU (Nair and Hinton 2010) represents the activation function. For a detailed description of GCN, please refer to the paper Kipf and Welling (2016).

[0109] In another embodiment, the effectiveness of the traffic prediction method proposed in this embodiment is further verified through experiments:

[0110] 1. Data Description and Preprocessing

[0111] This embodiment validates the performance of the proposed model on two real-world traffic datasets, PeMSD7 and PeMSD8, from the California Transportation Authority Performance Measurement System (PeMS) (http: / / pems.dot.ca.gov / ). This system continuously collects traffic data in real time from over 39,000 sensors in California, USA. In this dataset, traffic data is retrieved every five minutes, thus each sensor contains 288 time points per day.

[0112] The dataset PeMSD7 contains traffic data from Los Angeles County. In this example, 150 sensors were selected and traffic flow data from June 1 to June 30, 2017 were extracted for the experiment. 20 days of data were used as the training set, 5 days as the validation set, and 5 days as the test set.

[0113] The PeMSD8 dataset contains traffic data from San Bernardino. In this example, 102 sensors were selected, and traffic flow data from June 1, 2017 to July 31, 2017 were extracted for the experiment. 41 days of data were used as the training set, 10 days as the validation set, and 10 days as the test set.

[0114] 2. Evaluation Indicators

[0115] To evaluate the performance of the proposed method, this embodiment employs three widely used statistical metrics: mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE). Their formulas are defined as follows:

[0116]

[0117]

[0118]

[0119] In the formula, and y trepresents the predicted value and the actual value at time point t, respectively, and n represents the size of the test sample.

[0120] 3. Comparison Objects

[0121] To verify the superiority of the traffic flow prediction method based on spatiotemporal data embedding proposed in this application (hereinafter referred to as the STDE-DGCN model), this embodiment selects the following baseline models for comparison:

[0122] 1) HA: Historical Average Method, which uses the average traffic flow over 12 historical time points to predict the traffic flow at the next time point.

[0123] 2) SVR (Wu et al., 2004): Support Vector Regression (SVR) is a widely used machine learning method. In this paper, the penalty parameter and tolerance are set to 0.1 and 0.03, respectively.

[0124] 3) LSTM (Ma et al., 2015): Long Short-Term Memory (LSTM) networks consist of an LSTM layer with 64 neurons. The final prediction is obtained through a fully connected layer.

[0125] 4) Image-CNN (Ma et al., 2017): It uses images (two-dimensional matrices) to represent spatiotemporal data and utilizes multiple convolutional layers to extract spatiotemporal features.

[0126] 5) ConvLSTM (Shi et al., 2015): It is an extended fully connected LSTM with embedded convolutional layers, which can extract spatial and temporal features simultaneously.

[0127] 6) CLTFP (Wu and Tan, 2016): It uses CNN and LSYM to extract spatial and temporal features respectively, and fuses them to obtain high-level spatiotemporal features.

[0128] 7) GCN (Kipf and Welling, 2016): It uses the distance between sensors to generate a static traffic network map of GCN and uses the historical traffic flow of each sensor as the corresponding node feature.

[0129] 8) STGCN (Yu et al., 2018): It generates a static traffic network map of GCN by utilizing the distance between sensors and extracts spatiotemporal features through a complete convolutional structure with gating mechanism.

[0130] 4. Parameter settings

[0131] In the spatiotemporal data embedding, the number of traffic flow intervals is 200, with lower and upper bounds set to 0 and 1000, respectively. The Word2vec window size is 5, and the vector dimension is 100. For temporal feature extraction, four types of filters are constructed with heights of 3, 5, 7, and 9, with 32 filters for each height. For spatial feature extraction, the threshold-based Gaussian kernels α, β, and ε are all set to 0.5; the GCN has 4 layers, with the first three layers containing 64 neurons, and the last layer having the same number of neurons as the prediction range length. The activation function for both the filters and the GCN is ReLU. The STDE-DGCN model is trained using the RMSprop optimizer, with the mean squared error as the objective function.

[0132] To ensure fairness in the experimental comparison, we set the same experimental parameters for the baseline model and the STDE-DGCN model: the sequence length (time step) of the historical time period was set to 12, the number of training generations was set to 100, the batch size was set to 64, the initial learning rate was set to 0.001, and early stopping was used to prevent model overfitting.

[0133] 5. Experimental Results

[0134] Based on historical data from datasets PeMSD7 and PeMSD8, the prediction results of the STDE-DGCN model and all baseline models on the PeMSD7 and PeMSD8 datasets are recorded in Table 1.

[0135] Table 1 shows the prediction results of different models in the two datasets.

[0136]

[0137] As shown in Table 1, the prediction ranges are 15 minutes (3 time steps), 30 minutes (6 time steps), and 1 hour (12 time steps). Clearly, the deep learning models LSTM, Image-CNN, ConvLSTM, CLTFP, STGCN, and STDE-DGCN outperform models with simpler architectures, such as HA and SVR, indicating that deep learning models are better suited for handling complex spatiotemporal data.

[0138] Compared to ConvLSTM, CLTFP, STGCN, and STDE-DGCN, LSTM and Image-CNN have higher prediction errors because they only focus on extracting temporal or spatial features. This indicates that both the temporal and spatial features of traffic flow affect the accuracy of traffic flow prediction.

[0139] Compared to ConvLSTM and CLTFP, the GCN-based models GCN, STGCN, and STDE-DGCN outperformed the others, demonstrating that the non-Euclidean topology of the traffic network is crucial to the predictive performance of the model.

[0140] In GCN-based models, STDE-DGCN outperforms GCN and STGCN on all evaluation metrics because only STDE-DGCN can effectively model the dynamic correlations between sensors and fully utilize the implicit correlations between traffic flows.

[0141] in addition, Figure 4 The prediction errors of the four best models (CLTFP, GCN, STGCN, and STDE-DGCN) in Table 1 over 24 hours are shown. The results indicate that STDE-DGCN achieves lower MAE, RMSE, and MAPE than CLTFP, GCN, and STGCN, especially during peak periods (i.e., 8:00 and 17:00). For example, for PeMSD7, CLTFP's MAE at 17:00 is approximately 40, while STDE-DGCN's MAE is only approximately 23. For PeMSD8, STGCN's RMSE at 8:00 is approximately 21, while STDE-DGCN's RMSE is approximately 18. Furthermore, STDE-DGCN's prediction error fluctuates less across all time points, indicating that the STDE-DGCN model has better accuracy and stability.

[0142] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0143] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A traffic flow prediction method based on spatiotemporal data embedding, characterized in that, The traffic flow prediction method based on spatiotemporal data embedding includes: Step 1: Obtain historical traffic flow data: Collect traffic flow data from N electronic traffic enforcement devices at M time points as historical traffic flow data; Step 2: Perform spatiotemporal data embedding based on historical traffic flow data, including: Step 2.1, Representation of traffic flow by interval: Step 2.1.1: Take the maximum and minimum traffic flow values ​​from historical traffic flow data as the upper and lower limits of the traffic flow range, and divide the traffic flow range into P equal intervals, with interval symbols... Represents the i-th interval, ; Step 2.1.2: Determine the interval to which each traffic flow belongs in the historical traffic flow data, and represent each traffic flow as the interval symbol to which it belongs to, so as to convert it into the corresponding traffic flow interval; Step 2.2, Generation of traffic flow vector: Step 2.2.1: Take all traffic flow intervals within a preset time step from the historical traffic flow data as input data, denoted as... Where T represents the time step, the Word2vec model is used to process the input data. Convert to embedded data , where Z represents the embedding dimension of the traffic flow vector, thus obtaining the corresponding traffic flow vector; Step 3: Using a filter bank with multiple different heights, extract time features from the traffic flow vector obtained after embedding spatiotemporal data to obtain the node feature matrix; Step 4: Based on the traffic flow vector obtained after embedding spatiotemporal data, extract the correlation between electronic police devices to obtain a dynamic correlation graph, including: Step 4.1: Calculate the average traffic flow vector of the electronic traffic enforcement equipment: In the formula, This represents the average traffic flow vector of the x-th electronic traffic enforcement device within time step T; T represents the time step. This represents the t-th traffic flow vector of the x-th electronic police device within time step T; Step 4.2: Calculate the similarity between the x-th and y-th electronic police devices: In the formula, Let x be the similarity between the x-th and y-th electronic alarm devices. , and These represent the average traffic flow vectors respectively. and The z-th component; Step 4.3: Calculate the distance between the x-th and y-th electronic police devices based on their actual geographical coordinates. ; Step 4.4: Obtain dynamic correlation based on the similarity and distance between the x-th and y-th electronic police devices: In the formula, This represents the dynamic correlation between the x-th and y-th electronic alarm devices. and Indicates the weighting coefficients; The standard deviation represents the similarity. The standard deviation of distance; Indicates the threshold; Step 4.5: Obtain the dynamic association graph, which is a combination of weighted adjacency matrices A calculated at different time periods. The time span of the time period corresponds to the time step. The weighted adjacency matrix A is... An N×N dimensional matrix with elements; Step 5: Input the node feature matrix and dynamic association graph into the Graph Convolutional Neural Network (GCN) to obtain the prediction result output by the GCN. The prediction result is the future prediction result for all electronic police devices. Traffic flow at specific points in time.

2. The traffic flow prediction method based on spatiotemporal data embedding as described in claim 1, characterized in that, The interval lower bound and the Upper Realm The calculation is as follows: In the formula, and These represent the lower and upper limits of the traffic flow range, respectively.

3. The traffic flow prediction method based on spatiotemporal data embedding as described in claim 1, characterized in that, The node feature matrix is ​​obtained by extracting time features from the traffic flow vector obtained after spatiotemporal data embedding, including: Step 3.1: Use different electronic alarm devices to process the embedded data. The process involves partitioning the matrix into N embedding matrices. ; Step 3.2: Obtain the filter bank, which contains filters of height [value missing]. There are G different heights, and each height has R filters; Step 3.3: Use filters of different heights to extract time features from each embedding matrix to obtain multiple feature maps. Concatenate and expand all feature maps to obtain high-level time features. , where LT represents the length of the time feature; Step 3.4: Concatenate all the high-level temporal features corresponding to the embedding matrices to obtain the node feature matrix. .

4. The traffic flow prediction method based on spatiotemporal data embedding as described in claim 3, characterized in that, The process involves using filters of different heights to extract temporal features from each embedding matrix, resulting in multiple feature maps, including: Step 3.3.1: Select height H g R filters, , for the Embedding matrices Perform time feature extraction. Take the embedding matrix The embedding matrix obtained from the elements of row d to row e. submatrix ; Step 3.3.2: Set the filter width to the embedding dimension Z of the traffic flow vector, then the height is H. g The filter can be expressed as ; Step 3.3.3, Pairing sub-matrix Apply one of its filters respectively To obtain the corresponding feature map FM, the following formula is applied: In the formula, This represents the s-th component of the feature map FM. Let ⊙ denote the activation function, ⊙ denote the dot product between the submatrix and the filter, and b s This indicates the bias term.