A subway passenger flow prediction method and device based on DCG and dual-branch parallelism
By using the DCG module and dual-branch parallel structure prediction network in subway passenger flow prediction, combined with SBULSTM and Transformer models, the shortcomings of existing models in capturing global information and maintaining high accuracy are solved, and more efficient spatio-temporal predictions are achieved. .
Patent Information
- Application Number
- CN202410607726.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2044-05-16
AI Technical Summary
Existing subway passenger flow prediction models are difficult to stably capture global information and maintain high accuracy, especially when dealing with spatial dependencies in transportation networks.
A subway passenger flow prediction method based on DCG and dual-branch parallel is adopted. By constructing a branch convergence graph module DCG and a prediction network with a dual-branch parallel structure, combined with the SBULSTM and Transformer models, the flow information and global dependence of passengers on the subway network are captured.
It improves the comprehensive spatio-temporal capability of subway passenger flow prediction, achieving more stable global information capture and higher prediction accuracy.
Smart Images

Figure CN118469079B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of public transportation data analysis and prediction, and specifically relates to a subway passenger flow prediction method and device based on DCG and dual-branch parallelism. Background Art
[0002] Subway travel is an important mode of transportation for modern urban residents to commute daily. It is characterized by high speed, high efficiency, large capacity and good punctuality. Predicting the future passenger flow of the subway system is an important part of public transportation system management and control. It helps to better understand the travel patterns of urban residents, monitor and evaluate the operation status of the subway, and take immediate response measures in the event of emergency special events.
[0003] The prediction models mainly used in existing short-term passenger flow prediction tasks can be divided into three types: statistical models, machine learning models, and deep learning models. Statistical models such as the autoregressive moving average (ARIMA) model and the exponential smoothing (ES) model cannot handle the complex nonlinear problems in traffic data and have poor prediction accuracy. Machine learning models such as support vector machines (SVM) and artificial neural networks (ANN) need to extract effective input features from the original data, and it is difficult to handle time-varying features, feature redundancy, and overfitting problems. Given the recognized performance of recurrent neural networks (RNNs) in time series prediction, their variants, such as long short-term memory (LSTM) and gated recurrent units (GRU), are widely used in mainstream research on traffic prediction. Deep learning models represented by LSTM do not rely on feature selection, and can capture complex nonlinear relationships, with outstanding performance in time series prediction accuracy.
[0004] However, the RNN-based model only uses the temporal characteristics of travel behavior, while ignoring the potential spatial dependencies in the traffic network. In order to capture the spatial dependencies in traffic data, a number of methods using convolutional neural networks (CNNs) to build prediction models have emerged. However, previous deep learning studies usually combine spatial modules and temporal modules in sequence, but the output generated by the convolutional layer cannot fully represent the pattern of the original subway passenger flow data, that is, deep convolution may cause the original passenger flow pattern to change. The CNN-based model only considers the absolute distance relationship between stations in the two-dimensional Euclidean space, and the non-Euclidean structural characteristics in the traffic network are not fully learned.
[0005] Compared with CNN, graph convolutional neural network (GCN) provides a more feasible method for spatial dependencies in transportation networks. It can retain the real topological structure and capture the dependencies between subway stations by aggregating node information through graph convolution. Therefore, many related studies combine GCN and time series prediction models to establish a joint prediction model to capture the spatial and temporal characteristics of the prediction problem. However, the features extracted based on the structure of this sequence may be distorted, resulting in the loss of global information and uncertainty in prediction. Based on the above problems, there is an urgent need for a prediction method that can stably capture global information and maintain high accuracy. Summary of the invention
[0006] Purpose of the invention: The present invention proposes a subway passenger flow prediction method and device based on DCG and dual-branch parallelism, which captures the flow information of passengers on the subway network, obtains the flow characteristics of convergence stations, strengthens the extraction of global dependencies in real space and the capture of long-term context sequence characteristics, and improves the ability of comprehensive spatiotemporal prediction.
[0007] Technical solution: The present invention discloses a method for predicting subway passenger flow based on DCG and dual-branch parallelism, comprising the following steps:
[0008] (1) Select areas with dense traffic behavior, construct a subway transportation network, and preprocess the subway station section passenger flow data set and the station OD data set;
[0009] (2) Constructing a branch-convergence graph module DCG; the branch-convergence graph module DCG is a bimodal feature set consisting of the passenger flow of subway station sections and the OD data between stations. On the basis of obtaining the graph structure of the spatial characteristics of the subway topology network, the aggregation and dispersion of passenger flow are closely combined;
[0010] (3) Constructing a subway passenger flow prediction network; the subway passenger flow prediction network adopts a dual-branch parallel structure, the first branch adopts two layers of SBULSTM layers to focus on the main component features; the second branch adopts three layers of Transformer layers to encode the global feature information; and then a layer of SBULSTM layer is used to fuse the features of different dimensions between the two branches;
[0011] (4) The output of the first branch is sampled through the time difference method to learn the feature weights from the incomplete sequence state; then this feature state is connected with the flattened connection of the third layer Transformer to the SBULSTM layer of the second branch, and finally the prediction result is output through the fully connected layer of Dropout.
[0012] Furthermore, in step (1), the subway transportation network is nodes and edges connecting the nodes; the nodes represent stations in uo, and the edges represent reachable relationships between stations; and the edges are provided with weights, and the weights are the travel costs corresponding to the reachable relationships between stations.
[0013] Furthermore, the DCG module in step (2) includes a deep relationship matrix, a travel distance weight matrix and a passenger flow weight matrix to dynamically capture the spatial dependency of the stations:
[0014] I=D⊙T⊙F
[0015] Among them, I is the fusion matrix, D represents the deep relationship matrix, T represents the travel distance weight matrix, F represents the passenger flow weight matrix, and ⊙ represents the multiplication of matrix elements.
[0016] Furthermore, the depth relationship matrix is:
[0017] The N×N adjacency matrix D0 is constructed through the selected regional subway network; the element calculation expression in the adjacency matrix is as follows:
[0018]
[0019] in, represents the element in the i-th row and j-th column of the adjacency matrix, v i With v j They represent nodes i and j in the subway network graph respectively, and E is the graph structure corresponding to the subway network graph;
[0020] Based on the adjacency matrix, the depth-first search algorithm DFS is used to search for non-repeated nodes within an unlimited distance to establish a deep connection matrix D1:
[0021]
[0022] Among them, v i,j is the visited node, u is the unvisited node, v i,j The edge with the unvisited node u;
[0023] Add the deep connection matrix D1 to the identity matrix to get D2, and then invert it to get the deep relationship matrix D. The calculation formula of D is as follows:
[0024]
[0025] in, represents the inverse matrix of matrix D2, det(D2) represents the determinant of matrix D2, and adj(D2) represents the adjoint matrix of matrix D2.
[0026] Furthermore, the travel distance weight matrix is:
[0027] The N×N travel distance matrix T0 is constructed by measuring the distances between subway stations. Then, the Gaussian kernel function is used to calculate the relative Euclidean distances between stations and the travel distance weight matrix T is established. The matrix elements T i,j The calculation expression is as follows:
[0028]
[0029] Among them, dist(v i, ,v j, ) indicates site v i, With v j, is the shortest travel distance between two nodes, and σ is the standard deviation of the travel distance.
[0030] Furthermore, the passenger flow weight matrix is:
[0031] The preprocessed data set is placed into the adjacency matrix to obtain the passenger flow matrix F0: the station section passenger flow data is placed in the self-position of the matrix as the main component feature, that is, the diagonal position, which represents the traffic gathered at each station in a period of time; the OD data is placed in the directed position of the matrix as the global feature, that is, the non-diagonal position, which represents the traffic distributed by each station in the same period of time; the flow values in the matrix F are normalized to obtain the matrix F1; the weight of each element is calculated to obtain the passenger flow weight matrix F, and its element calculation expression is as follows:
[0032]
[0033] Among them, N ij is the number of passengers going from station i to station j during a specific time period.
[0034] Furthermore, in step (3), the first branch and the second branch use different input data forms; the data input of the first branch is M, the dimension is [batch_size,,time_step], and the constructed DCG module is used to query the traffic of the self-node to complete the traffic encoding, and the vector M is obtained. embed , its expanded dimension is [batch_size, time_step, embed_dime], where batch_size is the number of samples selected for one training, time_step is the time step, and embed_dime is the flow vector dimension, that is, the number of nodes N in the constructed DCG; the data dimension of the second branch is [batch_size, time_step], and the flow encoding is completed using the flow vector of the directed bit node queried in the constructed DCG module, and the dimension is further expanded to [batch_size, time_step, embed_dime2 ], the matrix encoding result is positionally encoded using the sin and cos functions according to the following formula:
[0035] PE(pos,2i)=sin(pos / 10000 2i / embed )
[0036] PE(pos,2i+1)=cos(pos / 10000 2i / embed )
[0037] Among them, pos refers to the position of the element in the matrix, i refers to the dimension of the flow vector, embed refers to the dimension of the total feature vector, [batch_size, time_step, embed_dime 2 ] is the position encoding dimension obtained, and the results of position encoding and flow encoding are added to obtain vector X embed , X embed The dimensions are [batch_size, time_step, embed_dime], where batch_size is the number of samples selected for one training, time_step is the time step, and embed_dime 2 is the traffic vector dimension, that is, the number of nodes N in the constructed DCG 2 ; After the vector encoding is completed, it is input into the Transformer model to learn the feature information, and the output prediction value is calculated using the following formula:
[0038] x=LayerNorm(Atten(.)+X embed )
[0039] y pre =LayerNorm(FF(.)+x)
[0040] Among them, LayerNorm(.) represents the normalization operation, Atten(.) represents the attention operation, FF(.) represents the feedforward layer operation, and X embed is the input, x is the intermediate value, y pre is the predicted value.
[0041] Furthermore, the SBULSTM layer in step (3) includes a bidirectional LSTM layer and an LSTM layer.
[0042] Furthermore, the flattening connection described in step (4) is: at the input M of the first branch embed After two layers of SBULSTM and time difference sampling method, N flow , and the input X of the second branch embed After three Transformer layers, we get Y flowAfter that, for N flow With Y flow Perform the Concatenate operation to obtain the Z that combines the features of the two branches flow .
[0043] A device according to the present invention includes a memory and a processor, wherein:
[0044] A memory for storing computer programs that can be run on the processor;
[0045] The processor is used to execute the steps of the subway passenger flow prediction method based on DCG and dual-branch parallelism as described above when running the computer program.
[0046] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0047] 1. The present invention adopts a bimodal feature set consisting of subway station section passenger flow data and station-to-station OD data, namely, the DCG module. Based on the graph structure capable of obtaining the spatial characteristics of the subway topological network, the station section passenger flow data is placed in the self-position (diagonal position) of the graph as the main component feature, and the OD data is placed in the directed position of the graph as the global feature, so that the two types of characteristics of passenger flow aggregation and dispersion are closely combined;
[0048] 2. The present invention is based on an improved dual-branch prediction neural network. The first branch adopts SBULSTM to focus on the main component feature - the customer flow; the second branch adopts Transformer to encode the global information; after the first branch passes through two layers of SBULSTM, the direct experience obtained from the main component features is added as the state activation input into the SBULSTM layer of the second branch through time difference learning, so as to expand the feature dimension, maximize the retention of the main component features and the global representation, and realize information interaction;
[0049] 3. The present invention proposes a subway passenger flow prediction method based on a DCG dual-branch parallel prediction neural network by stacking multiple modules, which realizes the fusion of features, effectively takes into account both globality and locality, and improves accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flowchart of the subway passenger flow prediction method based on DCG and dual-branch parallelism;
[0051] Figure 2 The depth relationship matrix diagram proposed by the present invention;
[0052] Figure 3 The distance weight matrix diagram proposed by the present invention;
[0053] Figure 4 This is the DCG module diagram proposed by the present invention;
[0054] Figure 5 Schematic diagram of the SBULSTM model proposed in the present invention;
[0055] Figure 6 This is a schematic diagram of the LSTM model proposed in the present invention;
[0056] Figure 7 Schematic diagram of the Transformer model proposed in the present invention. DETAILED DESCRIPTION
[0057] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0058] The present invention proposes a subway passenger flow prediction method based on DCG and dual-branch parallelism, which uses physical topology and virtual graph to construct a Dispersion and Convergence Graph (DCG) module, and a parallel stacked bidirectional and unidirectional LSTM Recurrent Neural Network (SBULSTM) model and a Transformer model to process time dependencies, which can enhance the extraction of real space dependencies and the capture of long-term context sequence characteristics, and improve the ability of comprehensive spatiotemporal prediction. Figure 1 As shown, the specific steps include:
[0059] Step 1: Select areas with dense traffic behavior, build a subway transportation network, and preprocess the subway station section passenger flow data set and the station OD data set.
[0060] The subway transportation network diagram is: nodes and edges connecting nodes. Nodes represent stations in the subway network, edges represent the reachability relationship between stations, and edges are set with weights. The weight is the distance / time corresponding to the reachability relationship between stations, that is, the travel cost.
[0061] Step 2: If Figure 4 As shown in the figure, a branch convergence graph module DCG is constructed. The DCG module is a bimodal feature set consisting of the passenger flow of the subway station section and the origin and destination data between the stations (OD). On the basis of the graph structure that can obtain the spatial characteristics of the subway topology network, the aggregation and dispersion of passenger flow are closely combined. Its main components are:
[0062] like Figure 2As shown, the deep relationship matrix: First, construct an N×N adjacency matrix D0 through the selected regional subway network. The element calculation expression in the adjacency matrix is as follows:
[0063]
[0064] in, represents the element in the i-th row and j-th column of the adjacency matrix, v i With v j They represent nodes i and j in the subway network graph, respectively, and E is the graph structure corresponding to the subway network graph. Secondly, based on the adjacency matrix, the DFS (depth first search) algorithm is used to search for non-repeated nodes within an unlimited distance to establish a deep connection matrix D1. The calculation expression of the DFS algorithm is as follows:
[0065]
[0066] Among them, v i,j is the visited node, u is the unvisited node, v i,j Then, add the deep connection matrix D1 to the identity matrix to get D2, and then invert it to get the deep relationship matrix D. The calculation formula of D is as follows:
[0067]
[0068] in, represents the inverse matrix of matrix D2, det(D2) represents the determinant of matrix D2, and adj(D2) represents the adjoint matrix of matrix D2.
[0069] like Figure 3 As shown in Figure 1, the travel distance weight matrix is: First, the N×N travel distance matrix T0 is constructed by measuring the distances between subway stations; then, the Gaussian kernel function is used to calculate the relative Euclidean distances between stations to establish the travel distance weight matrix T. The matrix elements T i,j The calculation expression is as follows:
[0070]
[0071] Among them, dist(v i, ,v j, ) indicates site v i, With v j, is the shortest travel distance between two nodes, and σ is the standard deviation of the travel distance.
[0072] Passenger flow weight matrix: First, place the preprocessed data set into the adjacency matrix to obtain the passenger flow matrix F0: The station section passenger flow data is placed in the self-position (diagonal position) of the matrix as the main component feature, indicating the traffic gathered at each station in a period of time. The OD data is placed in the directed position (non-diagonal position) of the matrix as the global feature, indicating the traffic distributed by each station in the same period of time; secondly, the flow values in the matrix F are normalized (Normalization) to obtain the matrix F1; finally, the weight of each element is calculated to obtain the passenger flow weight matrix F, and its element calculation expression is as follows:
[0073]
[0074] Among them, N ij is the number of passengers going from station i to station j during a specific time period.
[0075] Finally, define a fusion matrix I k , which integrates D, T and F, and can dynamically capture the spatial dependence of the site. The calculation expression of I is as follows:
[0076] I=D⊙T⊙F (6)
[0077] Among them, D represents the deep relationship matrix, T represents the travel distance weight matrix, F represents the passenger flow weight matrix, and ⊙ represents the multiplication of matrix elements.
[0078] Step 3: Construct a subway passenger flow prediction network with a dual-branch parallel structure. The first branch uses two layers of SBULSTM layers to focus on the main component features; the second branch uses three layers of Transformer layers to encode global feature information; and then a layer of SBULSTM layer is used to fuse features of different dimensions between the two branches. The SBULSTM layer includes a bidirectional LSTM layer and an LSTM layer.
[0079] The prediction network branches use different input data forms: the data dimension of the first branch is [batch_size, time_step]. In the constructed DCG module, the traffic vector of each node is queried to complete the traffic encoding, and the dimension is further expanded to [batch_size, time_step, embed_dime]. Batch_size is the number of samples selected for one training, time_step is the time step, and embed_dime is the traffic vector dimension. The dimension of embed_dime here is the number of nodes N in the constructed DCG. For the embodiment of the present invention, Figure 5 As shown in the figure, the SBULSTM model consists of one bidirectional LSTM layer and one LSTM layer. Figure 6As shown in the figure, there are three types of gates in the LSTM unit: forget gate, input gate and output gate. The forget gate is to use the Sigmoid activation function to convert the output h of the previous layer into t-1 With the input x of this layer t Through linear operation mapping, we can get the output f in the interval [0,1] t , which is used to filter the state information of the previous moment and discard useless information before passing it to future cells. The formula of the forget gate is as follows:
[0080] f t =σ(W f *[h t-1 ,x t ]+c f ) (7)
[0081] Among them, W f is the weight matrix, c f For bias.
[0082] The output of the input gate consists of two parts: the output h of the previous layer t-1 And the input x of this layer t The output i is obtained by linear operation using the Sigmoid activation function and the tanh activation function. t and C' t . Expressed in the formula t and C' t as follows:
[0083] i t =σ(W i *[h t-1 ,x t ]+c i ) (8)
[0084] C' t =tanh(W k *[h t-1 ,x t ]+c k ) (9)
[0085] Among them, W i and W k is the weight matrix, c i and c k The above three formulas can be used to update the cell state C at this moment. t , its mathematical expression is as follows:
[0086] C t =f t *C t-1 +i t *C' t(10)
[0087] The output gate determines the final output h according to the cell state at the current moment. t , preferably through the Sigmoid activation function to obtain a value O in the [0,1] interval t , and then the cell state C t After the tanh activation function and O t Multiply to get the final output h t , its mathematical expression is as follows:
[0088] O t =σ(W O *[h t-1 ,x t ]+c O ) (11)
[0089] h t =O t *tanh(C t ) (12)
[0090] Among them, W O is the weight matrix, c O For bias.
[0091] The bidirectional LSTM model is a system of two LSTM layers that pass data in reverse. Each output of the system receives information from the hidden state of the backward layer and the forward layer. Bidirectional LSTM learns not only past information, but also future information. This feature allows the model to predict sequence information more accurately. The output of each time step can be derived as follows:
[0092]
[0093] in, represents the hidden state of the forward LSTM layer at time step t, represents the hidden state of the backward LSTM layer at time step t.
[0094] The data dimension of the first branch is [batch_size,,time_step]. The DCG module in the constructed DCG module is used to query the traffic of the self-node to complete the traffic encoding and obtain the vector M embed , and its expanded dimensions are [batch_size, time_step, embed_dime], where batch_size is the number of samples selected for one training, time_step is the time step, and embed_dime is the flow vector dimension, that is, the number of nodes N in the constructed DCG.
[0095] The data dimension of the second branch is [batch_size, time_step]. First, the traffic vector of each node is queried in the constructed DCG module to complete the traffic encoding, and then the dimension is expanded to [batch_size, time_step, embed_dime 2 ], the matrix encoding result is positionally encoded using the sin and cos functions according to the following formula:
[0096] PE(pos,2i)=sin(pos / 10000 2i / embed ) (14)
[0097] PE(pos,2i+1)=cos(pos / 10000 2i / embed ) (15)
[0098] Among them, pos refers to the position of the element in the matrix, i refers to the dimension of the flow vector, embed refers to the dimension of the total feature vector, [batch_size, time_step, embed_dime 2 ] is the position encoding dimension obtained, and the results of position encoding and flow encoding are added to obtain vector X embed , X embed The dimension is [batch_size, time_step, embed_dime 2 ], batch_size is the number of samples selected for one training, time_step is the time step, embed_dime 2 is the flow vector dimension. Here embed_dime 2 The dimension is the number of nodes N in the constructed DCG 2 After the vector is encoded, it is input to Figure 7 The Transformer model shown in the figure learns feature information, and its output prediction value is calculated using the following formula:
[0099] x=LayerNorm(Atten(.)+X embed ) (16)
[0100] y pre =LayerNorm(FF(.)+x) (17)
[0101] Among them, LayerNorm(.) represents the normalization operation, Atten(.) represents the attention operation, FF(.) represents the feedforward layer operation, and X embed is the input, x is the intermediate value, y pre is the predicted value.
[0102] Step 4: Sample the output of the first branch through the time difference method to learn the feature weights from the incomplete sequence state; then provide this feature state and the flattened connection of the third layer Transformer to the fourth layer SBULSTM layer of the second branch, and finally output the prediction result through the fully connected layer of Dropout.
[0103] The flattened connection is: In the first branch, the input M embed After two layers of SBULSTM and time difference sampling method, N flow , and the input X of the second branch embed After three Transformer layers, we get Y flow After that, for N flow With Y flow Perform the Concatenate operation to obtain the Z that combines the features of the two branches flow .
[0104] The mean absolute error (MAE) is used as the model loss function, and the root mean square error (RMSE) is used as the final prediction result evaluation index. The mathematical expression is as follows:
[0105]
[0106]
[0107] The optimizer is Adam, the initial learning rate is 0.005, the batch_size is 2, and the epochs is 1000.
[0108] The present invention also provides an apparatus, comprising a memory and a processor, wherein: the memory is used to store a computer program that can be run on the processor; the processor is used to execute the steps of the subway passenger flow prediction method based on DCG and dual-branch parallelism as described above when running the computer program.
[0109] The above embodiments are only for illustrating the technical concept and features of the present invention, and cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A subway passenger flow prediction method based on DCG and dual-branch parallelism, characterized in that: The following steps are involved: (1) Select areas with dense traffic behavior, construct a subway transportation network, and preprocess the subway station section passenger flow data set and the station OD data set; (2) Construct branch aggregation graph module DCG; The branch convergence graph module DCG is a bimodal feature set consisting of the passenger flow of subway station sections and the OD data between stations. On the basis of obtaining the graph structure of the spatial characteristics of the subway topological network, it closely combines the two types of characteristics of passenger flow aggregation and dispersion; (3) Constructing a subway passenger flow prediction network; the subway passenger flow prediction network adopts a dual-branch parallel structure, and the first branch adopts two layers of SBULSTM layers, focusing on the main component features; The second branch uses three layers of Transformer to encode global feature information. Then, a layer of SBULSTM is used to fuse features of different dimensions between the two branches. (4) The output of the first branch is sampled through the time difference method to learn feature weights from the incomplete sequence state; this feature state is then connected with the flattened connection of the third layer Transformer to the SBULSTM layer of the second branch, and finally the prediction result is output through the fully connected layer of Dropout; The DCG module in step (2) includes a deep relationship matrix, a travel distance weight matrix and a passenger flow weight matrix, which dynamically captures the spatial dependency of the stations: I=D☉T☉F Among them, I is the fusion matrix, D is the deep relationship matrix, T is the travel distance weight matrix, F is the passenger flow weight matrix, and ⊙ is the multiplication of matrix elements; The depth relationship matrix is: The N×N adjacency matrix D0 is constructed through the selected regional subway network; the element calculation expression in the adjacency matrix is as follows: in, represents the element in the i-th row and j-th column of the adjacency matrix, v i With v j They represent nodes i and j in the subway network graph respectively, and E is the graph structure corresponding to the subway network graph; Based on the adjacency matrix, the depth-first search algorithm DFS is used to search for non-repeated nodes within an unlimited distance to establish a deep connection matrix D1: Among them, v i,j is the visited node, u is the unvisited node, v i,j The edge with the unvisited node u; Add the deep connection matrix D1 to the identity matrix to get D2, and then invert it to get the deep relationship matrix D. The calculation formula of D is as follows: in, represents the inverse matrix of matrix D2, det(D2) represents the determinant of matrix D2, and adj(D2) represents the adjoint matrix of matrix D2; The travel distance weight matrix is: The N×N travel distance matrix T0 is constructed by measuring the distances between subway stations. Then, the Gaussian kernel function is used to calculate the relative Euclidean distances between stations and the travel distance weight matrix T is established. The matrix elements T i,j The calculation expression is as follows: Among them, dist(v i,, v j, ) indicates site v i, With v j, The shortest travel distance between two groups, σ is the standard deviation of travel distance; The passenger flow weight matrix is: The preprocessed data set is placed into the adjacency matrix to obtain the passenger flow matrix F0: the station section passenger flow data is placed in the self-position of the matrix as the main component feature, that is, the diagonal position, which represents the traffic gathered at each station in a period of time; the OD data is placed in the directed position of the matrix as the global feature, that is, the non-diagonal position, which represents the traffic distributed by each station in the same period of time; the flow values in the matrix F are normalized to obtain the matrix F1; the weight of each element is calculated to obtain the passenger flow weight matrix F, and its element calculation expression is as follows: Among them, N ij is the number of passengers going from station i to station j in a specific time period; Step (3) The first branch and the second branch use different input data forms; the data input of the first branch is M, the dimension is [batch_size, time_step], and the constructed DCG module is used to query the traffic of the self-node to complete the traffic encoding, and the vector M is obtained. embed , its expanded dimension is [batch_size, time_step, embed_dime], where batch_size is the number of samples selected for one training, time_step is the time step, and embed_dime is the flow vector dimension, that is, the number of nodes N in the constructed DCG; the data dimension of the second branch is [batch_size, time_step], and the flow encoding is completed using the flow vector of the directed bit node queried in the constructed DCG module, and the dimension is further expanded to [batch_size, time_step, embed_dime 2 ], the matrix encoding result is positionally encoded using the sin and cos functions according to the following formula: PE(pos,2i)=sin(pos / 10000 2i / embed ) PE(pos,2i+1)=cos(pos / 10000 2i / embed ) Among them, pos refers to the position of the element in the matrix, i refers to the dimension of the flow vector, embed refers to the dimension of the total feature vector, [batch_size, time_step, embed_dime 2 ] is the position encoding dimension obtained, and the results of position encoding and flow encoding are added to obtain vector X embed , X embed The dimensions are [batch_size, time_step, embed_dime], where batch_size is the number of samples selected for one training, time_step is the time step, and embed_dime 2 is the traffic vector dimension, that is, the number of nodes N in the constructed DCG 2 ; After the vector encoding is completed, it is input into the Transformer model to learn the feature information, and the output prediction value is calculated using the following formula: x=LayerNorm(Atten(.)+X embed ) y pre =LayerNorm(FF(.)+x) Among them, LayerNorm(.) represents the normalization operation, Atten(.) represents the attention operation, FF(.) represents the feedforward layer operation, and X embed is the input, x is the intermediate value, y pre is the predicted value; The SBULSTM layer in step (3) includes a bidirectional LSTM layer and an LSTM layer.
2. The subway passenger flow prediction method based on DCG and dual-branch parallelism according to claim 1 is characterized in that: The subway transportation network in step (1) is nodes and edges connecting the nodes; the nodes represent stations in the subway network, and the edges represent reachable relationships between the stations; and the edges are provided with weights, which are the travel costs corresponding to the reachable relationships between the stations.
3. The subway passenger flow prediction method based on DCG and dual-branch parallelism according to claim 1 is characterized in that: The flattening connection described in step (4) is: at the input M of the first branch embed After two layers of SBULSTM and time difference sampling method, N flow , and the input X of the second branch embed After three Transformer layers, we get Y flow After that, for N flow With Y flow Perform the Concatenate operation to obtain the Z that combines the features of the two branches flow .
4. A device, characterized in that: comprising a memory and a processor, wherein: A memory for storing computer programs that can be run on the processor; A processor is used to execute the steps of the subway passenger flow prediction method based on DCG and dual-branch parallelism as described in any one of claims 1 to 3 when running the computer program.
Citation Information
Patent Citations
Passenger flow prediction method based on self-attention personalized enhanced graph convolutional network
CN114330868A
Urban rail passenger flow prediction method based on dynamic multi-graph and multi-dimensional attention space-time neural network
CN117454119A