OD demand prediction method and system based on dynamic spatio-temporal correlation
By using a dynamic spatiotemporal correlation-based OD demand prediction model, BiLSTM and graph convolutional networks are used to extract OD demand variation features, and a transformer model is combined to capture urban regional similarities. This solves the problem of low OD demand prediction accuracy and improves prediction precision and transportation system efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2026-03-24
AI Technical Summary
Existing OD demand forecasting schemes fail to effectively consider the correlation of OD demand changes, resulting in low forecast accuracy and impacting traffic flow control and vehicle scheduling.
An OD demand prediction model based on dynamic spatiotemporal correlation is adopted. The demand change features are extracted by BiLSTM and graph convolutional network, and the similarity features of urban areas are captured by the transformer model. The features are fused by multi-head temporal convolutional layers to construct the OD demand prediction model.
It improves the accuracy of OD demand forecasting, reduces mean absolute error and root mean square error, and enhances the efficiency of traffic flow control and vehicle scheduling.
Smart Images

Figure CN116311939B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of traffic flow prediction, and particularly relates to an OD demand prediction method and system based on dynamic spatio-temporal correlation. BACKGROUND
[0002] The statements in this section merely provide background information related to the present application and do not necessarily constitute the prior art.
[0003] Traffic plays a vital role in everyone's daily life, and accurate traffic prediction is an important task in intelligent transportation systems. As an important part of the road traffic system, taxis are a common choice for people's daily travel. Currently, common problems of taxi service include mismatch between supply and demand, long waiting time for passengers, and excessive empty trips, etc. Understanding the movement pattern of passengers is very important to improve the service efficiency of the highway system. Therefore, more and more work focuses on the Origin-Destination (OD) prediction. The OD demand reflects the mobility of passengers and contains the flow information between regions. If the origin and destination regions of passengers can be accurately predicted, taxis can be reasonably allocated to reduce travel time and empty rate, avoid road congestion, and promote the operation and management of urban intelligent transportation systems.
[0004] So far, various methods have been proposed to solve the flow prediction problem, which can be divided into three categories. The first category is traditional methods, such as historical average (HA), autoregressive integrated moving average (ARIMA) and vector autoregressive (VAR), etc., but these methods are only suitable for small data sets. The second category is machine learning methods, such as support vector regression (SVR) and random forest regression (RFR), etc., but machine learning methods cannot learn complex traffic patterns and it is difficult to obtain spatio-temporal correlation, which is inefficient. The third category is deep learning methods, and the commonly used methods in deep learning framework are convolutional neural network (CNN), graph convolution network (GCN), etc. In addition, recurrent neural network (RNN) and its variants long short-term memory (LSTM) or gated recurrent unit (GRU) are usually used to model time dependence.
[0005] In recent years, more work attempts to model traffic data using attention mechanisms, diffusion models, and transformer methods to dynamically capture spatial and temporal correlations; although some studies use various methods to model temporal and spatial correlations, such as using attention mechanisms to capture spatial information, using LSTM to extract temporal features of OD pairs, or using encoder-decoder to model spatial and temporal features between different OD pairs, etc., none of the above methods take into account the OD demand change correlation, i.e., 1) the passenger demand change from adjacent regions to all destination regions is similar; 2) when arriving at adjacent regions, the passenger demand change from all origin regions is similar. In addition, the OD demand volume is affected by the passenger flow of the relevant region and the time period, etc. In summary, the existing OD demand prediction scheme has the problem of low prediction accuracy, which affects traffic control, line planning and vehicle scheduling. SUMMARY
[0006] To overcome the shortcomings of the prior art and achieve optimal traffic prediction, the present application provides an OD demand prediction method and system based on dynamic spatio-temporal correlation, proposes an OD demand prediction model based on dynamic spatio-temporal correlation, fully considers the OD demand trend correlation features, effectively learns the spatio-temporal information between nodes to capture spatio-temporal features, and accurately predicts future OD demand in long-term prediction and short-term prediction.
[0007] To achieve the above object, one or more embodiments of the present application provide the following technical solutions:
[0008] The present application provides an OD demand prediction method based on dynamic spatio-temporal correlation in the first aspect;
[0009] The OD demand prediction method based on dynamic spatio-temporal correlation comprises:
[0010] Obtain historical passenger demand data records related to the target city, and calculate historical OD matrices of different periods related to the target period to construct an OD demand dataset;
[0011] Construct an OD demand prediction model based on the OD demand dataset, with the historical OD matrices of different periods as input and the OD matrix of the target period as output, and train the constructed OD demand prediction model;
[0012] Sample the OD matrices of different periods related to the to-be-predicted period and input them into the trained OD demand prediction model to obtain the OD matrix of the to-be-predicted period;
[0013] The OD demand prediction model uses dynamic spatio-temporal correlation to extract demand change features and city region similarity features, and performs OD demand learning and prediction based on the fusion results of the two features.
[0014] Further, the passenger demand data comprises a starting area, an ending area and timestamp information;
[0015] The different periods related to the target period are specifically: week period data, day period data and recent data.
[0016] Further, the week period data is: obtaining historical OD matrices of corresponding periods in a preset number of weeks before the target period, and connecting to obtain the week period data;
[0017] The day period data is: obtaining historical OD matrices of corresponding periods in a preset number of days before the target period, and connecting to obtain the day period data;
[0018] The recent data is: obtaining historical OD matrices of corresponding periods in a preset number of periods before the target period, and connecting to obtain the recent data.
[0019] Further, the OD demand prediction model comprises a demand change feature extraction layer, a city area similarity feature extraction layer, a feature fusion layer, a GRU layer and a multi-head time convolution layer.
[0020] Further, the demand change feature extraction layer is specifically:
[0021] (1) Based on the BiLSTM model, the demand change trend features between city areas are obtained in the destination direction and the starting point direction respectively;
[0022] (2) Using a graph convolution method, spatial graph convolution is performed on adjacent time steps to aggregate the spatio-temporal convolution features of each region and its adjacent regions;
[0023] (3) The demand change trend features and the spatio-temporal convolution features are fused to obtain the demand change features.
[0024] Further, the city area similarity feature extraction layer is specifically:
[0025] The feature information of adjacent grids is aggregated by convolution operation to extract grid flow features;
[0026] External factor information of the target period is extracted, including the week attribute and time attribute of the target period;
[0027] Based on the extracted grid flow features and external factor information, the similarity between grids is calculated using a transformer to obtain city grid embedding features;
[0028] Based on the city grid embedding features, shape changes and up-sampling are performed to obtain city area similarity features.
[0029] Further, the multi-head time convolution layer, specifically:
[0030] The fusion result of the demand change feature and the city area similarity feature is split into multiple heads, the adjacent time information is fused using the time convolution layer, and the final target period OD matrix is obtained.
[0031] The second aspect of the application provides an OD demand prediction system based on dynamic spatio-temporal correlation.
[0032] The OD demand prediction system based on dynamic spatio-temporal correlation comprises a data construction module, a model construction module and a demand prediction module:
[0033] The data construction module is configured to: obtain historical passenger demand data records related to a target city, and calculate historical OD matrices of different periods related to a target period, to construct an OD demand dataset;
[0034] The model construction module is configured to: construct an OD demand prediction model, based on the OD demand dataset, with the historical OD matrices of different periods as input and the OD matrix of the target period as output, to train the constructed OD demand prediction model;
[0035] The demand prediction module is configured to: sample the OD matrices of different periods related to a to-be-predicted period, input them into the trained OD demand prediction model, and obtain the OD matrix of the to-be-predicted period;
[0036] The OD demand prediction model extracts demand change features and city area similarity features using dynamic spatio-temporal correlation, and learns and predicts OD demand based on the fusion result of the two features.
[0037] The third aspect of the application provides a computer readable storage medium having a program stored thereon, the program being executed by a processor to implement the steps of the OD demand prediction method based on dynamic spatio-temporal correlation according to the first aspect of the application.
[0038] The fourth aspect of the application provides an electronic device comprising a memory, a processor and a program stored on the memory and executable on the processor, wherein the processor implements the steps of the OD demand prediction method based on dynamic spatio-temporal correlation according to the first aspect of the application when executing the program.
[0039] The above one or more technical solutions have the following beneficial effects:
[0040] (1) The OD demand trend correlation is modeled and utilized for the first time, and in the OD demand prediction problem, modeling is performed in the destination direction and the starting point direction respectively to obtain the demand change between city areas.
[0041] (2) A module is proposed to capture the grid similarity to learn the dynamic correlation between any urban region in the OD matrix and obtain the similarity features between the demand of the urban grid, and then a fine-grained feature extraction method is developed to improve the specific representation of each region.
[0042] (3) The demand change features and urban grid region features are effectively fused, and the information on adjacent time slices is combined through a good multi-head time convolution layer.
[0043] (4) The model designed in the application is superior to other advanced methods for OD demand prediction, and the application can be migrated to other traffic data sets for prediction.
[0044] The advantages of the additional aspects of the application will be partially given in the following description, partially become obvious from the following description, or be known by the practice of the application. BRIEF DESCRIPTION OF DRAWINGS
[0045] The drawings constituting a part of the specification of the application are used to provide further understanding of the application, the illustrative embodiments of the application and the description thereof are used to explain the application, and do not constitute improper limitation on the application.
[0046] Figure 1 The method flowchart of the first embodiment.
[0047] Figure 2 The OD demand prediction model structure diagram of the first embodiment.
[0048] Figure 3 The schematic diagram of obtaining demand change trend features by BiLSTM of the first embodiment.
[0049] Figure 4 The OD matrix schematic diagram of the first embodiment.
[0050] Figure 5 The urban grid region feature extraction flowchart of the first embodiment.
[0051] Figure 6 The system structure diagram of the second embodiment. DETAILED DESCRIPTION
[0052] The application will be further described below in combination with the drawings and embodiments.
[0053] The challenge of OD demand prediction is:
[0054] 1) Destination and distribution are predicted simultaneously: the number of passengers in the entire urban network and the number of passengers going to each destination need to be predicted simultaneously.
[0055] 2) Complex spatio-temporal correlation in OD matrix: considering the correlation of OD demand changes, effectively utilizing the spatio-temporal correlation to model the trend of OD demand changes.
[0056] It can be seen that the OD demand prediction is a key task in the field of intelligent transportation, and accurate OD demand prediction is particularly important for traffic control, route planning and vehicle scheduling, etc. Inspired by the above problems, the present application designs an OD demand prediction model based on dynamic spatio-temporal correlation to effectively predict OD demand, i.e. the OD matrix of the period to be predicted.
[0057] For ease of understanding, the OD matrix is first described:
[0058] The OD matrix (abbreviation of origin-destination) is a matrix with passenger traffic volume (OD volume) between any two partitions as elements, sorted by rows (starting area) and columns (ending area) of all traffic partitions. Therefore, in the present application, the passenger traffic volume between the starting area and the destination area is represented as an OD matrix, and the complete OD matrix of a city with N areas has N*N grids.
[0059] Embodiment one
[0060] The present embodiment discloses an OD demand prediction method based on dynamic spatio-temporal correlation;
[0061] As shown in Figure 1 , the OD demand prediction method based on dynamic spatio-temporal correlation comprises:
[0062] Step S1: obtaining historical passenger demand data records related to the target city, and calculating historical OD matrices of different periods related to the target period to construct an OD demand dataset, the specific steps being:
[0063] Step S101: obtaining OD demand tensor data: statistically analyzing the set of real historical passenger demand data records of the city to form an OD demand tensor.
[0064] Firstly, a set of historical passenger demand data records of the city is obtained from a public data website, the city area is divided into N areas, and each record contains passenger ID, starting area, ending area and timestamp information; then, the data set is filtered and deleted, for example, records with inconsistent years or months are removed, records with starting area or ending area not belonging to the target city are removed, etc. According to the column information of the starting area, the ending area and the timestamp, all transaction records meeting the requirements are traversed to form an OD demand tensor, i.e. a three-dimensional vector composed of the starting area, the ending area and the timestamp.
[0065] Step S102: Sample historical demand data of different periods from the OD demand tensor: Construct three types of historical data of different periods to predict OD demand in future periods, namely weekly period data, daily period data and recent data.
[0066] From the OD demand tensor, sample the periodic data X related to the target time period. w Daily cycle data X d And recent data X r The ratio is X w ,X d ,X r =2:1:2, for X w ,X d and X r By concatenating the series, OD matrices X with different periods are obtained. M =[X w ,X d ,X r ], where M represents the number of time segments, M = 2 + 1 + 2 = 5; then, with the aid of the transportation network G = (V, E, A) and the external factor ε, X is predicted. M G and ε are used as inputs to the OD demand forecasting model to predict traffic flow in future periods, as expressed by the formula:
[0067]
[0068] Where f represents the OD demand prediction model constructed in this invention. This represents the OD matrix for the predicted time period t.
[0069] To improve the prediction accuracy of the OD demand forecasting model, it is necessary to construct a training dataset for learning and training, using OD matrices X at different periods. M The traffic network G and external factors ε are used as inputs, with the OD matrix of the target time period t as the input. The OD demand prediction model is trained using labels, so the training dataset is constructed as follows:
[0070] From the OD demand tensor, sample the OD matrix for the target time period t. and the weekly periodic data X related to the target time period t w Daily cycle data X d And recent data X r , construct by X M =[X w ,X d ,X r ]and The training dataset consists of these components.
[0071] Weekly data X related to the target time period t w, the daily cycle data X d and the recent data X r , and the specific sampling mode is:
[0072] The historical OD matrix of the corresponding period in the previous preset week range of the target period t is obtained, and the daily cycle data X is connected. w In this embodiment, the previous preset week range is from the previous 1 week to the previous 2 weeks.
[0073] The historical OD matrix of the corresponding period in the previous preset day range of the target period t is obtained, and the daily cycle data X is connected. d In this embodiment, the previous preset day range is the previous 1 day.
[0074] The historical OD matrix of the corresponding period in the previous preset period range of the target period t is obtained, and the recent data X is connected. r In this embodiment, the previous preset period range is the previous 2 periods.
[0075] Step S2: Constructing an OD demand prediction model, based on the OD demand data set, taking the historical OD matrix of different periods as input and the OD matrix of the target period as output, training the constructed OD demand prediction model.
[0076] The OD demand prediction model is used to predict the OD matrix of the target period according to the historical OD matrix, as shown in Figure 2 , specifically including a demand change feature extraction layer, a city area similarity feature extraction layer, a feature fusion layer, a GRU layer and a multi-head time convolution layer.
[0077] 1. Demand change feature extraction layer
[0078] Obtaining demand change features includes obtaining destination demand change features and demand change features from starting areas, and obtaining demand change features in the destination direction and the starting point direction. Since the steps of obtaining destination demand change features and obtaining demand change features from starting areas are similar, only the direction is different, the process of obtaining destination demand change features is mainly introduced as follows:
[0079] (1) Based on the BiLSTM model, the demand change trend features between city areas in the destination direction are obtained.
[0080] Figure 3 is a schematic diagram for obtaining demand change trend features by BiLSTM, Figure 3There are two capturing directions: (a) is the destination direction, and (b) is the origin direction. Specifically, (a) is the BiLSTM modeling capturing the demand change trend features of each region to all destinations in the destination direction, and (b) is the BiLSTM modeling capturing the demand change trend features from all origins in the origin direction.
[0081] The BiLSTM model is composed of a forward LSTM and a reverse LSTM. LSTM is a long short-term memory network that can capture long-term dependencies of node traffic change trends. For example, Figure 3 In the direction of (a), is the input sequence. In this example, represents the number of passengers from region o to d. is also part of X M , represents the traffic demand from region i to all destination regions. is the reverse order of , representing the traffic demand from region i to all destination regions arranged in reverse order. and are the outputs obtained by processing and by LSTM, respectively, representing the demand change trend features from region i to all destination regions and the demand change trend features from region i to all destination regions arranged in reverse order. is arranged in reverse order in the original order, concatenated with and to obtain the destination demand change feature h i of region i, which is specifically expressed as follows:
[0082]
[0083]
[0084]
[0085] where concatenate represents concatenation.
[0086] Assuming that the hidden unit of BiLSTM is D, the corresponding vector and vector have a dimension of D, and vector h has a dimension of 2D.
[0087] The above formulas (2), (3), and (4) can be summarized as h i = BiLSTM i (Xi ), the obtained h i represents the destination demand change characteristics of region i, assuming that there are N regions in total, so BiLSTM = (BiLSTM1, … BiLSTM i ,…,BiLSTM N ), modeling in the destination direction through BiLSTM can capture the demand change trend from each region to all destination regions, and the process formula is as follows:
[0088] H D = BiLSTM(X M ) (5)
[0089] wherein H D contains the demand change trend characteristics of each starting region to all destination regions.
[0090] (2) Using the graph convolution method, performing spatial graph convolution on adjacent time steps, and aggregating the spatio-temporal convolution features of each region and its adjacent regions.
[0091] This embodiment defines a graph convolution operation every three time steps, assuming that the input of the graph convolution is wherein, represents the passenger demand characteristics from region i to other regions during the time periods t-1, t, t+1. According to the definition of graph convolution, the output feature is calculated using the following equation
[0092]
[0093] wherein, represents the result of the time graph convolution on the t-1, t, t+1 time periods, f D = {f D (X1), …, f D (X M-2 )} represents the results of the graph convolution after M-2 cycles, and f D Each region in f D aggregates the spatio-temporal convolution features of itself and adjacent regions in adjacent time steps.
[0094] (3) The demand change trend characteristics and the spatio-temporal convolution characteristics are fused to obtain the demand change characteristics.
[0095] In order to dynamically explore the OD demand trend correlation between regions in the destination direction, the demand change trend characteristics H D and the graph convolution feature results f D are fused to obtain the demand change characteristics X DGlstm , X DGlstm contains the OD demand trend characteristics of all regions in the destination direction, and the formula is as follows:
[0096]
[0097] X DGlstm = H D DGlstm ) (8)
[0098] The above is the process of obtaining the destination demand change feature. Similar to the step of obtaining the destination demand change feature, H O is obtained in the origin direction by the BiLSTM model, and the specific steps are shown in the direction (b) of Figure 3 , H O contains the demand change trend features from all starting areas to each destination; the demand feature f O of each starting area is obtained by modeling through the graph convolution, and then H O and f O are fused to obtain X OGlstm , X OGlstm contains the OD demand trend features of all areas in the origin direction.
[0099] To learn the change trend of traffic from the destination direction and the origin direction at the same time, the destination demand change feature X DGlstm and the origin demand change feature X OGlstm are fused to obtain the demand change feature X Gslstm , and the fusion process formula is as follows:
[0100] H con = concatenate(X DGlstm , X OGlstm ) (9)
[0101] X Glstm = FC(H con ) (10)
[0102] X Glstm contains the departure demand change feature of the area and the demand change feature from other areas.
[0103] 2. City area similarity feature extraction layer
[0104] Figure 4 The OD matrix of some areas selected from the embodiment area in a certain period is shown, and the same colored grid represents similar passenger demand. Even if the grid positions are far apart, but the passenger flow is similar, it means that there is similarity between the grids. A layer is designed in this embodiment to capture the city grid similarity feature, and the city area similarity feature is captured by the following 4 steps:
[0105] First, we aggregate the feature information of adjacent grids through convolution operations to extract the grid's flow information features. Then, we extract the week and hour factors of the OD demand matrix at time t and encode them as a time vector. We fuse this time embedding vector with the grid flow information features obtained above to obtain a new feature X. xext Then, through the attention mechanism in the transformer, X is... xext Modeling is performed to calculate the similarity between regional grids, and then the embedding vectors of the city grids are obtained. Finally, fine-grained extraction is performed on the embedded feature vectors to obtain the high-dimensional features X of the regional grids. deconv Finally, X deconv X is obtained by performing a residual connection with the original feature X. simformer .
[0106] (1) The feature information of adjacent grids is aggregated by convolution operation to extract grid flow features, specifically:
[0107] First, a 4x4 convolution kernel is used for X. M Perform convolution operations and aggregate X M The feature information of adjacent grids is used to obtain the feature information.
[0108] Then, for the feature information X conv tiling is performed to obtain the grid flow characteristics.
[0109] According to N sm ×N sm We use grid flow characteristics to learn the dynamic correlations between urban grids.
[0110] (2) Extract external factor information for the target time period, including the weekly and hourly attributes of the target time period.
[0111] The time attributes of the target or predicted time period are used as external factors, namely the week attribute and the hour attribute. Hot coding is used to encode the time attributes into a time vector. The week attribute of time period t is encoded into a 7-dimensional space E. week ∈R 7 This indicates the day of the week within which the time period falls; the hour attribute is encoded as a 24-dimensional space E. hour ∈R 24 , indicates the hour in the 24-hour time system, for E week and E hour Perform full connectivity and tiling to obtain and Then Ef′ week and Ef′ hour With X Faltten Combine to obtain Xxext X is used as input to the transformer for feature learning. xext Expressed as a formula:
[0112] X xext =X Faltten +Ef′ week +Ef′ hour (11)
[0113] (3) Based on the extracted grid flow characteristics and external factor information, the similarity between grids is calculated using transformer to obtain the urban grid embedding characteristics.
[0114] Using a transformer to calculate the similarity between grids, external factor information X xext As input, attention scores are first obtained through a multi-head attention mechanism. Based on these attention scores, the flow features of all grids are aggregated to generate a high-level feature h that includes the spatial correlation of each grid. i Then concatenate all h i Obtain the high-level feature X of all meshes trans Finally, the city grid embedding features X are obtained through an MLP module. trans_b .
[0115] (4) Based on the urban grid embedding features, shape transformation and upsampling are performed to obtain urban area similarity features.
[0116] embedding features X of urban grid trans_ Shape transformation and upsampling are performed to obtain the feature X of each city grid area. deconv ∈R (N×N)×D The specific process is as follows Figure 5 As shown, X deconv The D dimension in the model only includes the demand features of one grid, for example, the demand features from region i to region j; the feature extraction process used is more fine-grained, X deconv High-dimensional features containing grids in the OD matrix.
[0117] To preserve the original demand characteristics, a residual structure, X, was designed. deconv By performing a residual connection with the original feature X, the urban area similarity features are obtained, specifically represented as follows:
[0118] X simformer =X deconv +FC(X M (12)
[0119] Among them, X simformer ∈R (N×N)×D It includes the original requirements of the OD matrix and the high-dimensional features of the grid.
[0120] 3. Feature fusion layer
[0121] X Glstm and urban area similarity feature X simformer are fused to obtain the final embedding feature vector X fusion , and the specific formula is as follows:
[0122]
[0123] X fusion = FC(X Glstm · tanh(H) (14)
[0124] 4. GRU layer
[0125] The embedding feature vector X fusion obtained is subjected to feature extraction in the time dimension by the GRU method to obtain the latent representation feature X gru of the area demand feature.
[0126] Compared with LSTM, the GRU unit has only two gates, fewer parameters, and shorter training time, and the formula of GRU is as follows:
[0127] r t = σ([H t-1 , U t ]· W r + b r ) (15)
[0128] z t = σ([H t-1 , U t ]· W u + b u ) (16)
[0129]
[0130]
[0131] wherein r t is the forgetting gate, z t is the update gate; H t is the output of the GRU unit, H t-1 is the hidden state of the last iteration, and sigma is the sigmoid function. t represents the time segment of the input historical traffic data. W r , W u , W h , b r , and b u are trainable parameters, and X gru∈R D×N×M .
[0132] 5. Multi-head temporal convolutional layers
[0133] The fusion result of demand change characteristics and urban area similarity characteristics is split into multiple heads, and adjacent time information is fused using a temporal convolutional layer to obtain the final OD matrix of the target time period or the time period to be predicted.
[0134] Specifically, firstly, a multi-head structure is adopted to distribute the latent representation features X gru The M time segments are divided into M i The length of h′ time intervals, i.e. Then, to Use temporal convolution to transform M i The time period length is regularized to P time period length. Finally, the data are aggregated to obtain the OD matrix X of the target time period or the time period to be predicted. out The specific process can be expressed by the following formula:
[0135]
[0136]
[0137] Where * denotes the standard convolution operation, and θ is the parameter of the temporal convolution kernel. This represents a convolution operation with a kernel size of 1×t. i Finally, the result X was obtained. out ∈R N×N×P .
[0138] After the OD demand forecasting model is built, based on the OD demand dataset, the historical OD matrix X for different periods is used. M =[X w ,X d ,X r [Original OD matrix for input and target time period] The model is trained to produce the output.
[0139] Before training, the OD requirement dataset is divided into a training set, a validation set, and a test set in a 6:2:2 ratio. The training set is used to train the model and determine the parameters, the validation set is used to determine the model structure and adjust the model's hyperparameters, and the test set is used to test the model's generalization ability.
[0140] The model is trained and verified through the training set and the validation set, the best model is selected to predict the test set, the error of the predicted OD matrix and the real OD matrix is calculated, and the evaluation indexes MAE (Mean Absolute Error) and RMSE (Root Mean Square Error) are calculated to evaluate the performance of the model. The formulas of MAE and RMSE are as follows:
[0141]
[0142]
[0143] Wherein, P x N x N is the total number of test samples, and are the real value and the predicted value of passenger demand from area i to area j at t period; compared with the existing better prediction algorithm, the accuracy of MAE is improved by about 4%, and the accuracy of RMSE is improved by about 5%.
[0144] Step S3: sample the OD matrix of different periods related to the to-be-predicted period, input into the trained OD demand prediction model, and obtain the OD matrix of the to-be-predicted period.
[0145] For example, taking 2023-03-24 16:00-16:30 as the to-be-predicted period, the OD matrix of this period, i.e. the passenger demand value between N areas of the target city, is to be predicted. First, sample the OD matrix of different periods related to the to-be-predicted period from the historical data, i.e. the weekly period data, the daily period data and the recent data, and connect them to obtain the historical OD matrix X M , input into the OD demand prediction model, and output the OD matrix of the to-be-predicted period.
[0146] Embodiment two
[0147] The embodiment discloses an OD demand prediction system based on dynamic spatio-temporal correlation;
[0148] As shown in Figure 6 , the OD demand prediction system based on dynamic spatio-temporal correlation includes a data construction module, a model construction module and a demand prediction module:
[0149] The data construction module is configured to: acquire historical passenger demand data records related to a target city, and calculate historical OD matrices of different periods related to a target period, to construct an OD demand data set;
[0150] The model construction module is configured to construct an OD demand prediction model, train the constructed OD demand prediction model based on an OD demand dataset, and input a historical OD matrix of different periods as input and an OD matrix of a target period as output.
[0151] The demand prediction module is configured to sample an OD matrix of different periods related to a to-be-predicted period, input the OD matrix to the trained OD demand prediction model, and obtain an OD matrix of the to-be-predicted period.
[0152] The OD demand prediction model extracts demand change features and urban area similarity features by using dynamic spatio-temporal correlation, and learns and predicts OD demand based on a fusion result of the two features.
[0153] Embodiment three
[0154] An object of the embodiment is to provide a computer-readable storage medium.
[0155] A computer-readable storage medium has a computer program stored thereon, and the program is executed by a processor to implement steps in the OD demand prediction method based on dynamic spatio-temporal correlation according to the embodiment one of the present disclosure.
[0156] Embodiment four
[0157] An object of the embodiment is to provide an electronic device.
[0158] An electronic device includes a memory, a processor, and a program stored on the memory and executable on the processor, and the processor implements steps in the OD demand prediction method based on dynamic spatio-temporal correlation according to the embodiment one of the present disclosure when executing the program.
[0159] The above merely describes preferred embodiments of the present disclosure, but is not intended to limit the present disclosure. The present disclosure can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for forecasting OD demand based on dynamic spatiotemporal correlation, characterized in that, include: Obtain historical passenger demand data records related to the target city, and calculate historical OD matrices for different periods related to the target time period to construct an OD demand dataset; An OD demand forecasting model is constructed based on an OD demand dataset. The model is trained by taking the historical OD matrix of different periods as input and the OD matrix of the target period as output. Sample the OD matrix of different periods related to the period to be predicted, input it into the trained OD demand prediction model, and obtain the OD matrix of the period to be predicted; The OD demand prediction model utilizes dynamic spatiotemporal correlation to extract demand change characteristics and urban area similarity characteristics. Based on the fusion result of the two characteristics, it learns and predicts OD demand. The OD demand prediction model includes a demand change feature extraction layer, an urban area similarity feature extraction layer, a feature fusion layer, a GRU layer, and a multi-head temporal convolutional layer. The multi-head temporal convolutional layer is specifically as follows: The fusion result of demand change characteristics and urban area similarity characteristics is split into multiple heads, and temporal convolutional layers are used to fuse adjacent time information to obtain the final target time period OD matrix.
2. The OD demand forecasting method based on dynamic spatiotemporal correlation as described in claim 1, characterized in that, The passenger demand data includes the origin region, destination region, and timestamp information; The different periods related to the target time period are specifically: weekly period data, daily period data, and recent data.
3. The OD demand forecasting method based on dynamic spatiotemporal correlation as described in claim 2, characterized in that, The periodic data is obtained by acquiring the historical OD matrix corresponding to the previous preset number of weeks of the target period and concatenating them to obtain the periodic data. The daily cycle data is obtained by acquiring the historical OD matrix corresponding to the previous preset number of days of the target time period and connecting them to obtain the daily cycle data. The recent data is obtained by acquiring the historical OD matrix corresponding to the previous preset number of time periods of the target time period and concatenating them to obtain the recent data.
4. The OD demand forecasting method based on dynamic spatiotemporal correlation as described in claim 1, characterized in that, The demand change feature extraction layer is specifically as follows: (1) Based on the BiLSTM model, the demand change trend characteristics between urban areas are obtained in the destination direction and the origin direction, respectively; (2) Using the graph convolution method, spatial graph convolution is performed at adjacent time steps to aggregate the spatiotemporal convolution features of each region and its adjacent regions; (3) The demand change trend features and spatiotemporal convolution features are fused to obtain the demand change features.
5. The OD demand forecasting method based on dynamic spatiotemporal correlation as described in claim 1, characterized in that, The urban area similarity feature extraction layer is specifically as follows: The feature information of adjacent grids is aggregated by convolution operation to extract grid flow features; Extract external factor information for the target time period, including the weekly and hourly attributes of the target time period; Based on the extracted grid traffic features and external factor information, the similarity between grids is calculated using a transformer to obtain the urban grid embedding features; Based on the urban grid embedding features, shape transformation and upsampling are performed to obtain urban area similarity features.
6. An OD demand forecasting system based on dynamic spatiotemporal correlation, characterized in that, It includes a data building module, a model building module, and a demand forecasting module: The data construction module is configured to: acquire historical passenger demand data records related to the target city, calculate historical OD matrices for different periods related to the target time period, and construct an OD demand dataset; The model building module is configured to: build an OD demand prediction model, and train the built OD demand prediction model based on the OD demand dataset, using historical OD matrices of different periods as input and OD matrices of the target period as output; The demand forecasting module is configured to: sample OD matrices of different periods related to the time period to be predicted, input them into the trained OD demand forecasting model, and obtain the OD matrix of the time period to be predicted. The OD demand prediction model utilizes dynamic spatiotemporal correlation to extract demand change characteristics and urban area similarity characteristics. Based on the fusion result of the two characteristics, it learns and predicts OD demand. The OD demand prediction model includes a demand change feature extraction layer, an urban area similarity feature extraction layer, a feature fusion layer, a GRU layer, and a multi-head temporal convolutional layer. The multi-head temporal convolutional layer is specifically as follows: The fusion result of demand change characteristics and urban area similarity characteristics is split into multiple heads, and temporal convolutional layers are used to fuse adjacent time information to obtain the final target time period OD matrix.
7. An electronic device, characterized in that it comprises: Memory is used to store computer-readable instructions in a non-transitory manner. as well as Processor, for executing the computer-readable instructions, When the computer-readable instructions are executed by the processor, they perform the method described in any one of claims 1-5.
8. A storage medium, characterized in that, The computer-readable instructions are stored non-transitory, wherein when the non-transitory computer-readable instructions are executed by a computer, the instructions of the method according to any one of claims 1-5 are executed.
Citation Information
Patent Citations
Method for forecasting rail traffic OD passenger flow volume based on sequential characteristics
CN108564228A
OD market aviation passenger flow volume prediction method based on space-time convolutional network
CN114118508A