Subway passenger flow volume prediction method and system based on multi-view space-time neural network
Through the multi-view space-time neural network combined with graph convolution and attention mechanism, the problem of insufficient space and time dependence in subway passenger flow prediction is solved, more accurate passenger flow prediction is achieved, and the efficiency and service quality of subway operation management are improved.
Patent Information
- Application Number
- CN202510306919.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-15
- Publication Date
- 2025-08-01
AI Technical Summary
The existing subway passenger flow forecasting methods fail to effectively consider the spatial relationship and multi-level time dependence between subway stations, and fail to fully utilize external factors such as weather and holidays, resulting in insufficient prediction accuracy.
Multi-view spatiotemporal neural network is adopted to construct subway topology maps, traffic similarity maps and traffic interaction maps, combining multi-hop graph convolutional networks and multi-view attention mechanisms to capture spatial dependence, and use BiGRU-TCN and BiGRU-stack GRU modules to process long and short-term time dependences, and fuse multi-head convolutional self-attention mechanisms to improve prediction accuracy.
It significantly improves the accuracy and robustness of subway passenger flow forecasts, optimizes subway scheduling decisions and resource allocation, improves operational management efficiency and service quality, and has the potential for commercial expansion.
Smart Images

Figure CN120408478A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of traffic prediction, and particularly relates to a subway passenger flow prediction method and system based on a multi-view spatio-temporal neural network. Background Art
[0002] With the acceleration of the urbanization process, the urban traffic pressure is increasing day by day. As a convenient and efficient public transportation tool, the subway has become an important means to relieve urban traffic congestion and meet the travel needs of residents. The prediction of subway passenger flow has become one of the key issues in subway operation management. The accuracy of passenger flow prediction directly affects the scheduling decision-making, resource allocation and service quality of the subway system.
[0003] Currently, subway passenger flow prediction methods mainly include statistical methods (such as regression analysis, time series analysis) and machine learning-based methods (such as support vector machines, random forests, etc.). Most of these methods focus on prediction from the time series perspective. Although they can capture short-term trend changes to a certain extent, due to ignoring the spatial dependence in the subway system, especially the spatial relationship and spatio-temporal interaction between subway stations, their prediction effects in complex traffic networks are not good.
[0004] In recent years, deep learning methods have been widely used in traffic flow prediction. Especially, methods such as graph neural networks (GNN) and gated recurrent units (GRU) have achieved good results. However, the existing methods still face the following problems when dealing with subway passenger flow prediction: First, the passenger flow in the subway system not only depends on time series features but also is closely related to the spatial relationship between subway stations. Existing methods rarely consider the influence of spatial factors such as spatial topology and functional similarity on passenger flow. Second, the subway passenger flow has complex long-term and short-term dependencies, and existing methods often have difficulty effectively dealing with this multi-level time dependence. Finally, the subway passenger flow is affected by various factors, such as external factors like weather, holidays, weekdays, and Sundays, but existing methods fail to fully utilize this external data to improve prediction accuracy.
[0005] Through the above analysis, the problems and defects of the existing technology are as follows:
[0006] Furthermore, collect the historical AFC data of the subway system, urban weather data, and time-related factor data:
[0007] Collect the historical AFC data of the subway, perform preprocessing on the original data, and represent the obtained passenger flow as a graph signal X. Specifically, it includes the following sub-steps:
[0008] (1-1) Construct a topological connection matrix T∈R N×NUsed to describe the actual connection relationship between stations, and normalize each row of T to generate the edge weight matrix W of the subway topology map t :
[0009]
[0010] (1 - 2) Construct the similarity matrix S ∈ R N×N To reflect the high consistency in the time series between subway stations with similar functions, and normalize S(i, j) to generate the edge weight matrix W of the subway topology map S :
[0011]
[0012] (1 - 3) Construct the association score matrix C ∈ R N×N Used to quantify the traffic intensity ratio from station j to station i, adopt the time decay factor β = 0.9 to achieve the temporal smoothing of the matrix, and normalize C(i, j) to generate the edge weight matrix W of the traffic interaction graph C :
[0013]
[0014] C(i, j) (t) = βC(i, j) (t-1) +(1 - β)C(i, j) (cur)
[0015]
[0016] Among them, D(i, j) represents the total passenger flow from station j to station i, and λ = 1 is the Laplace smoothing coefficient, which is used to handle the data sparsity problem.
[0017] Furthermore, the multi-hop graph convolutional network model gradually updates the feature representation of the target node through graph convolutional layers with multiple hops, enabling the model to learn the long-range spatial dependence between nodes in the subway network
[0018] (1) The passenger flow in the subway system not only depends on the time series features but is also closely related to the spatial relationship between subway stations. Existing methods rarely consider the influence of spatial factors such as spatial topology and functional similarity on passenger flow.
[0019] (2) There are complex long-term and short-term dependencies in subway passenger flow, and existing methods often have difficulty effectively handling this multi-level time dependence.
[0020] (3) Subway passenger flow is affected by various factors, such as external factors like weather, holidays, weekdays, and Sundays, but existing methods fail to fully utilize this external data to improve prediction accuracy. Summary of the Invention
[0021] In view of the problems existing in the prior art, the present invention provides a subway passenger flow prediction method based on a multi-view spatio-temporal neural network.
[0022] The present invention is implemented as follows. A subway passenger flow prediction method based on a multi-view spatio-temporal neural network includes:
[0023] Step 1, collect historical AFC data, urban weather data and time-related factor data of the subway system;
[0024] Among them, the AFC data includes the inflow and outflow of passengers at subway stations at different time points, the weather data includes the temperature, humidity and meteorological conditions of the city, and the time-related factor data includes information on weekdays, weekends and holidays;
[0025] Step 2, based on the physical topology structure of the subway system, the similarity of station traffic and the traffic interaction relationship, construct multiple spatially related graphs;
[0026] Among them, the spatially related graphs include a subway topology graph, a traffic similarity graph and a traffic interaction graph;
[0027] Step 3, use a multi-hop graph convolutional network model to gradually update the feature representation of the target node through graph convolutional layers with multiple hops, so that the model can learn the long-range spatial dependence relationship between nodes in the subway network;
[0028] Step 4, adopt a multi-perspective attention mechanism to perform weighted fusion on different spatially related graphs, dynamically evaluate the contribution of each spatial perspective to the passenger flow prediction result, and adaptively adjust the weights of the spatial graphs according to the evaluation result to optimize the learning process of spatial features;
[0029] Step 5, for the long-term time dependence of subway passenger flow, use the BiGRU-TCN module for modeling; for the short-term time dependence of subway passenger flow, use the BiGRU-stacked GRU module for modeling;
[0030] Step 6, improve the accuracy and robustness of subway passenger flow prediction through the local features in the long-term and short-term time dependence relationships by means of a multi-head convolutional self-attention mechanism; input the fused features into a fully connected layer for the final subway passenger flow prediction.
[0031] Furthermore, the spatially related graphs include a subway topology graph, a traffic similarity graph and a traffic interaction graph. The subway topology graph is constructed based on the physical location relationship of subway stations, the traffic similarity graph is constructed based on the historical passenger flow similarity between subway stations, and the traffic interaction graph is constructed based on the passenger flow direction and traffic intensity between subway stations;
[0032] The graph neural network module adopts a multi-hop R-GAT model, where the node features are gradually updated through graph convolutional layers with multiple hops to capture spatial dependencies at different levels, and the convolutional operation of each hop adjusts the weights of adjacent nodes through an adaptive learning mechanism;
[0033] The multi-perspective attention mechanism dynamically evaluates the importance of each perspective in passenger flow prediction by calculating the attention coefficients of different spatial perspectives, and adjusts its weight in the feature fusion process according to the contributions of each perspective;
[0034] The BiGRU-TCN module captures the bidirectional temporal dependencies of subway passenger flow data through a bidirectional GRU (BiGRU) network, and combines a temporal convolutional network (TCN) through convolutional operations that expand the receptive field;
[0035] The BiGRU-stacked GRU module adopts a stacked structure of multiple GRU units;
[0036] The multi-head convolutional self-attention mechanism captures local trend features in different time periods by processing multiple convolutional self-attention heads in parallel, and performs weighted fusion on the prediction results of the long-term and short-term time branches;
[0037] The time factors include weekdays, weekends, morning and evening rush hours, and off-peak hours, which are processed through one-hot encoding and input into the model together with other data features, fully considering the impact of time factors on subway passenger flow;
[0038] The weather data includes the temperature, humidity, meteorological conditions, and special weather events of the city. The weather data is input into the graph neural network and temporal modeling module together with other spatial and temporal features to jointly optimize the passenger flow prediction results.
[0039] dependency relationship; specifically, it includes the following sub-steps:
[0040] (2-1) Update the edge attention, and the calculation formula is as follows:
[0041]
[0042] where h i and h j represent the feature representations of nodes i and j, r k represents its relationship type, and represent the node type-aware transformation matrices, W r represents the relationship type-aware transformation matrix, δ represents the activation function, v T represents the weight vector applicable to calculating the attention score; normalize the edge attention:
[0043]
[0044] (2-2) Diffuse the attention for each type of relationship:
[0045]
[0046] where, θ k is the diffusion coefficient, is the k-hop attention matrix for relationship type r;
[0047] (2-3) Perform feature aggregation of multi-hop attention and update the updated output of each layer of node i
[0048]
[0049] Furthermore, the multi-view attention mechanism is adopted to perform weighted fusion on different spatially related graphs, dynamically evaluate the contribution of each spatial view to the passenger flow prediction result, and adaptively adjust the weight of the spatial graph according to the evaluation result to optimize the learning process of spatial features; specifically, it includes the following sub-steps:
[0050] (3-1) Through summarizing the pooling results of all views, the pooling layer can obtain a vector z representing the global information of all views;
[0051]
[0052] z = z topo ||z simi ||z inter
[0053] (3-2) The attention layer applies an attention operation to the scalar z, measures the weight of each view through s, and weighted aggregates the information of all views to obtain the feature H (l+1) ;
[0054] s = σ(W2, ReLU(W1z))
[0055]
[0056] Encode the weather conditions and time status, and fuse them with the output of graph convolution as the input for joint prediction; specifically, it includes the following sub-steps:
[0057] (4-1) For weather conditions, the meteorological variables considered in this patent include three parts, namely urban temperature (in degrees Celsius), urban relative humidity (in percentage), and various meteorological conditions such as sunny, cloudy, light rain, heavy rain, snow, and fog in the city;
[0058] (4-2) For the daytime and weekly situations, this patent divides the subway operation time based on the morning and evening rush hours for the daytime situation, and divides the weekly situation into weekdays and weekends; among them, 6 a.m.–7 a.m. is the early stage of the morning rush hour, 7 a.m.–9 a.m. is the morning rush hour, 9 a.m.–10 a.m. is the late stage of the morning rush hour, 10 a.m.–4 p.m. is the flat peak period, 4 p.m.–5 p.m. is the early stage of the evening rush hour, 5 p.m.–7 p.m. is the evening rush hour, and 7 p.m.–10 p.m. is the late stage of the evening rush hour; for the above discrete influencing factors, they are all represented by the one-hot encoding method;
[0059] E t ={aT t ,aH t ,aS t ,hT t ,hW t ; t = t0 - R + 1, t0 - R,... t0}
[0060] Among them, aT t represents temperature, aH t represents humidity, aS t represents weather conditions, hT t represents daytime, hW t represents the weekly subscript t represents the timestamp, R represents the length of the historical record, and t0 represents the initial moment;
[0061] Divide the short and long time regions and capture features separately; specifically, it includes the following sub-steps:
[0062] (5-1) The fusion of the hidden feature state output obtained through graph convolution and the external feature E t is The short-term time region can be expressed as Among them, Ls represents the length of the short-term dependence relationship; the long-term time region can be expressed as Among them, L T represents the length of the long-term dependence relationship;
[0063] (5-2) Since both the short-term and long-term feature captures use the Bi-GRU (Bidirectional GRU) layer, the Bidirectional GRU is introduced uniformly; the Bidirectional GRU layer includes two layers, the leftward and the rightward. Among them, the expression of the rightward GRU is as follows:
[0064]
[0065] Among them, Θ rx represents the graph convolution parameters between the feature state H t and the input X t ; Θ rhRepresents the reset gate R in the GRU t and the hidden feature state between the graph convolution parameters, Θ zx , Θ zh , Θ nx , Θ nh represents a similar meaning; b r , b z , b n represents the bias term; the expression of the left - hand GRU is similar to that of the right - hand GRU, except for the calculation time step and input order, as shown below:
[0066]
[0067] The final output H of the Bi - GRU t is the concatenation of the left - hand and right - hand outputs, which can be expressed as:
[0068]
[0069] (5 - 3) Further extracts long - term temporal features by stacking a Temporal Convolutional Network (TCN); the dilated causal convolution structure of the TCN can effectively capture long - distance sequence data dependencies by expanding the receptive field; specifically, for the Bi - GRU output time series H with feature vector h i and filter f: {0, 1,..., k - 1}, the process of calculating the dilated convolution of sequence element x is as shown in the formula:
[0070]
[0071] where d is the dilation coefficient, x - d·j is the past direction, and k is the size of the filter;
[0072] In addition, the TCN uses a residual network to solve problems such as vanishing gradients and overfitting; the calculation formula of the i - th residual module is as shown in the formula:
[0073]
[0074] where, H i is the output result of the i - th residual module, H i-1 is the output result of the previous residual module, is the mapping function of the residual module; after passing through the last residual module, the final output result H l is obtained;
[0075] (5 - 4) Can capture finer - grained changes in passenger flow through deep - level time - series modeling by using a stacked GRU structure after the BiGRU module, and obtain the final output result H s ;
[0076] Considering that the traditional multi-head self-attention mechanism performs matching based on point values and cannot perceive local trends, a multi-head local self-attention mechanism is used in the adaptive fusion layer to capture local trend features in traffic data, which specifically includes the following sub-steps:
[0077] (6-1) For the query (Q) and key (K) in the multi-head local self-attention mechanism, 1D convolution is used to capture local context features. To ensure that the output at each moment only depends on the current and previous inputs and is not affected by future inputs, causal convolution is used for the calculation of value V:
[0078] Q i = Conv1D(X i , W Q )
[0079] K i = Conv1D(X i , W K )
[0080] V i = CausalConv1D(X i , W V )
[0081] where Conv1D represents a one-dimensional convolution operation, and W Q , W K , W V are the query weight matrix, key weight matrix, and value weight matrix respectively;
[0082] (6-2) Use scaled dot-product attention to calculate attention scores through the query (Q) and key (K), apply the calculated attention weights to the value (V), and splice together the outputs of each head. Through a linear transformation, the final output is obtained, and the outputs of the short-term branch and long-term branch are weighted and combined to obtain the final fused feature representation:
[0083]
[0084] where and are the output linear transformation matrices corresponding to the short-term branch and long-term branch respectively; α s and α l are the weighting coefficients of the short-term and long-term branches respectively, controlling the contributions of the long and short terms in the final prediction.
[0085] Furthermore, the local features in the long-term and short-term time dependencies of the multi-head convolutional self-attention mechanism are used to improve the accuracy and robustness of subway passenger flow prediction; the fused features are input into the fully connected layer for the final subway passenger flow prediction:
[0086] The fused features are input into a prediction module composed of fully connected layers to obtain the final prediction result:
[0087] y = W out ·h fusion + b out
[0088] where W out and b out are the weight matrix and bias vector of the output layer, respectively.
[0089] Another object of the present invention is to provide a subway passenger flow prediction system based on a multi-view spatio-temporal neural network, including:
[0090] A data acquisition module for collecting subway AFC data, weather data, and time factor data;
[0091] A graph neural network module for processing space-related graphs and capturing the spatial dependence between subway stations;
[0092] A time dependence modeling module, including a BiGRU-TCN module and a BiGRU-stacked GRU module, for capturing long-term and short-term time dependencies;
[0093] A feature fusion module for fusing spatial and temporal features through a multi-head convolutional self-attention mechanism;
[0094] A prediction module for outputting the final prediction result of the subway passenger flow through a fully connected layer.
[0095] Another object of the present invention is to provide a computer device, which includes a memory and a processor. When the computer program stored in the memory is executed by the processor, the processor executes the steps of the subway passenger flow prediction method based on the multi-view spatio-temporal neural network.
[0096] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to execute the steps of the subway passenger flow prediction method based on the multi-view spatio-temporal neural network.
[0097] Another object of the present invention is to provide an information data processing terminal for implementing the subway passenger flow prediction system based on the multi-view spatio-temporal neural network.
[0098] Combined with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are:
[0099] First, the present invention proposes a deep learning method combining graph neural network, multi-view attention mechanism and time series modeling. This method effectively solves the deficiencies in existing subway passenger flow prediction, such as ignoring spatial dependence, multi-level time dependence and insufficient utilization of external factors.
[0100] The present invention proposes a deep learning method combining graph attention network (GAT), multi-view attention mechanism and time series modeling to improve the accuracy of subway passenger flow prediction.
[0101] First, the present invention collects subway historical AFC data, urban weather data and time factors, and constructs multiple spatial correlation graphs based on the physical topology of the subway, station flow similarity and flow interaction relationship. These graph structures provide rich information for capturing spatial dependence in the subway network. Then, a multi-hop graph convolutional network (R-GAT) is used to process these spatial graphs, and the node features are gradually updated through multi-layer graph convolution to capture the spatial relationships between different stations. At the same time, combined with the multi-view attention mechanism, the contributions of different spatial views to passenger flow prediction are dynamically evaluated, so as to optimize the learning process of spatial features.
[0102] In terms of time dependence modeling, the present invention respectively adopts two models, BiGRU-TCN (Bidirectional GRU - Temporal Convolutional Network) and BiGRU - Stacked GRU (Bidirectional GRU stacked structure), to effectively model long-term and short-term time dependencies. The BiGRU-TCN module captures bidirectional temporal dependencies through bidirectional GRU, and at the same time expands the receptive field through the temporal convolutional network (TCN) to enhance the model's ability to capture long-term dependencies; while the BiGRU - Stacked GRU structure processes short-term time dependencies more precisely by stacking GRU units, especially during peak hours and emergencies. Finally, a multi-head convolutional self-attention mechanism is adopted to perform local feature extraction on the prediction results from the long-term and short-term time branches, further improving the prediction accuracy.
[0103] The subway passenger flow prediction method based on multi-view spatio-temporal neural network proposed by the present invention has strong theoretical value and application prospects, and can provide more accurate decision-making support for subway operation management, improving the operation efficiency and service quality of the subway system.
[0104] Second, by integrating a multi-view spatio-temporal neural network, the present invention can significantly improve the accuracy of subway passenger flow prediction, thereby optimizing subway scheduling decisions, resource allocation, and service quality. Its expected benefits cover multiple aspects: accurate prediction can reduce the phenomenon of empty or overloaded trains, lower energy waste and vehicle wear, thus achieving cost reduction in operation; it can dynamically adjust the shift density, relieve congestion during peak hours, enhance the passenger experience, and achieve service quality improvement; it has the potential for commercial expansion and can be extended to other urban rail transit systems, and even to fields such as buses and shared mobility, forming a standardized prediction tool; there are also data value-added applications. By combining external factors such as weather and holidays, it can provide data support for advertising placement and commercial network layout.
[0105] Traditional methods for subway passenger flow prediction face bottlenecks that are difficult to break through. On the one hand, traditional models separate space and time from each other, making it difficult to effectively couple the spatial relationships between subway stations and multi-level time dependencies. On the other hand, external factors are not fully utilized, and external data such as weather conditions and weekly cycles are not deeply integrated into the prediction model. The present invention has adopted an innovative strategy to successfully overcome this technical problem. At the level of spatio-temporal joint modeling, BiGRU-stacked GRU is used to capture short-term passenger flow mutations, TCN is used to expand the long-term receptive field, and combined with multi-hop graph convolution to achieve synchronous optimization of spatial and temporal features. In terms of multi-source data fusion, factors such as weather and time are encoded as feature vectors and dynamically fused with the output of graph convolution, significantly enhancing the model's adaptability to complex scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0106] Figure 1 is a flowchart of a subway passenger flow prediction method based on a multi-view spatio-temporal neural network provided by an embodiment of the present invention.
[0107] Figure 2 is a structural block diagram of a subway passenger flow prediction system based on a multi-view spatio-temporal neural network provided by an embodiment of the present invention.
[0108] Figure 3 is a detailed framework diagram of a subway passenger flow prediction system based on a multi-view spatio-temporal neural network provided by an embodiment of the present invention.
[0109] Figure 4 is a home page diagram of the system provided by an embodiment of the present invention.
[0110] Figure 5 is a predicted map of passenger flow conditions provided by an embodiment of the present invention.
[0111] Figure 6 is a predicted trend chart provided by an embodiment of the present invention.
[0112] Figure 7 is a comparison chart of root mean square errors of different models provided by an embodiment of the present invention.
[0113] Figure 8 It is a comparison graph of the mean absolute error of different models provided by the embodiments of the present invention.
[0114] Figure 9 It is a comparison graph of the mean absolute percentage error of different models provided by the embodiments of the present invention. Detailed implementation manners
[0115] In order to make the objectives, technical solutions and advantages of the present invention more clear and understandable, the present invention will be further described in detail below in conjunction with embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0116] As Figure 1 shown, a subway passenger flow prediction method based on a multi-view spatio-temporal neural network provided by an embodiment of the present invention includes the following steps:
[0117] S101, collect historical AFC data, urban weather data and time-related factor data of the subway system;
[0118] Among them, the AFC data includes the inflow and outflow of passengers at different time points of subway stations, the weather data includes the temperature, humidity and meteorological conditions of the city, and the time-related factor data includes information on weekdays, weekends and holidays;
[0119] S102, construct a plurality of spatially related graphs based on the physical topology structure of the subway system, the similarity of station flows and the flow interaction relationship;
[0120] Among them, the spatially related graphs include a subway topology graph, a flow similarity graph and a flow interaction graph;
[0121] S103, use a multi-hop graph convolutional network model to gradually update the feature representation of the target node through graph convolutional layers with multiple hops, so that the model can learn the long-range spatial dependence relationship between nodes in the subway network;
[0122] S104, adopt a multi-perspective attention mechanism to perform weighted fusion on different spatially related graphs, dynamically evaluate the contribution of each spatial perspective to the passenger flow prediction result, and adaptively adjust the weight of the spatial graph according to the evaluation result to optimize the learning process of spatial features;
[0123] S105, for the long-term time dependence of subway passenger flow, use the BiGRU-TCN module for modeling; for the short-term time dependence of subway passenger flow, use the BiGRU-stacked GRU module for modeling;
[0124] S106. Improve the accuracy and robustness of subway passenger flow prediction by enhancing local features in long-term and short-term time dependencies through a multi-head convolutional self-attention mechanism; input the fused features into a fully connected layer for final subway passenger flow prediction.
[0125] The spatial correlation graph provided by the embodiments of the present invention includes a subway topology graph, a flow similarity graph, and a flow interaction graph. The subway topology graph is constructed based on the physical location relationship of subway stations. The flow similarity graph is constructed based on the historical passenger flow similarity between subway stations. The flow interaction graph is constructed based on the passenger flow direction and flow intensity between subway stations.
[0126] The graph neural network module adopts a multi-hop R-GAT model. Among them, the node features are gradually updated through the graph convolutional layer with multiple hops to capture spatial dependency relationships at different levels, and the convolutional operation of each hop adjusts the weights of adjacent nodes through an adaptive learning mechanism.
[0127] The multi-perspective attention mechanism dynamically evaluates the importance of each perspective in passenger flow prediction by calculating the attention coefficients of different spatial perspectives, and adjusts its weight in the feature fusion process according to the contributions of each perspective.
[0128] The BiGRU-TCN module captures the bidirectional temporal dependence of subway passenger flow data through a bidirectional GRU (BiGRU) network, and combines with a temporal convolutional network (TCN) through convolutional operations that expand the receptive field.
[0129] The BiGRU-stacked GRU module has a stacked structure of multiple GRU units.
[0130] The multi-head convolutional self-attention mechanism captures local trend features in different time periods by parallelly processing multiple convolutional self-attention heads, and performs weighted fusion on the prediction results of the long-term and short-term time branches.
[0131] The time factors include weekdays, weekends, morning and evening peak periods, and off-peak periods, which are processed through one-hot encoding and input into the model together with other data features, fully considering the impact of time factors on subway passenger flow.
[0132] The weather data includes the temperature, humidity, meteorological conditions, and special weather events of the city. The weather data is input into the graph neural network and temporal modeling module together with other spatial and time features to jointly optimize the passenger flow prediction results.
[0133] The embodiments of the present invention provide for collecting historical AFC data, urban weather data, and time-related factor data of the subway system:
[0134] Collect the historical AFC data of the subway, preprocess the original data, and represent the obtained passenger flow as a graph signal X. The specific steps are as follows:
[0135] (1-1) Construct the topological connection matrix A p ∈R N×N Used to describe the actual connection relationship between stations:
[0136]
[0137] (1-2) Calculate the sequence similarity distance D(X,Y) through the Fast-DTW algorithm and construct the similarity matrix A s ∈R N×N To reflect the high consistency in the time series between subway stations with similar functions:
[0138]
[0139] (1-3) Construct the association score matrix A c ∈R N×N Used to quantify the traffic intensity ratio from station j to station i:
[0140]
[0141] Among them, T(i,j) represents the total passenger flow from station j to station i, and λ = 0.1 is the Laplace smoothing coefficient, which is used to deal with the data sparsity problem.
[0142] The embodiment of the present invention provides a multi-hop graph convolutional network model to gradually update the feature representation of the target node through graph convolutional layers with multiple hops, enabling the model to learn the long-range spatial dependence relationship between nodes in the subway network; the specific steps are as follows:
[0143] (2-1) Update the edge attention, and the calculation formula is as follows:
[0144]
[0145] Among them, h i and h j represent the feature representations of node i and node j, r k represents its relationship type, and represent the node type-aware transformation matrices, W r represents the relationship type-aware transformation matrix, δ represents the activation function, v T represents the weight vector applicable to calculating the attention score; normalize the edge attention:
[0146]
[0147] (2-2) Diffuse the attention for each relationship type respectively:
[0148]
[0149] Among them, θ k is the diffusion coefficient, is the k-hop attention matrix for relationship type r;
[0150] (2-3) Perform feature aggregation of multi-hop attention and update the updated output of each layer of node i
[0151]
[0152]
[0153] The embodiment of the present invention provides a method for weighted fusion of different spatially related graphs by using a multi-perspective attention mechanism, dynamically evaluating the contribution of each spatial perspective to the passenger flow prediction result, and adaptively adjusting the weight of the spatial graph according to the evaluation result to optimize the learning process of spatial features; specifically, it includes the following sub-steps:
[0154] (3-1) The pooling layer can obtain a vector z representing the global information of all views by summarizing the pooling results of all views;
[0155]
[0156] z = z p ||z s ||z c
[0157] Among them, H p 、H s 、H c are the spatial feature matrices of each view respectively, and G pool is the global average pooling operation.
[0158] (3-2) The attention layer applies an attention operation to the scalar z, measures the weight of each view through s, and weighted aggregates the information of all views to obtain the feature H (l+1) ;
[0159] s = σ(W2, ReLU(W1z))
[0160]
[0161] Encode the weather conditions and time status, and fuse them with the output of graph convolution as the input for joint prediction; specifically, it includes the following sub-steps:
[0162] (4-1) For weather conditions, the meteorological variables considered in this patent include three parts, namely urban temperature (in degrees Celsius), urban relative humidity (in percentage), and various weather conditions such as sunny, cloudy, light rain, heavy rain, snow, and fog in the city;
[0163] (4-2) For daily and weekly situations, this patent divides the subway operation time with the morning and evening rush hours as the criteria for the daily situation and divides the weekly situation according to weekdays and weekends; among them, 6 a.m. – 7 a.m. is the early stage of the morning rush hour, 7 a.m. – 9 a.m. is the morning rush hour, 9 a.m. – 10 a.m. is the late stage of the morning rush hour, 10 a.m. – 4 p.m. is the flat peak period, 4 p.m. – 5 p.m. is the early stage of the evening rush hour, 5 p.m. – 7 p.m. is the evening rush hour, and 7 p.m. – 10 p.m. is the late stage of the evening rush hour; for the above discrete influencing factors, they are all represented by the one-hot encoding method;
[0164] E t ={aT t ,aH t ,aS t ,hT t ,hW t ; t = t0 - R + 1, t0 - R,... t0}
[0165] Among them, aT t represents temperature, aH t represents humidity, aS t represents weather conditions, hT t represents daily, hW t represents the weekly subscript t represents the timestamp, R represents the historical record length, and t0 represents the initial time;
[0166] Divide the long and short time regions and capture features separately; specifically, it includes the following sub-steps:
[0167] (5-1) The fusion of the hidden feature state output obtained by graph convolution with the external feature E t is The short-term time region can be expressed as Among them, Ls represents the length of the short-term dependence relationship; the long-term time region can be expressed as Among them, L T represents the length of the long-term dependence relationship;
[0168] (5-2) Since both the long and short time feature captures use the Bi-GRU (Bidirectional GRU) layer, the Bidirectional GRU is introduced uniformly; the Bidirectional GRU layer includes two layers, the leftward and the rightward layers. Among them, the expression of the rightward GRU is as follows:
[0169]
[0170] where Θ rx represents the graph convolution parameter between the feature state H t and the input X t ; Θ rh represents the reset gate R in the GRU t and the hidden feature state ; Θ zx , Θ zh , Θ nx , Θ nh represent similar meanings; b r , b z , b n represents the bias term; the expression of the left - hand GRU is similar to that of the right - hand GRU, except for the calculation time step and input order, as shown below:
[0171]
[0172]
[0173] The final output H of the Bi - GRU t is the concatenation of the left - hand and right - hand outputs, which can be expressed as:
[0174]
[0175] (5 - 3) Further extracts long - term temporal features by stacking a Temporal Convolutional Network (TCN); the dilated causal convolution structure of the TCN can effectively capture long - distance sequence data dependencies by expanding the receptive field; specifically, for the Bi - GRU output time series H with the feature vector h i and the filter f:{0,1,...,k - 1}, the process of calculating the dilated convolution of the sequence element x is as shown in the formula:
[0176]
[0177] where d is the dilation coefficient, x - d·j is the past direction, and k is the size of the filter;
[0178] In addition, the TCN uses a residual network to solve problems such as vanishing gradients and overfitting; the calculation formula of the i - th residual module is as shown in the formula:
[0179]
[0180] where H i is the output result of the i - th residual module, H i-1 is the output result of the previous residual module, It is the mapping function of the residual module; after passing through the last residual module, the final output result H is obtained l ;
[0181] (5-4) By using a stacked GRU structure after the BiGRU module, finer-grained changes in passenger flow can be captured through deep time series modeling, and the final output result H is obtained s ;
[0182] Considering that the traditional multi-head self-attention mechanism is based on point values for matching and cannot perceive local trends, a multi-head local self-attention mechanism is used in the adaptive fusion layer to capture local trend features in traffic data, which specifically includes the following sub-steps:
[0183] (6-1) For the query (Q) and key (K) in the multi-head local self-attention mechanism, 1D convolution is used to capture local context features. To ensure that the output at each moment only depends on the current and previous inputs and is not affected by future inputs, causal convolution is used for the calculation of value V:
[0184] Q i =Conv1D(X i ,W Q )
[0185] K i =Conv1D(X i ,W K )
[0186] V i =CausalConv1D(X i ,W V )
[0187] Among them, Conv1D represents a one-dimensional convolution operation, W Q ,W K , and W V are the query weight matrix, key weight matrix, and value weight matrix respectively;
[0188] (6-2) Use scaled dot-product attention to calculate attention scores through the query (Q) and key (K), apply the calculated attention weights to the value (V), concatenate the outputs of each head together, and obtain the final output through a linear transformation, and perform weighted combination on the outputs of the short-term branch and long-term branch to obtain the final fused feature representation:
[0189]
[0190] Among them, and are the output linear transformation matrices corresponding to the short-term branch and long-term branch respectively; αs and α l are the weighted coefficients of the short-term and long-term branches respectively, controlling the contributions of the long-term and short-term in the final prediction.
[0191] The embodiment of the present invention provides a method for improving the accuracy and robustness of subway passenger flow prediction by using local features in long-term and short-term time dependencies through a multi-head convolutional self-attention mechanism; inputting the fused features into a fully connected layer for final subway passenger flow prediction:
[0192] Input the fused features into a prediction module composed of fully connected layers to obtain the final prediction result:
[0193] y = W out ·h fusion + b out
[0194] where W out and b out are the weight matrix and bias vector of the output layer respectively.
[0195] As Figure 2 shown, a subway passenger flow prediction system based on a multi-view spatio-temporal neural network provided by the embodiment of the present invention includes:
[0196] A data acquisition module for collecting subway AFC data, weather data, and time factor data;
[0197] A graph neural network module for processing spatial-related graphs and capturing the spatial dependencies between subway stations;
[0198] A time dependency modeling module, including a BiGRU-TCN module and a BiGRU-stacked GRU module, for capturing long-term and short-term time dependencies;
[0199] A feature fusion module for fusing spatial and temporal features through a multi-head convolutional self-attention mechanism;
[0200] A prediction module for outputting the final prediction result of subway passenger flow through a fully connected layer.
[0201] Another object of the present invention is to provide a computer device, which includes a memory and a processor. When the computer program stored in the memory is executed by the processor, the processor executes the steps of the subway passenger flow prediction method based on the multi-view spatio-temporal neural network.
[0202] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which when executed by a processor, causes the processor to execute the steps of the subway passenger flow prediction method based on the multi-view spatio-temporal neural network.
[0203] Another object of the present invention is to provide an information data processing terminal for implementing the subway passenger flow prediction system based on the multi-view spatio-temporal neural network.
[0204] Specific implementation of the present invention:
[0205] The method flow and its architecture of a subway passenger flow prediction method based on deep learning proposed by the present invention are respectively as Figure 1 and Figure 3 shown. First, collect subway historical AFC data, weather data and time-related factors, and construct a spatial dependence graph based on physical topology, flow similarity and flow interaction; secondly, use a graph neural network (R-GAT) and a multi-view attention mechanism to deeply explore the spatial dependence relationship between subway stations; then, combine the BiGRU-TCN and BiGRU-stacked GRU models to effectively capture long-term and short-term time dependence features respectively; finally, capture the local correlation of time features through a multi-head convolutional self-attention mechanism, and input it into a fully connected layer for final passenger flow prediction. This method significantly improves the accuracy of subway passenger flow prediction and the robustness of the model on the basis of comprehensively considering spatial, temporal and external factors.
[0206] Specifically, the process of the present invention includes the following steps:
[0207] Step 1: Collect subway historical AFC data, perform preprocessing on the original data, and represent the obtained passenger flow as a graph signal X, which specifically includes the following sub-steps:
[0208] (1-1) Construct a topological connection matrix A p ∈R N×N to describe the actual connection relationship between stations:
[0209]
[0210] (1-2) Calculate the sequence similarity distance D(X,Y) through the Fast-DTW algorithm, and construct a similarity matrix A s ∈R N×N to reflect the high consistency in time series between subway stations with similar functions:
[0211]
[0212] (1-3) Construct an association score matrix A c ∈R N×N to quantify the flow intensity ratio from station j to station i:
[0213]
[0214] Among them, T(i, j) represents the total passenger flow from station j to station i, and λ = 0.1 is the Laplace smoothing coefficient, which is used to deal with the problem of data sparsity.
[0215] Step 2: Using the passenger flow representation and the spatio-temporal relationship graph group obtained in Step 1 as the input space of the model, adjust the capture layer. Through multi-hop R-GAT, the heterogeneous graph of three different relationships is gradually updated in the form of multi-hop graph convolution to represent the features of the target node, enabling the model to learn the long-range dependencies between nodes in the subway network at multiple levels. Specifically, it includes the following sub-steps:
[0216] (2-1) Update the edge attention, and the calculation formula is as follows:
[0217]
[0218] Among them, h i and h j represent the feature representations of node i and node j, r k represents its relationship type, and represent the transformation matrices of node type perception, W r represents the transformation matrix of relationship type perception, δ represents the activation function, and v T represents the weight vector applicable to calculating the attention score. Normalize the edge attention:
[0219]
[0220] (2-2) Diffuse the attention of each relationship type respectively:
[0221]
[0222] Among them, θ k is the diffusion coefficient, is the k-hop attention matrix for relationship type r.
[0223] (2-3) Perform feature aggregation of multi-hop attention and update the update output of each layer of node i
[0224]
[0225] Step 3: Use the multi-view attention mechanism to automatically adjust its weight according to the actual contribution of each view in the task, where the multi-view attention structure includes a pooling layer and an attention layer. Specifically, it includes the following sub-steps:
[0226] (3-1) The pooling layer can obtain a vector z representing the global information of all views by summarizing the pooling results of all views.
[0227]
[0228] z = z p ||z s ||z c
[0229] (3 - 2) The attention layer applies an attention operation to the scalar z, measures the weight of each view through s, and aggregates the information of all views by weighting to obtain the feature H (l+1) .
[0230] s = σ(W2, ReLU(W1z))
[0231]
[0232] Step 4: Encode the weather conditions and time status, and fuse them with the output of the graph convolution as the input for joint prediction. Specifically, it includes the following sub - steps:
[0233] (4 - 1) For the weather conditions, the meteorological variables considered in this patent include three parts, namely the urban temperature (in degrees Celsius), the urban relative humidity (in percentage), and various meteorological conditions such as sunny, cloudy, light rain, heavy rain, snow, and fog in the city.
[0234] (4 - 2) For the daytime and weekly situations, this patent divides the subway operation time based on the morning and evening rush hours for the daytime situation, and divides the weekly situation according to weekdays and weekends. Among them, 6 a.m. - 7 a.m. is the early stage of the morning rush hour, 7 a.m. - 9 a.m. is the morning rush hour, 9 a.m. - 10 a.m. is the late stage of the morning rush hour, 10 a.m. - 4 p.m. is the flat peak period, 4 p.m. - 5 p.m. is the early stage of the evening rush hour, 5 p.m. - 7 p.m. is the evening rush hour, and 7 p.m. - 10 p.m. is the late stage of the evening rush hour. For the above - mentioned discrete influencing factors, they are all represented by the one - hot encoding method.
[0235] E t ={aT t , aH t , aS t , hT t , hW t ; t = t0 - R + 1, t0 - R,... t0}
[0236] Among them, aT t represents the temperature, aH t represents the humidity, aS t represents the weather condition, hT t represents the daytime, hW t represents the weekly subscript t represents the timestamp, R represents the historical record length, and t0 represents the initial time.
[0237] Step 5: Divide the long and short time regions and capture features separately. Specifically, it includes the following sub-steps:
[0238] (5-1) Fuse the output of the hidden feature state obtained through graph convolution with the external feature E t as The short time region can be expressed as where Ls represents the length of the short-term dependence. The long time region can be expressed as where L T represents the length of the long-term dependence.
[0239] (5-2) Since both the long and short time feature captures use the Bi-GRU (Bidirectional GRU) layer, the Bidirectional GRU will be introduced uniformly. The Bidirectional GRU layer includes two layers, a leftward layer and a rightward layer. Among them, the expression of the rightward GRU is as follows:
[0240]
[0241] where Θ rx represents the graph convolution parameters between the feature state H t and the input X t , Θ rh represents the graph convolution parameters between the reset gate R t in the GRU and the hidden feature state , Θ zx , Θ zh , Θ nx , Θ nh represent similar meanings. b r , b z , b n represent the bias terms. The expression of the leftward GRU is similar to that of the rightward GRU, except that the time steps and input orders for calculation are different, as shown below:
[0242]
[0243] The final output H t of the Bi-GRU is the concatenation of the leftward and rightward outputs, which can be expressed as:
[0244]
[0245] (5-3) Further extract long-term time features by stacking the Temporal Convolutional Network (TCN). The dilated causal convolution structure of the TCN can effectively capture the long-distance sequence data dependence by expanding the receptive field. Specifically, for the feature vector h iThe process of calculating the extended convolution of the sequence element x from the Bi-GRU output time series H and the filter f: {0, 1, ..., k-1} is as shown in the formula:
[0246]
[0247] where d is the dilation coefficient, x - d·j is the past direction, and k is the size of the filter.
[0248] In addition, TCN uses a residual network to solve problems such as vanishing gradients and overfitting. The calculation formula of the i-th residual module is as shown in the formula:
[0249]
[0250] where H i is the output result of the i-th residual module, H i-1 is the output result of the previous residual module, is the mapping function of the residual module. After passing through the last residual module, the final output result H l is obtained.
[0251] (5-4) By using a stacked GRU structure after the BiGRU module to capture finer-grained changes in passenger flow through deep time series modeling, the final output result H s is obtained.
[0252] Step 6: Considering that the traditional multi-head self-attention mechanism matches based on point values and cannot perceive local trends, this patent uses a multi-head local self-attention mechanism in the adaptive fusion layer to capture local trend features in traffic data, specifically including the following sub-steps:
[0253] (6-1) For the query (Q) and key (K) in the multi-head local self-attention mechanism, use 1D convolution to capture local context features. To ensure that the output at each moment only depends on the current and previous inputs and is not affected by future inputs, use causal convolution for the calculation of value V:
[0254] Q i = Conv1D(X i , W Q )
[0255] K i = Conv1D(X i , W K )
[0256] V i = CausalConv1D(X i , W V )
[0257] Among them, Conv1D represents a one-dimensional convolution operation, W Q , W K , W V are the query weight matrix, the key weight matrix, and the value weight matrix respectively.
[0258] (6-2) Use scaled dot-product attention to calculate the attention scores through the query (Q) and the key (K), apply the calculated attention weights to the value (V), obtain the output of each head and concatenate them together. Obtain the final output through a linear transformation, and perform a weighted combination of the outputs of the short-term branch and the long-term branch to obtain the final fused feature representation:
[0259]
[0260] Among them, and are the output linear transformation matrices corresponding to the short-term branch and the long-term branch respectively. α s and α l are the weighted coefficients of the short-term and long-term branches respectively, controlling the contributions of the short-term and long-term in the final prediction.
[0261] Step 7, Input the fused features into the prediction module composed of fully connected layers to obtain the final prediction result:
[0262] y = W out ·h fusion + b out
[0263] Among them, W out and b out are the weight matrix and the bias vector of the output layer respectively.
[0264] Experimental conditions: All experiments use the Python 3.9 programming language and build a deep learning model based on the PyTorch third-party library.
[0265] Experimental settings: Train a 2-layer GAT for each graph in the multi-hop R-GAT, with 32 hidden neurons in each layer. In the time series prediction stage, set 64 hidden neurons for the Bi-GRU, set the stacked GRU for short-term time prediction to 3 layers, and the hidden units of each layer are 32, 64, and 32 respectively. Use the Adam optimizer for loss optimization, with an initial learning rate of 0.001, a training batch size of 128, 100 training epochs, and use an early stopping strategy.
[0266] This experiment uses the root mean square error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) to evaluate the performance of the method.
[0267]
[0268] In this embodiment, a prediction experiment was conducted on the Hangzhou Metro dataset to predict future features for 15 to 60 minutes, and the performance of the model of the present invention was compared with that of six benchmark models. The results are shown in Table 1.
[0269]
[0270] Table 1
[0271] As shown in the results in Table 1, the method proposed by the present invention is superior to other comparative methods.
[0272] Specific application fields or related products of the present invention:
[0273] Based on the present invention, a subway passenger flow prediction system was developed to predict the subway passenger flow situation.
[0274] System home page Figure 4 :
[0275] The system intuitively presents the passenger flow conditions within 15 minutes on each section on the map, greatly enriching the visualization level of information. For example, the predicted passenger flow conditions Figure 5 are shown. This intuitive display method not only makes the complex passenger flow data clear at a glance, but also enables users to quickly identify the traffic flow status of different stations through fine color coding. For example, green represents smooth traffic, yellow represents slow traffic, and red represents congestion. By intuitively displaying the prediction results on the map, the system enables users to easily understand the passenger flow situation and provides a reference for travel.
[0276] The system uses a line chart to clearly present the trend of traffic flow changing over time. The design of the system's predicted line chart is to make up for the defect that the passenger flow information in the passenger flow condition prediction map is intuitive but not precise enough. By selecting a station in the prediction map, the predicted passenger flow situation of the corresponding station within the next hour can be viewed through the prediction trend; for example Figure 6 ;
[0277] Evidence related to the technical effects obtained in the embodiments of the present invention:
[0278] Such as Figure 7 Comparison of the root mean square errors of different models.
[0279] Such as Figure 8 Comparison of the mean absolute errors of different models.
[0280] Such as Figure 9 Comparison of the mean absolute percentage errors of different models.
[0281] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by a suitable instruction execution system, such as a microprocessor or dedicated designed hardware. Those of ordinary skill in the art can understand that the above devices and methods can be implemented using computer-executable instructions and / or included in processor control code, for example, such code is provided on a carrier medium such as a disk, CD, or DVD-ROM, a programmable memory such as read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The devices and their modules of the present invention can be implemented by hardware circuits of programmable hardware devices such as very large scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, or can be implemented by a combination of the above hardware circuits and software such as firmware.
[0282] As described above, only the specific embodiments of the present invention are provided, but the protection scope of the present invention is not limited thereto. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention.
Claims
1. A subway passenger flow prediction method based on a multi-view spatio-temporal neural network, characterized in that, It includes the following steps: Step 1: Collect historical AFC data, urban weather data, and time-related factor data of the subway system; Among them, the AFC data includes the passenger inflow and outflow volumes at subway stations at different time points, the weather data includes the temperature, humidity, and meteorological conditions of the city, and the time-related factor data includes information on weekdays, weekends, and holidays; Step 2: Based on the physical topology structure of the subway system, station flow similarity, and flow interaction relationship, construct multiple spatially related graphs; Among them, the spatially related graphs include a subway topology graph, a flow similarity graph, and a flow interaction graph; Step 3: Use a multi-hop graph convolutional network model to gradually update the feature representation of the target node through graph convolutional layers with multiple hops, enabling the model to learn the long-range spatial dependence relationship between nodes in the subway network; Step 4: Adopt a multi-perspective attention mechanism to perform weighted fusion on different spatially related graphs, dynamically evaluate the contribution of each spatial perspective to the passenger flow prediction result, and adaptively adjust the weights of the spatial graphs according to the evaluation result to optimize the learning process of spatial features; Step 5: For the long-term time dependence of subway passenger flow, use the BiGRU-TCN module for modeling; for the short-term time dependence of subway passenger flow, use the BiGRU-stacked GRU module for modeling; Step 6: Improve the accuracy and robustness of subway passenger flow prediction through the local features in the long-term and short-term time dependence relationships by means of a multi-head convolutional self-attention mechanism; input the fused features into a fully connected layer for the final subway passenger flow prediction.
2. The subway passenger flow prediction method based on the multi-view spatio-temporal neural network according to claim 1, wherein, The spatially related graphs include a subway topology graph, a flow similarity graph, and a flow interaction graph. The subway topology graph is constructed based on the physical location relationship of subway stations, the flow similarity graph is constructed based on the historical passenger flow similarity between subway stations, and the flow interaction graph is constructed based on the passenger flow direction and flow intensity between subway stations; The graph neural network module adopts a multi-hop R-GAT model. Among them, the node features are gradually updated through graph convolutional layers with multiple hops to capture spatial dependence relationships at different levels, and the weight of adjacent nodes is adjusted through an adaptive learning mechanism for each hop of convolutional operation; The multi-perspective attention mechanism dynamically evaluates the importance of each perspective in passenger flow prediction by calculating the attention coefficients of different spatial perspectives, and adjusts its weight in the feature fusion process according to the contribution of each perspective; The BiGRU-TCN module captures the bidirectional temporal dependence of subway passenger flow data through a bidirectional GRU (BiGRU) network, combined with a temporal convolutional network (TCN) through convolutional operations that expand the receptive field; The BiGRU-stacked GRU module has a stacked structure of multiple GRU units; The multi-head convolutional self-attention mechanism captures local trend features in different time periods through parallel processing of multiple convolutional self-attention heads, and performs weighted fusion on the prediction results of the long-term and short-term time branches; The time factors include weekdays, weekends, morning and evening peak periods, and off-peak periods, which are processed through one-hot encoding and input into the model together with other data features to fully consider the impact of time factors on subway passenger flow; The weather data includes the temperature, humidity, meteorological conditions, and special weather events of the city. The weather data, together with other spatial and temporal characteristics, is input into the graph neural network and the time series modeling module to jointly optimize the passenger flow prediction results.
3. The subway passenger flow prediction method based on the multi-view spatio-temporal neural network according to claim 1, wherein Collect the historical AFC data of the subway system, the city weather data, and the time-related factor data: Collect the historical AFC data of the subway, perform preprocessing on the original data, and represent the obtained passenger flow as a graph signal X. The specific steps are as follows: (1-1) Constructing the topological connection matrix T∈R N×N It is used to describe the actual connection relationship between stations and normalize each row of T to generate the edge weight matrix W of the subway topology map. t : (1-2) Construct a similarity matrix S ∈ R N×N to reflect the high consistency in the time series between subway stations with similar functions, and normalize S(i, j) to generate the edge weight matrix W of the subway topological map S : (1-3) Construct the association score matrix C ∈ R N×N to quantify the traffic intensity ratio from site j to site i, use the time decay factor β = 0.9 to achieve the temporal smoothing of the matrix, and normalize C(i, j) to generate the edge weight matrix W of the traffic interaction graph C : C(i,j) (t) = βC(i,j) (t-1) + (1 - β)C(i,j) (cur) Among them, D(i,j) represents the total passenger flow from station j to station i, and λ = 1 is the Laplacian smoothing coefficient, which is used to handle the data sparsity problem.
4. The subway passenger flow prediction method based on the multi-view spatio-temporal neural network according to claim 1, wherein The multi-hop graph convolutional network model is used to gradually update the feature representation of the target node through graph convolutional layers with multiple hops, enabling the model to learn the long-range spatial dependence relationship between nodes in the subway network. The specific steps are as follows: (2-1) Update the edge attention, and the calculation formula is as follows: Among them, h i and h j represent the feature representations of nodes i and j, r k represents its relationship type, and represent the node type-aware transformation matrix, W r represents the relationship type-aware transformation matrix, δ represents the activation function, v T represents the weight vector applicable to calculating the attention score; normalize the edge attention: (2-2) Diffuse the attention for each relationship type respectively: where θ k is the diffusion coefficient, is the k-hop attention matrix for the relationship type r; (2-3) Perform feature aggregation of multi-hop attention and update the update output of each layer of node i 5. The subway passenger flow prediction method based on a multi-view spatio-temporal neural network according to claim 1, wherein The multi-perspective attention mechanism is adopted to perform weighted fusion on different spatially related graphs, dynamically evaluate the contribution of each spatial perspective to the passenger flow prediction result, and adaptively adjust the weights of the spatial graphs according to the evaluation result to optimize the learning process of spatial features. The specific steps are as follows: (3-1) The pooling layer can obtain a vector z representing the global information of all views by summarizing the pooling results of all views; z = z topo ||z simi ||z inter (3-2) The attention layer applies an attention operation to the scalar z, measures the weights of each view through s, and weighted-aggregates the information of all views to obtain the feature H (l+1) ; s = σ(W2, ReLU(W1z)) Encode the weather conditions and time status, and fuse them with the output of graph convolution as the input for joint prediction. The specific steps are as follows: (4-1) For the weather conditions, the meteorological variables considered in this patent include three parts, namely the city temperature (in degrees Celsius), the city relative humidity (in percentage), and various meteorological conditions such as sunny, cloudy, light rain, heavy rain, snow, and fog in the city; (4-2) For the daytime and weekly situations, this patent divides the subway operation time into daytime situations based on the morning and evening rush hours, and divides the weekly situations according to weekdays and weekends; among them, 6 a.m. - 7 a.m. is the early stage of the morning rush hour, 7 a.m. - 9 a.m. is the morning rush hour, 9 a.m. - 10 a.m. is the late stage of the morning rush hour, 10 a.m. - 4 p.m. is the flat peak period, 4 p.m. - 5 p.m. is the early stage of the evening rush hour, 5 p.m. - 7 p.m. is the evening rush hour, and 7 p.m. - 10 p.m. is the late stage of the evening rush hour; for the above discrete influencing factors, they are all represented by one-hot encoding; E t = {aT t , aH t , aS t , hT t , hW t ; t = t0 - R + 1, t0 - R,... t0} Among them, aT t represents temperature, aH t represents humidity, aS t represents weather condition, hT t represents daytime, hW t represents week subscript, t represents timestamp, R represents historical record length, and t0 represents initial time; Divide the long and short time regions and perform feature capture respectively. The specific steps are as follows: (5-1) The fusion of the hidden feature state output obtained via graph convolution and the external feature E t is The short-term time region can be expressed as where Ls represents the length of the short-term dependency; the long-term time region can be expressed as where L T represents the length of the long-term dependency; (5-2) Since both long and short time feature captures use the Bi-GRU (Bidirectional GRU) layer, the Bidirectional GRU is introduced uniformly; the Bidirectional GRU layer includes two layers, the leftward and the rightward. Among them, the expression of the rightward GRU is as follows: where Θ rx represents the graph convolution parameter between the feature state H t and the input X t ; Θ rh represents the reset gate R in the GRU t and the hidden feature state ; Θ zx , Θ zh , Θ nx , Θ nh represent similar meanings; b r , b z , b n represent the bias terms; the expressions of the left GRU and the right GRU are similar, except for the calculation time steps and input orders, as shown below: The final output H of the Bi-GRU t is the concatenation of the leftward and rightward outputs and can be expressed as: (5-3) Further extract long-term temporal features through the stacked Temporal Convolutional Network (TCN); the dilated causal convolution structure of the TCN can effectively capture the long-distance sequence data dependencies by expanding the receptive field; specifically, for the output time series H of the Bi-GRU with the feature vector h i and the filter f: {0, 1,..., k - 1}, the process of calculating the dilated convolution of the sequence element x is shown in the formula: Among them, d is the dilation coefficient, x - d·j is the past direction, and k is the size of the filter; In addition, TCN uses a residual network to solve problems such as gradient vanishing and overfitting; the calculation formula of the i-th residual module is as shown in the formula: Among them, H i is the output result of the i-th residual module, and H i-1 is the output result of the previous residual module, is the mapping function of the residual module; after passing through the last residual module, the final output result H l is obtained; (5-4) By using a stacked GRU structure after the BiGRU module, finer-grained changes in passenger flow can be captured through deep time series modeling, and the final output result H is obtained. s ; Considering that the traditional multi-head self-attention mechanism performs matching based on point values and cannot perceive local trends, a multi-head local self-attention mechanism is used in the adaptive fusion layer to capture local trend features in traffic data, which specifically includes the following sub-steps: (6-1) For the query (Q) and key (K) in the multi-head local self-attention mechanism, 1D convolution is used to capture local context features. To ensure that the output at each moment only depends on the current and previous inputs and is not affected by future inputs, causal convolution is used for the calculation of value V: Q i = Conv1D(X i , W Q ) K i = Conv1D(X i , W K ) V i = CausalConv1D(X i , W V ) Among them, Conv1D represents a one-dimensional convolution operation, W Q , W K , W V are the query weight matrix, the key weight matrix, and the value weight matrix respectively; (6-2) The scaled dot-product attention is used to calculate the attention scores through the query (Q) and key (K), and the calculated attention weights are applied to the value (V) to obtain the output of each head and concatenate them together. Through a linear transformation, the final output is obtained, and the outputs of the short-term branch and the long-term branch are weighted and combined to obtain the final fused feature representation: Among them, and are the output linear transformation matrices corresponding to the short-term branch and the long-term branch respectively; α s and α l are the weighting coefficients of the short-term and long-term branches respectively, controlling the contributions of the long-term and short-term in the final prediction.
6. The subway passenger flow prediction method based on a multi-view spatio-temporal neural network according to claim 1, wherein The local features in the long-term and short-term time dependencies are enhanced through the multi-head convolutional self-attention mechanism to improve the accuracy and robustness of subway passenger flow prediction; the fused features are input into the fully connected layer for the final subway passenger flow prediction: The fused features are input into the prediction module composed of fully connected layers to obtain the final prediction result: y = W out ·h fusion +b out Among them, W out and b out are the weight matrix and bias vector of the output layer, respectively.
7. A subway passenger flow prediction system based on a multi-view spatio-temporal neural network for implementing the subway passenger flow prediction method based on a multi-view spatio-temporal neural network according to any one of claims 1-6, characterized in that, The subway passenger flow prediction system based on the multi-view spatio-temporal neural network includes: A data acquisition module for collecting subway AFC data, weather data, and time factor data; A graph neural network module for processing spatially related graphs and capturing the spatial dependencies between subway stations; A time dependency modeling module, including a BiGRU-TCN module and a BiGRU-stacked GRU module, for capturing long-term and short-term time dependencies; A feature fusion module for fusing spatial and temporal features through the multi-head convolutional self-attention mechanism; A prediction module for outputting the final prediction result of the subway passenger flow through the fully connected layer.
8. A computer device, characterized in that, The computer device includes a memory and a processor. When the computer program stored in the memory is executed by the processor, the processor executes the steps of the subway passenger flow prediction method based on the multi-view spatio-temporal neural network according to any one of claims 1-6.
9. A computer-readable storage medium storing a computer program, which when executed by a processor, causes the processor to execute the steps of the subway passenger flow prediction method based on the multi-view spatio-temporal neural network according to any one of claims 1-6.
10. An information data processing terminal, characterized in that, The information data processing terminal is used to implement the subway passenger flow prediction system based on the multi-view spatio-temporal neural network according to claim 7.
Citation Information
Cited By
Metro station passenger flow prediction method and device based on multi-relation self-attention time-space diagram neural network, and electronic equipment
CN121903093A