Subway short-time OD passenger flow prediction method based on multi-knowledge graph neural network model
By constructing a multi-knowledge graph neural network model and utilizing multi-source data and feature modeling techniques, the problems of sparsity and complex spatiotemporal correlation in subway passenger flow forecasting were solved, achieving high-precision and highly interpretable OD passenger flow forecasting.
Patent Information
- Application Number
- CN202510512053.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2045-04-23
AI Technical Summary
Existing subway passenger flow prediction models suffer from insufficient accuracy and poor interpretability in terms of the sparsity of the OD matrix between rail transit stations and the complex spatiotemporal correlation, failing to effectively reflect passenger travel behavior and affecting operation and management.
A multi-knowledge graph neural network model is adopted. By collecting and preprocessing multi-source data, a multi-knowledge graph neural network is constructed to extract spatial and temporal features. Feature modeling is performed using graph convolutional networks and gated recurrent units to predict future OD passenger flow.
It significantly improves the accuracy and interpretability of short-term OD passenger flow forecasting for subways, captures the complex spatiotemporal correlation of subway passenger flow, and enhances forecasting capabilities.
Smart Images

Figure CN120386983B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of subway passenger flow prediction, and particularly relates to a subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model. BACKGROUND
[0002] The subway is an important means to meet the urban rapid and large-capacity traffic demand, and accurately grasping the spatiotemporal dynamic characteristics and evolution trend of rail transit passenger flow provides a reference for taking initiative operation organization and passenger flow control strategy. At present, subway passenger flow prediction is mostly subway in-and-out station passenger flow prediction, and this method cannot reflect the specific distribution of passenger demand in the subway network. Subway OD (Origin Destination) refers to the interchange volume between subway stations, and can better reflect the passenger travel behavior and is more meaningful to operation organization and passenger flow control strategy.
[0003] However, the OD matrix between rail transit stations is relatively sparse in both time and space dimensions: in the time dimension, the passenger travel mode changes over time, resulting in a sparse mode of OD flow changing over time; in the space dimension, there is little or almost no travel volume between some subway stations, and the introduction of low-value and random OD passenger flow is not important to the operation and management of the subway and may weaken the prediction ability of the model. In addition, the subway OD passenger flow changes have complex spatiotemporal correlation: in the time dimension, the OD passenger flow has certain periodicity and trend, and the OD passenger flow at a certain time not only has correlation with the passenger flow at the adjacent historical time, but also has correlation with the passenger flow at the same historical time; in the space dimension, the passenger flow demand between different spatial positions of stations or lines will influence each other, and the OD passenger flow has significant origin dependence and destination dependence in the space dimension. At the same time, the accuracy and ability of the existing prediction model are not enough, and the explainability needs to be improved. SUMMARY
[0004] The present application provides a subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model to solve the problems of high difficulty in subway passenger flow prediction, insufficient accuracy and ability of the existing prediction model, and the need to improve the explainability.
[0005] According to a first aspect, a subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model is provided in an embodiment, and the method comprises:
[0006] Collecting multi-source basic data related to the subway network, subway passenger flow and passenger flow influencing factors, and performing data preprocessing to extract key OD pairs of subway passenger flow;
[0007] The multi-knowledge graph neural network model is constructed, which is used to firstly extract multiple spatial correlation features by using the multi-knowledge graph, then extract spatial features by using a spatial feature modeling module based on the multi-knowledge graph result and the constructed OD pair feature matrix, input the time sequence with the spatial features to a time feature modeling module to extract time features, and finally obtain the OD passenger flow prediction result of the future time through a full connection layer.
[0008] The training set and the test set are constructed, the multi-knowledge graph neural network model is trained, tested and evaluated, and finally the multi-knowledge graph neural network model is obtained.
[0009] Further, multi-source basic data related to the subway network, subway passenger flow and passenger flow influencing factors are collected, specifically including: the multi-source basic data includes subway station spatial position data, AFC card data, POI data and anonymized mobile signaling data.
[0010] Further, data preprocessing, specifically including:
[0011] The AFC card data preprocessing includes:
[0012] The time-period subway station entry and exit passenger flow statistics: the AFC card data is cleaned; the in-station quantity and the out-station quantity are respectively counted according to the cleaned AFC card data and the station and the time interval;
[0013] The time-period subway station-to-station OD passenger flow statistics: the AFC card data is cleaned; the in-station quantity and the out-station quantity are respectively counted according to the cleaned AFC card data and the station and the time interval;
[0014] The subway station spatial position data preprocessing includes:
[0015] The WGS-84 coordinate system of all subway stations is labeled and mapped to the map;
[0016] The POI data preprocessing includes:
[0017] The coordinate systems of various POI data are unified with the coordinate system of the subway station, and matched to the map;
[0018] The mobile signaling data preprocessing includes:
[0019] Firstly, the anonymized mobile signaling data is cleaned, the time stamp is unified into a standard format, the base station ID is mapped to the geographic coordinates, and the user's moving track is reconstructed according to the time stamp and the base station position;
[0020] Secondly, the activity mode of the user in different time periods is analyzed, and the residence and the workplace are inferred.
[0021] Next, the study area is divided into grids, and users' residence or work records are mapped to the corresponding grids to generate work and residence data for each grid.
[0022] Finally, the residential and working populations within each grid were counted, and the sample was expanded and calibrated.
[0023] Furthermore, key origin-destination (OD) pairs of subway passenger flow are extracted, specifically including:
[0024] Key OD pair extraction must meet the following conditions: the proportion of zero values in any OD pair is lower than a preset threshold, and the sum of the time series values of OD pairs is greater than a preset percentile or the standard deviation of the OD pairs is greater than a preset percentile. If the 90th percentile is taken, then the key OD pair T... * Represented as:
[0025] T * ={T i |P0(T i )<z and (S(T) i )>Q 90 or σ(T) i )>Q 90 (σ))};
[0026] Where the percentage of zero values in OD is lower than a preset threshold, it is expressed as:
[0027]
[0028] Among them, P0(T) i ) represents the proportion of zero values in the time series of the i-th OD pair; x(T) i ) represents the tensor of the time series of the i-th OD pair; z is the preset threshold for the proportion of zero values, set according to the distribution of the proportion of zero values across all OD pairs; T i ={x i,1 x i,2 , ..., x i,t} represents the time series consisting of the passenger flow of the i-th OD pair at historical time ODs, where t is the length of the time series, and X is the distance from the OD to the OD. i,t is the OD passenger flow at time t for the i-th OD pair; count() refers to the number of 0s in the OD pair time series tensor; len() refers to the length of the OD pair time series tensor;
[0029] For time series sums greater than the 90th percentile, OD is represented as:
[0030] S(T i )>Q 90 ({S(T1), S(T2), ..., S(T) n )});
[0031] where S(Ti) is the sum of the i-th OD pair time series, i
[0032] Q 90 (S) is the 90th percentile of the set of sums of all time series:
[0033] Q 90 (S) = Percentile({S(T1), S(T2),..., S(T n )}, 0.9);
[0034] Percentile() refers to the quantile of the data set;
[0035] OD pair standard deviation greater than the 90th percentile, denoted as:
[0036] σ(T i ) > Q 90 ({σ(T1), σ(T2),..., σ(T n )});
[0037] σ(T i ) is the standard deviation of the i-th OD pair time series,
[0038]
[0039] μ i is the mean of the time series;
[0040] Q 90 (σ) is the 90th percentile of the set of standard deviations of all time series:
[0041] Q 90 (σ) = Percentile({σ(T1), σ(T2),..., σ(T n )}, 0.9).
[0042] Further, a plurality of spatial correlation features are extracted using a plurality of knowledge graphs, specifically including:
[0043] The plurality of knowledge graphs include:
[0044] Spatial connectivity knowledge graph: including calculating and constructing the spatial distance matrix between the starting points of key OD pairs, the spatial distance matrix between the ending points of key OD pairs; the spatial distance between station i and station j is calculated using the Haversine formula; each element in the spatial connectivity correlation matrix is the reciprocal of the spatial distance between stations;
[0045] Inbound or outbound volume pattern similarity knowledge graph: including calculating and constructing key OD pair origin inbound volume time pattern similarity matrix, key OD pair destination inbound volume time pattern similarity matrix, key OD pair origin outbound volume time pattern similarity matrix, key OD pair destination outbound volume time pattern similarity matrix; inbound volume or outbound volume time pattern similarity is calculated and quantified based on DTW function;
[0046] OD volume time pattern similarity knowledge graph: including calculating and constructing pattern correlation matrix between key OD pairs, each element in the matrix is the Pearson correlation coefficient of OD volume time series between OD pairs;
[0047] Functional similarity knowledge graph: including calculating and constructing key OD pair origin functional similarity matrix, key OD pair destination functional similarity matrix; the functional similarity between stations i and j is calculated according to the cosine similarity of the POI volume, working population and residential population vectors P(i) and P(j) of the two stations.
[0048] Further, the spatial feature is extracted by using the spatial feature modeling module, specifically including:
[0049] Constructing OD pair feature matrix X: the OD pair feature matrix X between stations is X∈R N×P , N is the number of OD pairs, P is the length of the OD pair time series, the feature value at time i is X t ∈R N×i , R represents a set of real numbers, and is a matrix or a vector;
[0050] Graph convolution network GCN processing: inputting the knowledge graph G i and the OD pair feature matrix X into the GCN to obtain the corresponding state matrix, and the multiple knowledge graphs are processed by the GCN to obtain multiple state matrices;
[0051] Splicing: splicing the state matrix results of the multiple knowledge graphs to obtain H concat .
[0052] Further, the time series with spatial features are input into the time feature modeling module to extract time features, and finally the OD passenger flow prediction result of the future time is obtained through a fully connected layer, specifically including:
[0053] The H concat obtained by splicing the state matrices of the multiple knowledge graphs processed by the GCN is input into the gated recurrent unit GRU for time series modeling and output of a high-dimensional hidden state result, and then the hidden state is mapped to one or more prediction results of future time steps through a fully connected layer.
[0054] Further, the multi-knowledge graph neural network model is trained and tested and evaluated, specifically including:
[0055] In the training process, the target is to minimize the error between the actual value and the predicted value, using Y t and respectively represent the actual OD and the predicted OD, and the loss function of the multi-knowledge graph neural network model is represented as:
[0056]
[0057] The first term refers to minimizing the error between the actual value and the predicted value, and the second term L reg is an L2 regularization term, and λ is a hyperparameter.
[0058] Further, the multi-knowledge graph neural network model is trained and tested and evaluated, specifically including:
[0059] Evaluation indexes including root mean square error (RMSE), mean absolute error (MAE), accuracy, coefficient of determination (R 2 2), and explained variance score (Var) are used to evaluate and optimize the multi-knowledge graph neural network model to obtain the final prediction model.
[0060] According to a second aspect, in an embodiment, a subway short-term OD passenger flow prediction system based on a multi-knowledge graph neural network model is provided, and the system includes:
[0061] A data collection module is configured to collect multi-source basic data related to subway networks, subway passenger flows, and passenger flow influencing factors, and perform data preprocessing to extract key OD pairs of subway passenger flows.
[0062] A prediction model construction module is configured to construct a multi-knowledge graph neural network model, which is used to first extract multiple spatial correlation features using a multi-knowledge graph, then extract spatial features using a spatial feature modeling module based on the multi-knowledge graph results and the constructed OD pair feature matrix, input the time series with spatial features into a time feature modeling module to extract time features, and finally obtain OD passenger flow prediction results for future time through a fully connected layer.
[0063] A model training and testing module is configured to construct a training set and a test set, train and test the multi-knowledge graph neural network model, and evaluate it to obtain the final multi-knowledge graph neural network model.
[0064] According to a third aspect, in an embodiment, an electronic device is provided, which includes a processor and a memory; the memory is configured to store one or more program instructions;
[0065] The processor is configured to run one or more program instructions to perform the steps of the subway short-term OD passenger flow prediction method based on the multi-knowledge graph neural network model according to any one of the above aspects.
[0066] According to a fourth aspect, one embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a short-term subway OD passenger flow prediction method based on a multi-knowledge graph neural network model as described in any of the preceding claims.
[0067] This application provides a short-term OD (Original Departure) passenger flow prediction method for subways based on a multi-knowledge graph neural network model. First, based on multi-source data such as subway station location data, AFC (Automatic Fare Collection) data, POI (Point of Interest) data, and mobile signaling data, the subway network structure, passenger flow characteristics, and surrounding land use and population characteristics are quantified, and key OD pairs are extracted to prevent low-value and random data from affecting the model. Second, multiple knowledge graphs are constructed to capture the spatial connectivity, travel pattern similarity, and functional similarity between nodes. Simultaneously, a spatial feature modeling module is constructed, using graph neural networks to capture the potential spatial relationships between nodes. Finally, a temporal feature modeling module is constructed, using time series modeling methods to capture the dynamic changes in passenger flow. This prediction method effectively quantifies and captures the complex spatiotemporal correlations of subway passenger flow, significantly enhancing its predictive ability and interpretability. Attached Figure Description
[0068] Figure 1 A flowchart illustrating a short-term subway OD passenger flow prediction method based on a multi-knowledge graph neural network model, as provided in one embodiment of the present invention;
[0069] Figure 2 A flowchart illustrating the specific implementation of a short-term subway OD passenger flow prediction method based on a multi-knowledge graph neural network model, as provided in one embodiment of the present invention;
[0070] Figure 3 A schematic diagram of the basic framework of a multi-knowledge graph neural network model in a short-term subway OD passenger flow prediction method provided in an embodiment of the present invention;
[0071] Figure 4 This is a schematic diagram illustrating the relationship between data preprocessing and knowledge graph construction in a short-term subway OD passenger flow prediction method based on a multi-knowledge graph neural network model, as provided in an embodiment of the present invention.
[0072] Figure 5 This invention provides a GRU time feature modeling structure diagram in a short-term subway OD passenger flow prediction method based on a multi-knowledge graph neural network model, as an embodiment of the present invention.
[0073] Figure 6A comparison between the true value and the predicted value of the OD pair (No. 391) at a 30-minute interval based on a multi-knowledge graph neural network model for an embodiment of the present application;
[0074] Figure 7 The overall architecture diagram of a subway short-term OD passenger flow prediction system based on a multi-knowledge graph neural network model is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0075] The present application will be further described below in conjunction with the drawings by specific embodiments. Similar elements in different embodiments are associated with similar element reference numbers. In the following embodiments, many details are described in order to make the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different cases, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification in order to avoid the core part of the present application being overwhelmed by too much description, and it is not necessary to describe these related operations in detail for those skilled in the art according to the description in the specification and general technical knowledge in the art.
[0076] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate way to form various embodiments. At the same time, the steps or actions in the method description can also be sequentially adjusted or adjusted in a manner that is obvious to those skilled in the art. Therefore, the order in the specification and drawings is only for the purpose of clear description of one embodiment, and does not mean the necessary order, unless otherwise stated that a certain order must be followed.
[0077] The present application provides a subway short-term OD passenger flow prediction method based on a multi-knowledge graph neural network model, which is described in detail below in conjunction with Figure 1 and Figure 2 .
[0078] As Figure 1 shown, in step S100, subway network, subway passenger flow and passenger flow influencing factor related multi-source basic data are collected, data preprocessing is performed, and subway passenger flow key OD pairs are extracted.
[0079] In this embodiment, the basic data includes subway station spatial position data, AFC card swiping data, POI data, and anonymized mobile signaling data.
[0080] Data preprocessing specifically includes:
[0081] 1) AFC card swiping data preprocessing
[0082] Sub-period subway station entry and exit flow statistics: AFC card data is cleaned up including de-duplication, elimination of abnormal values (missing entry or exit records, too long interval between entry and exit), time format conversion, and station code matching; according to the cleaned AFC card data, the entry and exit quantities are respectively counted according to the station and time interval (such as 15-minute interval);
[0083] Sub-period subway station OD flow statistics: according to the cleaned AFC card data, the OD flow between the starting station and the ending station is counted according to the time window (such as 15-minute interval aggregation), and a plurality of time series of subway station OD flow matrix is obtained.
[0084] Table 1 AFC card data
[0085] Card number Transaction date Transaction time Metro station code Transaction amount Transaction nature Card type 87131904 2024 / 10 / 1 13:30:24 Big Goose Pagoda 0 Non-preferred IC card 87131904 2024 / 10 / 1 13:42:26 Qinglong Temple 3 Non-preferred IC card 51281346 2024 / 10 / 1 13:10:14 Xiaozhai 0 Non-preferred Single ticket 51281346 2024 / 10 / 1 13:55:18 Xi'an North 6 Non-preferred Single ticket 63792564 2024 / 10 / 1 13:20:36 Administrative center 0 Non-preferred Internet 63792564 2024 / 10 / 1 13:39:26 Xi'an North 3 Non-preferred Internet … … … … … … …
[0086] 2) Pretreatment of subway station spatial position data
[0087] The WGS-84 coordinate system of all subway stations is labeled and mapped to the map.
[0088] 3) Pretreatment of POI data
[0089] The coordinate systems of various POI data are unified with the coordinate system of the subway station, and are matched to the map.
[0090] 4) Pretreatment of mobile signaling data
[0091] First, the anonymized mobile signaling data is filtered for abnormal values, missing values are processed, time stamps are unified into a standard format, base station IDs are mapped to geographic coordinates, and user movement trajectories are reconstructed according to time stamps and base station locations;
[0092] Second, the activity patterns of users in different time periods are analyzed to infer their residence and workplace; according to the length of stay of users at night and during the day, the workplace and residence of the user are determined;
[0093] Next, the study area is divided into 150m*150m grids, and the user's residence or work records are mapped to the corresponding grid to generate work and residence data for each grid;
[0094] Finally, the resident population and working population in each grid are counted and calibrated.
[0095] 5) Extraction of key OD pairs of subway passenger flow
[0096] The OD matrix describes the number of trips for each OD pair within a specific time interval. In a subway system with N stations, the number of generated OD pairs is N*N, meaning the OD matrix is an N*N square matrix, resulting in a large dataset. However, most elements in the OD matrix are 0, indicating that there is no passenger travel demand between most stations. Therefore, not all OD pairs need to be monitored. Some non-critical OD pairs have very low passenger traffic and highly random travel demand. These OD pairs contribute very little to passenger traffic, indicating that a relatively small number of critical OD pairs account for the vast majority of overall OD passenger traffic.
[0097] Table 2. Od / October Flow Matrix Data Between Subways at a Certain Time Segment
[0098] Metro station Xi'an North Station Xiaozhai Big Goose Pagoda Caotan … Qinglong Temple Xi'an North Station 0 600 900 0 … 180 Xiaozhai 632 0 592 18 … 520 Big Goose Pagoda 900 532 0 0 … 721 Caotan 10 13 0 0 0 … … … … … 0 … Qinglong Temple 156 562 701 0 … 0
[0099] Table 3 OD pairs for a certain time segment
[0100] OD pair number Originating station Destination station OD passenger flow 1 Xi'an North Station Xiaozhai 600 2 Xi'an North Station Big Goose Pagoda 900 3 Xi'an North Station Caotan 0 4 Xi'an North Station Qinglong Temple 180 5 Xiaozhai Xi'an North Station 632 6 Xiaozhai Big Goose Pagoda 592 … … … … … … 45796 Qinglong Temple Guojiayezhai 0
[0101] Table 4 Examples of OD pairs of feature matrices
[0102]
[0103] Use T i ={x i,1 x i,2 , ..., x i,t} represents the time series consisting of the passenger flow of the i-th OD pair at historical time ODs, where t is the length of the time series, x i,t This represents the OD passenger flow at time t for the i-th OD pair. To extract key OD pairs, this embodiment considers OD pairs with a low percentage of historical zero values and a large total historical OD passenger flow, or those exhibiting distinctive changes, to be key OD pairs. These are selected by setting a threshold, as follows:
[0104] Key OD pair extraction requires the following conditions to be met: the proportion of zero values in any OD pair is lower than a preset threshold, and the sum of the time series values of OD pairs is greater than a preset percentile or the standard deviation of the OD pairs is greater than a preset percentile; in this embodiment, the 90th percentile is used, so the key OD pair T * Represented as:
[0105] T * ={T i |P0(T i )<z and (S(T) i )>Q 90 (S) or σ(T) i )>Q 90 (σ))};
[0106] When the percentage of zero values in OD is lower than a preset threshold, it is represented as:
[0107]
[0108] Among them, P0(T) i ) represents the proportion of zero values in the time series of the i-th OD pair; x(T) i ) is the tensor of the time series of the i-th OD pair; z is the preset threshold for the proportion of zero values, which is set according to the distribution of the proportion of zero values of all OD pairs, and can be 50%-90%;
[0109] For time series sums greater than the 90th percentile, OD is represented as:
[0110] S(T i )>Q 90 ({S(T1), S(T2), ..., S(T) n )});
[0111] Among them, S(T) i ) represents the sum of the time series of the i-th OD pair.
[0112] Q 90 (S) is the 90th percentile of the set of sums of all time series:
[0113] Q 90 (S)=Percentile({S(T1),S(T2),...,S(T n )},0.9);
[0114] OD for the 90th percentile of the standard deviation is expressed as:
[0115] σ(T i )>Q 90 ({σ(T1),σ(T2),...,σ(T n )});
[0116] σ(T i Let be the standard deviation of the time series of the i-th OD pair.
[0117]
[0118] μ i It is the mean of the time series;
[0119] Q 90 (σ) is the 90th percentile of the set of standard deviations of all time series:
[0120] Q 90 (σ)=Percentile({σ(T1),σ(T2),…,σ(T n), 0.9).
[0121] As shown in step S200, a multi-knowledge graph neural network model is constructed, which is used to first extract multiple spatial correlation features using a multi-knowledge graph, then extract spatial features based on the multi-knowledge graph results and the constructed OD pair feature matrix using a spatial feature modeling module, input the time sequence with spatial features to a time feature modeling module to extract time features, and finally obtain the OD passenger flow prediction results of the future time through a full connection layer. Figure 1
[0122] The above steps specifically include:
[0123] 1. Problem description
[0124] Define the OD pair feature matrix X ∈ R N×P , N is the number of OD pairs, P is the length of the OD pair time sequence, and the feature value at time i is X t ∈ R N×i , the feature value is the OD passenger flow of the OD pair, and different time has different feature values. As shown in Table 4, the data in the table is the feature value of each OD pair at each time, and the feature matrix of the OD pair is a matrix composed of all OD pairs and all historical time.
[0125] The spatio-temporal traffic prediction problem is: given the preset graph structure and the feature matrix X, learn the mapping function f to predict the traffic information at the next T time:
[0126] [X t+1 , …, X t+T ]=f(G;(X t-n , …, X t-1 , X t ));
[0127] Where n is the length of the historical time sequence, and T is the length of the time to be predicted.
[0128] 2. Multi-knowledge graph construction
[0129] Based on the preprocessed data, a multi-knowledge graph is constructed, as shown in Figure 4 Each graph represents different spatial correlations, where the OD pair between stations is the vertex of the graph, and the edge encodes the pairwise relationship between OD pairs, the origin of the OD, and the terminal of the OD. Denoted as G=(V,E), V represents the vertex of the graph, and E represents the edge of the graph.
[0130] 1) Spatial connectivity knowledge graph: including calculating and constructing the spatial distance matrix between the origins of key OD pairs and the spatial distance matrix between the terminals of key OD pairs.
[0131] Specifically, the spatial connectivity graph Gc is calculated according to the spatial distance between the origin stations or the terminal stations of the key OD pairs. The spatial distance d(i, j) between the station i and the station j is calculated by using the Haversine formula, and the formula is as follows:
[0132]
[0133] wherein R is the radius of the earth, and is taken as 6371 km; and λ j are the latitude of the station i and the station j respectively, and the unit is radian. i , λ j are the longitude of the station i and the station j respectively, and the unit is radian.
[0134] Each element w C in the spatial connectivity correlation matrix is the reciprocal of the spatial distance:
[0135]
[0136] It can be seen that the spatial connectivity correlation decreases with the increase of the spatial distance.
[0137] 2) Inbound or outbound volume pattern similarity knowledge graph: including calculating and constructing the origin inbound volume time pattern similarity matrix of the key OD pairs, the terminal inbound volume time pattern similarity matrix of the key OD pairs, the origin outbound volume time pattern similarity matrix of the key OD pairs, and the terminal outbound volume time pattern similarity matrix of the key OD pairs.
[0138] Specifically, the inbound or outbound volume time pattern similarity knowledge graph G I or G O adopts DTW quantification, and the core idea of DTW is to align two time series so that their distance is minimized, and the calculation process is as follows:
[0139] Suppose that two inbound volume time series are given:
[0140] The historical time inbound volume time series of the subway station 1 is X = (x1, x2,..., x m );
[0141] The historical time inbound volume time series of the subway station 2 is Y = (y1, y2,..., y n );
[0142] Wherein x m is the inbound volume of the subway station 1 at the m time, and y n is the inbound volume of the subway station 2 at the n time.
[0143] DTW calculates the shortest alignment path of two time series by constructing a cumulative distance matrix D, and the formula is as follows:
[0144]
[0145] where d(x i , y j ) is the Euclidean distance between the i I th and j I th points of sequences X and Y; D(i, j) represents the minimum matching distance accumulated from (1, 1) to (i, j).
[0146] The final DTW distance D(m, n) of time series is represented as:
[0147] D(m, n) = min alignment cost;
[0148] The smaller D(m, n) is, the greater the similarity is.
[0149] The time pattern similarity matrix of inbound volume is calculated by:
[0150]
[0151] After transformation, w I ∈ [0, 1], w I = 1 means the more similar the time series are.
[0152] 3) OD volume time pattern similarity knowledge graph: including calculating and constructing the pattern correlation matrix between key OD pairs, each element in the matrix is the Pearson correlation coefficient of the OD volume time series between OD pairs.
[0153] Specifically, the OD volume time pattern similarity knowledge graph G P adopts Pearson correlation to quantify the correlation and synchrony between time series over time. The pattern correlation matrix between key OD pairs, each element is the Pearson correlation coefficient of the historical flow data series between ODs:
[0154]
[0155] X and Y represent the time series of two OD pairs respectively, and represent the mean of each time series.
[0156] W P (X, Y) = 1 means complete positive correlation, and the trends are completely consistent; W P (X, Y) = 0 means complete no correlation; W P (X, Y) = -1 means complete negative correlation, and the trends are completely opposite.
[0157] 4) Functional similarity knowledge graph: including calculating and constructing the functional similarity matrix between the origins of key OD pairs and the functional similarity matrix between the destinations of key OD pairs.
[0158] Specifically, the functional similarity graph G F The similarity between stations in terms of regional functions (e.g. commercial, residential, etc.) is simulated. Two stations located in areas with similar urban functions may exhibit similarity in the temporal pattern of passenger flows. The regional function of a station is represented by the number of POIs (Points of Interest) in each category, the working population, and the residential population vectors within a 2-kilometer radius centered on the station.
[0159] The functional similarity between stations i and j is denoted as W F (i, j) is calculated by the cosine similarity of the vectors P(i) and P(j) composed of the number of POIs, the working population, and the residential population of the two stations, and the calculation formula is as follows:
[0160]
[0161] The functional similarity is calculated for each pair of stations and used as the weight of each edge in the graph G F .
[0162] W F (i, j) = 1, indicating complete similarity, and W F (i, j) = 0, indicating complete irrelevance.
[0163] 3. Spatial feature and temporal feature modeling
[0164] Based on the multiple knowledge graphs (four types of knowledge graphs, a total of 9 knowledge graphs, i.e. 9 adjacency matrices) of the spatial connectivity knowledge graph between origins, the spatial connectivity knowledge graph between destinations, the origin-to-origin entry volume pattern similarity graph, the origin-to-origin exit volume pattern similarity graph, the destination-to-destination entry volume pattern similarity graph, the destination-to-destination exit volume pattern similarity graph, the OD volume temporal pattern similarity graph, the origin functional similarity graph, and the destination functional similarity graph constructed above, the spatial feature modeling module and the temporal feature modeling module are used to carry out spatial feature and temporal feature modeling.
[0165] The spatial feature modeling module in this embodiment can use but is not limited to graph convolution network (GCN), graph attention network (GAT), graph autoencoder, etc., and the temporal feature modeling module can use but is not limited to gated recurrent unit (GRU), long short-term memory network (LSTM), temporal convolution network (TCN), or Transformer architecture, etc. Figure 3 A specific example of a multi-knowledge graph neural network model architecture is given, in which the spatial feature modeling module uses graph convolution network GCN, and the temporal feature modeling module uses gated recurrent unit GRU.
[0166] 1) Spatial feature modeling
[0167] As a specific example, the spatial feature modeling module employs a graph convolutional network (GCN), which is a neural network model based on graph structure data. The core idea is to use the topological structure and node features of the graph to propagate information and extract features through convolution operations.
[0168] Given the adjacency matrix A and the feature matrix X, the GCN model constructs a filter in the Fourier domain. The filter acts on the nodes of the graph and captures spatial features through its first-order neighbors.
[0169] a. Construct the OD pair feature matrix X: the OD pair feature matrix x between stations x ∈ R N×P , N is the number of OD pairs, P is the length of the OD pair time series, and the feature value at time t is X t ∈ R N×i , R represents the set of real numbers, and is a matrix or a vector.
[0170] b. GCN processing: input the knowledge graph G i and the OD pair feature matrix X into the GCN and obtain the corresponding state matrix. Multiple knowledge graphs are processed by the GCN and obtain multiple state matrices.
[0171] Specifically, for each knowledge graph G i , apply it to the OD pair feature matrix to a two-layer GCN. The GCN model is constructed by stacking multiple convolution layers, and its mathematical expression is as follows:
[0172]
[0173] Where: is the adjacency matrix with self-connection, I N is the identity matrix; is the degree matrix, defined as H (l) is the output of the l-th layer; θ (l) is the trainable parameter of the layer; σ(·) is a nonlinear activation function (such as sigmoid); and the graph-level output state result is obtained
[0174] c. Concatenation: concatenate the state matrix results of multiple knowledge graphs to obtain H concat , denoted as:
[0175] H concat =Convat(H1, H2, …, H n ).
[0176] In summary, the input of GCN in the operation process is the OD pair feature matrix and a knowledge graph, a knowledge graph and the OD pair feature matrix are input into the GCN, and a new state matrix is generated. Since 9 knowledge graphs are obtained in the foregoing, the input is 9 times, the GCN runs 9 times, and finally the state matrix results corresponding to the 9 knowledge graphs are spliced.
[0177] 2) Time feature modeling
[0178] As a specific example, the time feature modeling module adopts a gated recurrent unit (GRU), which is a variant of recurrent neural network (RNN) and is specially used for processing sequence data. Compared with long short-term memory network (LSTM), it has higher computational efficiency. The principle of the GRU model is as shown in the following formula (1): Figure 5 The traffic information at time t is obtained by receiving the hidden state h t-1 at the previous moment and the current traffic information x t as input. While capturing the current moment traffic information, the model still retains the historical traffic information trend, thereby having the ability to learn time dependence.
[0179] h t-1 represents the hidden state at time t-1, x t represents the traffic information at time t, and in this embodiment, x t is the H concat obtained by splicing the state matrix output by the GCN.
[0180] The reset gate r t is used to control the degree of ignoring the previous moment state information at the current moment:
[0181] r t =σ(W r (f(A,X t ),h t-1 )+b r );
[0182] The update gate u t is used to control the retention degree of the state information at the previous moment in the current state:
[0183] u t =σ(W u (f(A,X t ),h t-1 )+b u ;
[0184] The memory content candidate state c t represents the memory information stored at time t:
[0185] c t =tanh(W c [f(A,Xt ), (r t *h t-1 )]+b c );
[0186] h t The output state represents the final state at time t:
[0187] h t =u t *h t-1 +(1-u t )*c t ;
[0188] Where * represents pointwise (element-wise) multiplication, and W and b represent the weights and biases during model training, respectively.
[0189] In this embodiment, the input to the GRU is the splicing feature H. concat The corresponding state value at time t, and the hidden state h at the previous time. t-1 The hidden state h at time t is obtained through GRU processing. t Then, the hidden state is mapped to the prediction results of one or more future time steps through a fully connected layer. The future time steps can be 15min, 30min, 45min, or 60min.
[0190] like Figure 1 As shown, in step S300, a training set and a test set are constructed to train, test, and evaluate the multi-knowledge graph neural network model, thereby obtaining the final multi-knowledge graph neural network model.
[0191] Specifically, taking Xi'an Metro data as an example, 80% of the data is used as the training set, and the remaining 20% is used as the test set. The system predicts origin-destination (OD) passenger flow for the next 15, 30, 45, and 60 minutes.
[0192] Loss function: During training, the goal is to minimize the error between the actual value and the predicted value, using Y. t and Let represent the actual OD and the predicted OD, respectively. The loss function of the multi-knowledge graph neural network model is shown in the following equation:
[0193]
[0194] The first term refers to minimizing the error between the actual value and the predicted value; the second term L reg It is the L2 regularization term, which helps to avoid overfitting problems, and λ is a hyperparameter.
[0195] The evaluation metrics used are root mean square error (RMSE), mean absolute error (MAE), accuracy, and coefficient of determination (R²). 2The variance score (Var) is used to evaluate and optimize the multi-knowledge graph neural network model to obtain a prediction model. The multi-knowledge graph neural network model adopts the PyTorch deep learning framework.
[0196] The evaluation indicators are as follows:
[0197] (1) Root Mean Square Error (RMSE)
[0198]
[0199] (2) Mean Absolute Error (MAE)
[0200]
[0201] (3) Accuracy
[0202]
[0203] (4) Coefficient of determination (R) 2 )
[0204]
[0205] (5) Explanation of variance score (var)
[0206]
[0207] use and Let Y and N represent the actual value and predicted OD of the i-th OD in the j-th time period, respectively. M is the number of time samples, N is the number of ODs, and Y and N are the predicted ODs. yes and The set, It is the mean of Y, ||·|| F This represents the Frobenius norm, used to measure the overall error of a matrix.
[0208] Figure 6 The comparison between the actual and predicted values of OD pair (number 391) at 30-minute intervals is given, verifying that the method of the present invention has good prediction accuracy.
[0209] Corresponding to the aforementioned method for predicting short-term OD passenger flow in subways based on a multi-knowledge graph neural network model, this invention also discloses a system for predicting short-term OD passenger flow in subways based on a multi-knowledge graph neural network model, such as... Figure 7 As shown, it specifically includes:
[0210] a data collection module, configured to collect multi-source basic data related to a subway network, subway passenger flow and passenger flow influencing factors, and perform data preprocessing and extract key OD pairs of subway passenger flow;
[0211] a prediction model construction module, configured to construct a multi-knowledge graph neural network model, the neural network model being configured to firstly extract multiple spatial correlation features by using the multi-knowledge graph, then extract spatial features by using a spatial feature modeling module based on a multi-knowledge graph result and a constructed OD pair feature matrix, input a time sequence with the spatial features to a time feature modeling module to extract time features, and finally obtain an OD passenger flow prediction result of a future time through a full connection layer;
[0212] a model training and testing module, configured to construct a training set and a test set, train and test the multi-knowledge graph neural network model and evaluate to obtain a final multi-knowledge graph neural network model.
[0213] It should be noted that the detailed description of the subway short-time OD passenger flow prediction system based on the multi-knowledge graph neural network model provided in the embodiments of the present application can refer to the related description of the subway short-time OD passenger flow prediction method based on the multi-knowledge graph neural network model provided in the embodiments of the present application, which will not be repeated here.
[0214] In addition, the embodiments of the present application also provide an electronic device, which comprises a processor and a memory; the memory is used to store one or more program instructions; the processor is used to run one or more program instructions to execute the steps of the subway short-time OD passenger flow prediction method based on the multi-knowledge graph neural network model according to any one of the above.
[0215] It should be noted that the detailed description of the electronic device provided in the embodiments of the present application can refer to the related description of the subway short-time OD passenger flow prediction method based on the multi-knowledge graph neural network model provided in the embodiments of the present application, which will not be repeated here.
[0216] In addition, the embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the subway short-time OD passenger flow prediction method based on the multi-knowledge graph neural network model according to any one of the above.
[0217] It should be noted that the detailed description of the computer readable storage medium provided in the embodiments of the present application can refer to the related description of the subway short-time OD passenger flow prediction method based on the multi-knowledge graph neural network model provided in the embodiments of the present application, which will not be repeated here.
[0218] Those skilled in the art can understand that all or part of the functions of various methods in the above embodiments can be realized by hardware or by a computer program. When all or part of the functions in the above embodiments are realized by a computer program, the program can be stored in a computer readable storage medium, which can include a read-only memory, a random access memory, a magnetic disk, an optical disk, a hard disk, and the like. The above functions are realized by executing the program by a computer. For example, the program is stored in a memory of a device, and the above functions are realized by executing the program in the memory by a processor. In addition, when all or part of the functions in the above embodiments are realized by a computer program, the program can also be stored in a storage medium such as a server, another computer, a disk, an optical disk, a flash disk, or a mobile hard disk, and is saved in a memory of a local device by downloading or copying, or the system of the local device is updated, and the above functions are realized by executing the program in the memory by a processor.
[0219] The above application of specific examples to the present application is described, which is only used to help understand the present application and does not limit the present application. According to the idea of the present application, those skilled in the art can make several simple deductions, deformations, or substitutions.
Claims
1. A subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model, characterized in that, The method comprises: Collecting multi-source basic data related to subway network, subway passenger flow and passenger flow influencing factors, and performing data preprocessing to extract key OD pairs of subway passenger flow; wherein the extraction of key OD pairs of subway passenger flow specifically comprises: the key OD pair extraction needs to meet: the proportion of any OD pair zero value is lower than a preset threshold, and the total of the time series of the OD pair is greater than a preset percentile or the standard deviation of the OD pair is greater than a preset percentile; A multi-knowledge graph neural network model is constructed, which is used to first extract multiple spatial correlation features by using the multi-knowledge graph, then extract spatial features by using a spatial feature modeling module based on the multi-knowledge graph results and the constructed OD pair feature matrix, then input the time series with spatial features into a time feature modeling module to extract time features, and finally obtain the OD passenger flow prediction results of future time through a full connection layer; Wherein, the multi-knowledge graph is used to extract multiple spatial correlation features, specifically comprising: The multi-knowledge graph comprises: A spatial connectivity knowledge graph: including calculating and constructing a spatial distance matrix between the starting points of key OD pairs, a spatial distance matrix between the ending points of key OD pairs; the spatial distance between station i and station j is calculated by using the Haversine formula; each element in the spatial connectivity correlation matrix is the reciprocal of the spatial distance between stations; An inbound volume or outbound volume mode similarity knowledge graph: including calculating and constructing an inbound volume time mode similarity matrix of the starting point of the key OD pair, an inbound volume time mode similarity matrix of the ending point of the key OD pair, an outbound volume time mode similarity matrix of the starting point of the key OD pair, and an outbound volume time mode similarity matrix of the ending point of the key OD pair; the inbound volume or outbound volume time mode similarity is calculated and quantified based on the DTW function; An OD volume time mode similarity knowledge graph: including calculating and constructing a mode correlation matrix between key OD pairs, wherein each element in the matrix is the Pearson correlation coefficient of the OD passenger flow time series between OD pairs; A functional similarity knowledge graph: including calculating and constructing a functional similarity matrix between the starting points of key OD pairs and a functional similarity matrix between the ending points of key OD pairs; the functional similarity between stations i and j is calculated according to the cosine similarity of the vectors P(i) and P(j) composed of the POI quantity, working population and resident population of the two stations; The spatial feature modeling module is used to extract spatial features, specifically comprising: Construct OD pair feature matrix X: OD pair feature matrix X ∈ R N×P , N is the number of OD pairs, P is the length of the OD pair time series, the feature value at time i is X t ∈ R N×i , R represents the set of real numbers, and is a matrix or a vector; Graph convolution network GCN processing: input the knowledge graph G i and the OD pair feature matrix X into the GCN to obtain the corresponding state matrix, and multiple knowledge graphs are processed by the GCN to obtain multiple state matrices; Concatenation: the state matrix results of multiple knowledge graphs are spliced to obtain H concat ; The time series with spatial features are input into the time feature modeling module to extract time features, and finally the OD passenger flow prediction results of future time are obtained through a full connection layer, specifically comprising: H concat , input into the gated recurrent unit GRU for time series modeling and output high-dimensional hidden state results, and then map the hidden state to one or more prediction results of future time steps through the fully connected layer. A training set and a test set are constructed, the multi-knowledge graph neural network model is trained and tested, and the final multi-knowledge graph neural network model is obtained.
2. The subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model according to claim 1, characterized in that, Collecting multi-source basic data related to subway network, subway passenger flow and passenger flow influencing factors, specifically comprising: The multi-source basic data comprises subway station spatial position data, AFC card swiping data, POI data and anonymized mobile signaling data.
3. The subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model according to claim 2, characterized in that, Data preprocessing, specifically comprising: The AFC card swiping data preprocessing comprises: Sub-period subway station passenger flow statistics: AFC card data is cleaned; according to the cleaned AFC card data, the number of passengers entering and leaving the station is counted respectively according to the station and the time interval; Sub-period subway station OD passenger flow statistics: according to the cleaned AFC card data, the OD passenger flow matrix between subway stations is obtained by aggregating the OD passenger flow between the start station and the end station according to the time interval of the departure time, and a plurality of time series of the OD passenger flow matrix between subway stations is obtained; The spatial position data of the subway station is preprocessed, including: Labeling the longitude and latitude of all subway stations in the WGS-84 coordinate system and mapping them to the map; POI data preprocessing includes: Matching the coordinate system of various POI data to the coordinate system of the subway station and matching it to the map; Mobile signaling data preprocessing includes: First, the anonymized mobile signaling data is cleaned, the time stamp is unified to a standard format, the base station ID is mapped to the geographic coordinates, and the user's movement trajectory is reconstructed according to the time stamp and the base station location; Second, analyze the user's activity patterns at different times to infer the user's residence and workplace; Next, divide the study area into grids, map the user's residence or work records to the corresponding grid, and generate work and residence data for each grid; Finally, count the number of residents and workers in each grid and calibrate the sample.
4. The subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model according to claim 1, characterized in that, The multi-knowledge graph neural network model is trained, tested and evaluated, specifically including: During the training process, the goal is to minimize the error between the actual and predicted values, using Y t and represent the actual and predicted ODs, respectively, and the loss function of the multi-knowledge graph neural network model is represented as: The first term aims to minimize the error between the actual and predicted values, and the second term L reg is an L2 regularization term, and λ is a hyperparameter.
5. The subway short-time OD passenger flow prediction method based on a multi-knowledge graph neural network model according to claim 1, characterized in that, The multi-knowledge graph neural network model is trained, tested and evaluated, specifically including: The evaluation indexes include root mean square error (RMSE), mean absolute error (MAE), accuracy, determination coefficient R 2 , and explained variance score Var, and the multi-knowledge graph neural network model is evaluated and optimized to obtain a final prediction model.
6. A subway short-time OD passenger flow prediction system based on a multi-knowledge graph neural network model, characterized in that, The system includes: A data acquisition module for collecting subway network, subway passenger flow and passenger flow influencing factor related multi-source basic data and performing data preprocessing to extract key OD pairs of subway passenger flow; wherein the key OD pairs are extracted, specifically including: the key OD pairs need to meet: the proportion of any OD pair zero value is less than a preset threshold, and the total of the OD pair time series is greater than a preset percentile or the OD pair standard deviation is greater than a preset percentile; A prediction model construction module for constructing a multi-knowledge graph neural network model, the neural network model is used to first extract multiple spatial correlation features using a multi-knowledge graph, then extract spatial features using a spatial feature modeling module based on the multi-knowledge graph results and the constructed OD pair feature matrix, input the time series with spatial features to a time feature modeling module to extract time features, and finally obtain the OD passenger flow prediction results of the future time through a fully connected layer; Wherein, the multi-knowledge graph is used to extract multiple spatial correlation features, specifically including: The multi-knowledge graph includes: Spatial connectivity knowledge graph: including calculating and constructing the spatial distance matrix between the start points of the key OD pairs and the spatial distance matrix between the end points of the key OD pairs; the spatial distance between station i and station j is calculated using the Haversine formula; each element in the spatial connectivity correlation matrix is the inverse of the spatial distance between stations; Inbound or outbound volume pattern similarity knowledge graph: including calculating and constructing key OD pair start point inbound volume time pattern similarity matrix, key OD pair end point inbound volume time pattern similarity matrix, key OD pair start point outbound volume time pattern similarity matrix, key OD pair end point outbound volume time pattern similarity matrix; inbound or outbound volume time pattern similarity is calculated and quantified based on DTW function; OD volume time pattern similarity knowledge graph: including calculating and constructing pattern correlation matrix between key OD pairs, each element in the matrix is the Pearson correlation coefficient of the OD volume time series between OD pairs; Functional similarity knowledge graph: including calculating and constructing key OD pair start point functional similarity matrix, key OD pair end point functional similarity matrix; the functional similarity between stations i and j is calculated according to the cosine similarity of the vectors P(i) and P(j) composed of the POI volume, working population and resident population of the two stations; The spatial feature modeling module is used to extract spatial features, specifically including: Construct OD pair feature matrix X: OD pair feature matrix X ∈ R N×P , N is the number of OD pairs, P is the length of the OD pair time series, the feature value at time i is X t ∈ R N×i , R represents a set of real numbers, and is a matrix or a vector; Graph convolution network GCN processing: input the knowledge graph G i and the OD pair feature matrix X into the GCN to obtain the corresponding state matrix, and multiple knowledge graphs are processed by the GCN to obtain multiple state matrices; Concatenation: the state matrix results of multiple knowledge graphs are spliced to obtain H concat ; The time series with spatial features are input into the time feature modeling module to extract time features, and finally the OD passenger flow prediction result of the future time is obtained through the full connection layer, specifically including: H concat , input into the gated recurrent unit GRU for time series modeling and output high-dimensional hidden state results, and then map the hidden state to one or more prediction results of future time steps through the fully connected layer. The model training and testing module is used to construct the training set and the test set, train and test the multi-knowledge graph neural network model, and evaluate to obtain the final multi-knowledge graph neural network model.
Citation Information
Patent Citations
Intercity travel OD demand prediction model training method, prediction method and system
CN117076922A