A subway passenger flow prediction method and system based on space-time diagram ordinary differential equation
By proposing a subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations, the problem of complex spatiotemporal correlation modeling of subway networks is solved. By enhancing temporal dependence and expanding the spatial receptive field through temporal self-attention and dilated convolution modules, more efficient subway passenger flow prediction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTHEAST UNIV
- Filing Date
- 2023-11-21
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies struggle to effectively model the complex spatiotemporal correlations of subway networks, and graph neural networks suffer from receptive field limitations when expanding their depth, resulting in limited prediction performance.
A subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations is adopted. By constructing a spatiotemporal relationship graph and combining temporal self-attention and dilated convolution modules, the temporal dependence is enhanced. Furthermore, the spatial receptive field is expanded through graph ordinary differential equations to establish a deeper spatiotemporal dependency relationship.
It achieves more accurate subway passenger flow forecasting, improves forecasting performance, effectively handles the complex spatiotemporal dependencies of the subway network, and improves forecasting accuracy.
Smart Images

Figure CN117592602B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of traffic prediction technology, specifically relating to a method for predicting subway passenger flow based on spatiotemporal graph ordinary differential equations. Background Technology
[0002] With the rapid development of the national economy, urban traffic congestion has become a common phenomenon, bringing many negative impacts on the environment, economy, and safety. To alleviate traffic congestion, people are increasingly choosing diverse modes of transportation. As a form of public transportation, the subway, with its safety, punctuality, speed, comfort, and environmental friendliness, has gradually become the preferred mode of transport for many urban residents. However, due to the continuous increase in subway ridership, subway operators face enormous pressure. Therefore, accurate, timely, and rapid prediction of subway passenger flow is crucial for improving subway operational efficiency and service quality. On the one hand, it provides travelers with real-time and effective information, helping them plan and choose the best modes of transportation and routes, thereby achieving a reasonable distribution of passenger flow and alleviating congestion. On the other hand, through passenger flow prediction results, subway operators can adjust transportation plans in a timely manner, accurately match capacity, and prepare for early warning and emergency response to large passenger flows, improving passenger travel experience and safety.
[0003] In recent years, the development of deep learning has provided new ideas for research on subway passenger flow prediction. Liu et al. fully considered spatial topological information and historical passenger data to construct a physical-virtual cooperative graph network, which can effectively learn complex riding patterns from virtual and physical graphs. Chen et al. combined graph convolutional networks with stacked bidirectional unidirectional long short-term memory networks to effectively predict subway passenger flow in Shenzhen, Shanghai, and Hangzhou. Ou et al. first applied a novel variant of temporal convolution, TrellisNet, to the subway passenger flow prediction task. Zhang et al. proposed a Transformer-based model to simultaneously capture spatiotemporal dependencies.
[0004] However, the challenge of predicting subway network traffic stems primarily from its complex spatiotemporal dependencies. Subway networks exhibit complex and long-term spatiotemporal dependencies, meaning that each node not only affects other nodes at the same time but also has varying degrees of influence on nodes at later times. Furthermore, traditional graph neural network models suffer from limitations in handling such tasks; they cannot expand their spatial receptive field by increasing depth, and all node representations converge to the same value in deeper layers. This drawback severely limits the depth of graph neural networks, making it difficult to capture deeper and richer spatial features, further limiting their effectiveness. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations. It aims to solve the long-standing problems in subway passenger flow prediction, mainly including the difficulty in modeling the complex temporal and spatial correlations of subway network passenger flow, and the contradiction between increasing the receptive field and stacking network layers in existing graph neural networks.
[0006] To solve the above technical problems, the present invention provides the following technical solution:
[0007] First, this invention proposes a subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations, comprising the following steps:
[0008] Step 1: Collect and process historical AFC data of the subway. Construct a set of spatiotemporal relationship graphs based on spatial topology information and subway passenger flow data. Represent the acquired passenger flow as a graph signal X∈R. N×F Specifically, it includes the following sub-steps:
[0009] Step 1-1: Collect historical subway AFC data and preprocess the raw data. Use the obtained passenger flow representation as the model input X∈R. N×F , where F is the number of features for each node;
[0010] Steps 1-2: Construct a geographic adjacency graph using spatial topology information, setting the weight between a node and its direct geographic neighbors to 1, and the weights of others to 0.
[0011] Steps 1-3: Construct a semantic similarity graph using historical passenger flow data, calculate the historical passenger flow similarity between nodes using the dynamic time-rounding method, select the nodes with the highest similarity as semantic neighbors according to a certain selection strategy, set the weight between nodes and semantic neighbors as the node similarity weight, and set the others to 0.
[0012] Steps 1-4 involve constructing a semantic correlation graph using historical passenger flow data, and utilizing the origin-destination distribution to... To construct a global relevance matrix, where D(i,j) represents the total number of passengers entering station i from station j in the entire training set. Then, a selection strategy is used to construct edges, setting the weights between nodes and their semantic neighbors as relevance weights, and setting the others to 0.
[0013] Step 2: Using the passenger flow representation and spatiotemporal relationship graph obtained in Step 1 as model input, feed it into the spatiotemporal layer. The time series module is used to obtain the dynamic multi-scale temporal dependencies of the nodes, resulting in a hidden state z that implicitly contains historical passenger flow change characteristics. This specifically includes the following sub-steps:
[0014] Step 2-1 employs temporal self-attention, specifically residual multi-head self-attention, to capture the dynamic temporal dependencies between nodes. Here, the attention score output by the temporal self-attention module in each spatiotemporal layer is added to the attention score obtained from the previous temporal self-attention layer to obtain the final output. By combining the temporal dependencies of shallow and deep layers, the connection between temporal self-attention modules in different spatiotemporal layers is enhanced, while also reducing the risk of gradient vanishing. The calculation formula is as follows:
[0015]
[0016]
[0017] in, These are the spatiotemporal features extracted from the (l-1)th spatiotemporal layer, which serve as the input to the lth spatiotemporal layer (N is the number of record nodes, and T is the time step). It is used to obtain Q (l) K (l) V (l) ∈R (l-1)×T×d The learnable parameter matrix d represents the hyperparameter dimension, d = 32. Furthermore, a multi-head attention mechanism is used to jointly learn the dependencies between different subspaces, concatenating the multi-head outputs from temporal attention, and then inputting them into a fully connected layer to obtain the final output of the spatiotemporal attention module:
[0018]
[0019] O = [O (1) O (2) , ..., O (H) ]
[0020] z=LayerNorm(Linear(Reshape(o))+X′)
[0021] Step 2-2, Temporal Convolution Module, using the dilated Inception module, through the formula By laterally concatenating dilated convolutions with different kernel sizes, the goal of extracting temporal patterns at various scales can be achieved. Where z∈R T Indicates input, This indicates a convolution kernel with ω distinct kernels [k1, k2, ... k]. ω A filter was constructed, and a gating structure was introduced, using ξ. i =σ(ξ′) 1,i )⊙μ(ξ′ 2,i ) controls the information flow of the temporal convolutional network, where σ represents the sigmoid activation function and μ represents the tanh activation function;
[0022] Steps 2-3 involve introducing residual connections to obtain the final output H of the timing module. t Enhance feature transfer;
[0023] Step 3, the graph ordinary differential equation module, represents the graph convolution with residual connections as a continuous graph convolutional network using tensor-based ordinary differential equations. This alleviates the oversmoothing problem common in graph neural networks and expands the spatial receptive field by increasing the depth of the graph convolutional network to obtain deeper spatiotemporal dependencies. The following is the definition of the graph ordinary differential equation:
[0024]
[0025] Among them, H l ∈R N×T×F Represented as a spatiotemporal tensor with implicit embedding of 1-layer nodes, × i Represented as tensor matrix multiplication on mode i, where A is the regularized adjacency matrix, U is the time transformation matrix, W is the feature transformation matrix, and H0 is the initial input of the graph neural network, the equation expands to:
[0026]
[0027] The above residual structure can be represented as a continuous ordinary differential network, and the expansion equation can be regarded as a Riemann sum of variable i from 0 to n, i.e.
[0028]
[0029] in, As n→∞, the above expression can be represented as the following integral:
[0030]
[0031] Differentiating both sides, we get:
[0032]
[0033] The general form of graphical ordinary differential equation networks can be easily obtained from the above differential equations.
[0034] Step 4: Repeat step 2 to obtain the new hidden state H using the timing module. t ;
[0035] Step 5: Iterate through steps 2-4, and pass the hidden state of each spatiotemporal layer to the output layer through skip connections to obtain the final prediction result.
[0036] As a further technical solution of the present invention, the output layer in step 5 adopts two feedforward neural network layers with ReLU activation functions.
[0037] The present invention also proposes an electronic system comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method proposed in the present invention.
[0038] Finally, the present invention proposes a computer-readable storage medium storing computer instructions for causing the computer to execute the method proposed in the present invention.
[0039] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0040] This invention proposes a subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations. It can effectively combine spatiotemporal features to model the complex temporal and spatial correlations of the subway network, effectively alleviate the oversmoothing problem commonly found in graph neural networks, and expand the spatial receptive field by increasing the depth of the graph convolutional network to obtain deeper spatiotemporal dependencies. This method can help achieve new state-of-the-art prediction performance on real-world subway passenger flow datasets. Attached Figure Description
[0041] Figure 1 This is a flowchart of the method of the present invention.
[0042] Figure 2 This is a schematic diagram illustrating the implementation process of the present invention. Detailed Implementation
[0043] The technical solutions provided by the present invention will be described in detail below with reference to specific implementations. It should be understood that the following specific implementations are only used to illustrate the present invention and are not intended to limit the scope of the present invention.
[0044] The proposed method for predicting subway passenger flow based on spatiotemporal graph ordinary differential equations, and its flowchart and architecture are as follows: Figure 1 and Figure 2 As shown, the method consists of K stacked spatiotemporal layers and an output layer. Each spatiotemporal layer comprises two temporal modules and one spatial module. The temporal modules use temporal attention and temporal convolution modules to capture the dynamic multi-scale temporal dependencies between nodes. The spatial dependency module captures spatiotemporal dynamics through tensor-based ordinary differential equations, modeling long-term spatiotemporal dependencies. The hidden states of each spatiotemporal layer are fed into the output layer via skip connections to obtain the final prediction result. This method effectively predicts subway passenger flow using a spatiotemporal model and has broad application potential.
[0045] Specifically, the process of this invention is as follows: Figure 1 As shown, it includes the following steps:
[0046] Step 1: Collect historical AFC data of the subway. Construct a spatiotemporal relationship graph based on spatial topology information and subway passenger flow data. Perform raw data preprocessing and represent the obtained passenger flow as a graph signal X∈R. N×F Specifically, it includes the following sub-steps:
[0047] (1-1) Collect historical subway AFC data, perform data preprocessing, and use the obtained passenger flow representation as the model input X∈R. N×F , where F is the number of features for each node, and here F is 2, representing the passenger flow entering the subway station and the passenger flow exiting the subway station, respectively;
[0048] (1-2) Construct a geographic adjacency graph using spatial topology information, set the weight between a node and its direct geographic neighbor to 1, and set the weight of others to 0.
[0049] (1-3) Construct a semantic similarity graph using historical passenger flow data, calculate the historical passenger flow similarity between nodes using the dynamic time-rounding method, select the nodes with the highest similarity as semantic neighbors according to a certain selection strategy, set the weight between nodes and semantic neighbors as node similarity weight, and set the others to 0.
[0050] (1-4) Construct a semantic correlation graph using historical passenger flow data, and utilize the origin-destination distribution to... To construct a global relevance matrix, where D(i,j) represents the total number of passengers entering station i from station j in the entire training set. Then, an edge construction is performed using a selection strategy, setting the weights between a node and its semantic neighbors as relevance weights, and setting the others to 0.
[0051] Step 2: Using the passenger flow representation and spatiotemporal relationship graph obtained in Step 1 as model input, feed it into the spatiotemporal layer. The time series module is used to obtain the dynamic multi-scale temporal dependencies of the nodes, resulting in a hidden state z that implies historical passenger flow change characteristics. This specifically includes the following sub-steps:
[0052] (2-1) Temporal self-attention is employed, using an improved multi-head self-attention mechanism, namely the residual multi-head self-attention module, to capture the dynamic temporal dependencies between nodes. Here, the attention score output by the temporal attention module in each spatiotemporal layer is equal to the sum of the attention scores of this layer and the previous layer. This combines the temporal dependencies of shallow and deep layers, thereby enhancing the connection effect between temporal self-attention in different spatiotemporal layers. At the same time, it can also reduce the risk of gradient vanishing. The calculation formula is as follows:
[0053]
[0054]
[0055] in, These are the spatiotemporal features extracted from the (l-1)th spatiotemporal layer, which serve as the input to the lth spatiotemporal layer (N is the number of record nodes, and T is the time step). It is used to obtain Q (l) K (l) V (l) ∈R (l-1)×T×d The learnable parameter matrix is obtained. Furthermore, a multi-head attention mechanism is used to jointly learn the dependencies between different subspaces, concatenating the multi-head outputs from temporal attention, and then inputting them into a fully connected layer to obtain the final output of the spatiotemporal attention module.
[0056]
[0057] O = [O (1) O (2) , ..., O (H) ]
[0058] z=LayerNorm(Linear(Reshape(o))+X′)
[0059] (2-2) Temporal convolution module, using dilated Inception, using the formula... By horizontally concatenating dilated convolutions with different kernel sizes, the goal of extracting temporal patterns at various scales can be achieved. Where z∈R T The input is represented as [k1, k2, ... k]. ω ] represents ω different convolutional kernels, and a gating structure is introduced, through ξ i =σ(ξ′) 1,i )⊙μ(ξ′ 2,i The information flow of the time-varying convolutional network is controlled by σ, where σ represents the sigmoid activation function and μ represents the tanh activation function.
[0060] (2-3) Introducing residual connections to obtain the final output H of the timing module t Enhance feature transfer.
[0061] Step 3, the graph ordinary differential equation module, represents the graph convolution with residual connections as a continuous graph convolutional network using tensor-based ordinary differential equations. This alleviates the oversmoothing problem common in graph neural networks and expands the spatial receptive field by increasing the depth of the graph convolutional network to obtain deeper spatiotemporal dependencies. The following is the definition of the graph ordinary differential equation:
[0062]
[0063] Among them, H l ∈R N×T×FRepresented as a spatiotemporal tensor with implicit embedding of 1-layer nodes, × i Represented as tensor matrix multiplication on mode i, where A is the regularized adjacency matrix, U is the time transformation matrix, W is the feature transformation matrix, and H0 is the initial input of the graph neural network, the equation expands to:
[0064]
[0065] The above residual structure can be represented as a continuous ordinary differential network, and the expansion equation can be regarded as a Riemann sum of variable i from 0 to n, i.e.
[0066]
[0067] in, As n→∞, the above expression can be represented as the following integral:
[0068]
[0069] Differentiating both sides, we get:
[0070]
[0071] The general form of graphical ordinary differential equation networks can be easily obtained from the above differential equations.
[0072] Step 4: Repeat step 2 to obtain a new hidden state H. t .
[0073] Step 5: Iterate through steps 2-4, and pass the hidden state of each spatiotemporal layer to the output layer through skip connections to obtain the final prediction result.
[0074] Example:
[0075] The following example uses data from the Hangzhou Metro to illustrate the metro passenger flow prediction method that integrates spatiotemporal features according to the present invention.
[0076] Experimental conditions: All experiments were implemented using PyTorch on an NVIDIA RTX 3090 24GB GPU.
[0077] Experimental parameter settings: During training, this embodiment sets the historical window size to 4, that is, it uses the observations of the past hour (4 × 15 minutes) to predict future features. The model of this invention is trained using mean absolute error loss and optimized using the Adam optimizer. The initial learning rate is 0.001, the batch size is 8, and an early stopping strategy is used.
[0078] In this embodiment, a prediction experiment was conducted on the Hangzhou Metro dataset, and the performance of the model of this invention was compared with seven latest benchmark models from 2021 to 2023. The results are shown in Table 1.
[0079] In the table, the input length for all datasets is I=4, while the prediction length O ranges from 1 to 4, representing predictions of future features 15 to 60 minutes in advance. Lower mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE) indicate better performance. Best results are highlighted in bold, and second-best results are highlighted in underline.
[0080]
[0081] Table 1
[0082] The results in Table 1 show that the method proposed in this invention is superior to other comparative methods.
[0083] Example 2: This example proposes a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the steps of the method described in this invention, which will not be repeated here.
[0084] Example 3: This example also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. It should be noted that when the processor executes the computer program, it corresponds to the specific steps of the method provided in this embodiment of the invention, possessing the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this example can be found in the method provided in this embodiment of the invention.
[0085] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0086] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0087] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.
Claims
1. A subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations, characterized in that, Includes the following steps: Step 1: Collect historical subway data, construct a spatiotemporal relationship diagram based on spatial topology information and subway passenger flow data, and represent the acquired passenger flow as a graph signal; Step 2: Using the passenger flow representation and spatiotemporal relationship graph obtained in Step 1 as input, feed it into the spatiotemporal layer. Use the time series module to obtain the dynamic multi-scale time dependence of the nodes, and obtain a hidden state that implies the historical passenger flow change characteristics. Specifically, it includes the following sub-steps: Step 2-1: Execute the temporal self-attention module, which uses a residual attention mechanism to capture the dynamic temporal dependencies between nodes. Specifically: First, the attention score output by the temporal self-attention module in each spatiotemporal layer is added to the attention score obtained from the previous temporal self-attention layer to obtain the final output. The calculation formula is as follows: , , in, It is the first The spatiotemporal features extracted from the first spatiotemporal layer are used as the second spatiotemporal features. Input to the spatiotemporal layer, To record nodes, For time step; , , They are used to obtain The learnable parameter matrix, , d represents the hyperparameter dimension. =32; Secondly, a multi-head self-attention mechanism is used to jointly learn the dependencies between different subspaces. Specifically, the multi-head outputs from temporal attention are concatenated and then fed into a fully connected layer to obtain the final output of the temporal attention module. , , , Step 2-2: Execute the temporal convolution module, using a dilated Inception layer, and apply the formula... Dilated convolutions with different kernel sizes are horizontally stitched together; among them... Indicates input, Indicates having Different convolution kernels A filter is introduced; a gating structure is used to... To control the information flow of the temporal convolutional network, where, express Activation function express Activation function; Steps 2-3 introduce residual connections to obtain the final output of the timing module. Enhance feature transfer; Step 3: Graph Ordinary Differential Equation Module. The residual-connected graph convolution is represented as a continuous graph convolution network by tensor-based ordinary differential equations. The spatial receptive field is expanded by increasing the depth of the graph convolution network to obtain deeper spatiotemporal dependencies. Step 4: Repeat step 2 to obtain a new hidden state. ; Step 5: Iterate through steps 2-4, and pass the hidden state of each spatiotemporal layer to the output layer through skip connections to obtain the final prediction result.
2. The subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations according to claim 1, characterized in that, Step 1 specifically includes the following sub-steps: Step 1-1: Collect historical subway AFC data; Steps 1-2 involve constructing a set of spatiotemporal relationship graphs based on spatial topology information, historical subway passenger flow data, and geographic adjacency graphs. Semantic similarity graph semantic correlation graph Where V is the set of vertices, , Representing the number of nodes, each node represents a subway station in the real world. Geographic adjacency graphs, semantic similarity graphs, and semantic relevance graphs share the same nodes but have different edges and edge weights. Let represent the edge sets of the geographic adjacency graph, semantic similarity graph, and semantic relevance graph, respectively. These represent the edge weights of all edges in the geographic adjacency graph, semantic similarity graph, and semantic relevance graph, respectively. Steps 1-3 involve processing the raw AFC data to obtain passenger flow data, and representing the obtained passenger flow as a graphical signal. F represents the number of features for each node, and F=2 represents the inbound and outbound passenger flow for each station.
3. The subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations according to claim 2, characterized in that, The geographical adjacency graph in steps 1-2 encodes the direct adjacency relationships between subway stations, setting the weight between a node and its direct geographical neighbors to 1, otherwise to 0.
4. The subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations according to claim 2, characterized in that, The semantic similarity graph in steps 1-2 calculates the historical passenger flow similarity between nodes using a dynamic time-rounding method. Based on a certain selection strategy, the nodes with the highest similarity are selected as semantic neighbors, with the weight set to the similarity between nodes and the others set to 0.
5. The subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations according to claim 2, characterized in that, The semantic correlation graph in steps 1-2 specifically utilizes the origin-destination distribution, i.e., through the formula... To construct a semantic relevance matrix, where, Indicates the entire training set from Station Enter The total number of passengers at the station is determined, and then an edge is constructed using a selection strategy, with the weight set to the correlation between nodes, or 0 otherwise.
6. The subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations according to claim 1, characterized in that, In step 3, the tensor-based ordinary differential equation is expressed as: , in, t represents the initial input to the graph neural network.
7. The subway passenger flow prediction method based on spatiotemporal graph ordinary differential equations according to claim 1, characterized in that, The output layer in step 5 uses two layers with... Feedforward neural network layer with activation function.
8. An electronic system comprising: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, characterized in that the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-7.
9. A computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method described in any one of claims 1-7.