Online car-hailing demand prediction method and device and electronic equipment
By combining graph convolution, variational autoencoder, attention mechanism, long-term memory network and multi-graph convolution, feature extraction and weighting of online ride-hailing needs is solved, and the problem of low accuracy of demand prediction in the existing technology is achieved, and higher prediction accuracy and stability are achieved.
Patent Information
- Application Number
- CN202510206612.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-05-27
AI Technical Summary
The current online ride-hailing demand forecasting method has low accuracy, resulting in unreasonable scheduling and inability to achieve a balance between supply and demand.
Graph convolution and variational autoencoder are used to extract the observed data feature, combine the attention mechanism block for weighting, extract time features through long and short-term memory networks, and extract spatial features through multi-graph convolution, and finally demand prediction is performed through the full connection layer.
It improves the accuracy and stability of online ride-hailing demand forecasting, can better capture the time and space dependencies, and solves the problem of low accuracy of demand forecasting.
Smart Images

Figure CN120046805A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of traffic prediction, and particularly to a method, device and electronic device for predicting the demand for online car-hailing services. Background Art
[0002] Online car-hailing services provide door-to-door ride-hailing services for customers at any time and place. In recent years, they have experienced rapid development, bringing convenience to people's lives. However, there are also many problems in this industry, such as the long waiting time for passengers after calling a car, the high empty car rate of drivers, and the unreasonable order dispatching of the platform. The main reason for these problems is the unreasonable dispatching of online car-hailing services, and the supply and demand cannot reach a balance.
[0003] In order to dispatch online car-hailing services more reasonably, the demand for online car-hailing services can be predicted, that is, the demand for online car-hailing services in different regions at different future times is predicted, so as to dispatch online car-hailing services more reasonably according to the demand for online car-hailing services. Specifically, a neural network can be used to extract valuable features from the historical data of online car-hailing service demands related to online car-hailing service orders and use these valuable features for prediction. However, the neural network architecture and the selection of valuable features adopted by the current online car-hailing service demand prediction method have limitations, and thus there is a problem of low accuracy in predicting the demand for online car-hailing services. Summary of the Invention
[0004] In the present invention, a method, device and electronic device for predicting the demand for online car-hailing services are provided to solve the problem of low accuracy in predicting the demand for online car-hailing services by the current online car-hailing service demand prediction method.
[0005] In a first aspect, the present invention provides a method for predicting the demand for online car-hailing services, including:
[0006] Feature extraction is respectively performed on the observed data through graph convolution and variational autoencoder, where the observed data includes online car-hailing service order data in different regions at different historical time steps;
[0007] Max-pooling operation is performed on the observed data and the features extracted by the graph convolution and variational autoencoder to obtain a global feature vector, and an attention mechanism block is used to process the global feature vector to obtain observed weights, where the observed weights include the weights of the online car-hailing service order data in different historical time steps, and the online car-hailing service order data in different historical time steps is weighted according to the observed weights;
[0008] Temporal features are extracted from the weighted online car-hailing service order data in different historical time steps through a long short-term memory network;
[0009] Spatial features are extracted from the observed data through multi-graph convolution;
[0010] Predicted values of online car-hailing service order data in different regions at different future time steps are obtained through a fully connected layer according to the temporal features and spatial features.
[0011] In a second aspect, a prediction device for online car-hailing demand is provided in the present invention, including:
[0012] A first extraction module, configured to perform feature extraction on observation data through graph convolution and variational autoencoder respectively, where the observation data includes online car-hailing order data in different regions at different historical time steps;
[0013] A feature weighting module, configured to perform max pooling operation on the observation data, features extracted by graph convolution and variational autoencoder to obtain a global feature vector, and process the global feature vector by an attention mechanism block to obtain observation weights, where the observation weights include weights of online car-hailing order data at different historical time steps, and weight the online car-hailing order data at different historical time steps according to the observation weights;
[0014] A second extraction module, configured to extract time features from the weighted online car-hailing order data at different historical time steps through a long short-term memory network;
[0015] A third extraction module, configured to extract spatial features from the observation data through multi-graph convolution;
[0016] A demand prediction module, configured to obtain predicted values of online car-hailing order data in different regions at different future time steps through a fully connected layer according to the time features and spatial features.
[0017] In a third aspect, an electronic device is provided in the present invention, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the online car-hailing demand prediction method described in the first aspect.
[0018] In a fourth aspect, a computer-readable storage medium is provided in the present invention, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the online car-hailing demand prediction method described in the first aspect are implemented.
[0019] Compared with the related art, in the time-dependent modeling stage of the present invention, a variational autoencoder is introduced, which can better capture time-dependent relationships, and in the spatial-dependent modeling stage, neighborhood graph features, functional similarity graph features and regional influence graph features are used to better capture spatial-dependent relationships. At the same time, the stability and accuracy of network prediction are ensured by online real-time fine-tuning of the network. In summary, the online car-hailing demand prediction method provided in this embodiment has high prediction accuracy and stability, and solves the problem of low demand prediction accuracy of the current online car-hailing demand prediction method.
[0020] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more concise and understandable. Brief Description of the Drawings
[0021] Figure 1 is a flowchart of the online car-hailing demand prediction method provided in this embodiment;
[0022] Figure 2 is an architecture diagram of the time feature extraction network provided in this embodiment;
[0023] Figure 3 is the MSE change curve after online real-time fine-tuning of different network models in this embodiment;
[0024] Figure 4 is the RMSE change curve after online real-time fine-tuning of different network models in this embodiment;
[0025] Figure 5 is the MAE change curve after online real-time fine-tuning of different network models in this embodiment. Detailed Description of the Embodiment
[0026] For a clearer understanding of the purpose, technical solution and advantages of this application, the following describes and explains this application in conjunction with the drawings and embodiments.
[0027] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by those with ordinary skills in the technical field to which this application belongs. In this application, words such as "a", "one", "a kind of", "the", "these" and the like do not indicate a limitation in quantity, and they can be singular or plural. The terms "including", "comprising", "having" and any variants thereof involved in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device including a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent in these processes, methods, products or devices. The terms "connected", "coupled" and the like involved in this application do not limit to physical or mechanical connections, but may include electrical connections, whether directly or indirectly connected. The term "plurality" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, and B exists alone. Usually, the character " / " indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application only distinguish similar objects and do not represent a specific sorting for the objects.
[0028] The following specifically describes the online car-hailing demand prediction method provided by the present invention through an embodiment.
[0029] In this embodiment, an online car-hailing demand prediction method is provided. Figure 1 It is a flowchart of the online car-hailing demand prediction method provided in this embodiment. As Figure 1 shown, this process at least includes steps S110, S120, S130, S140, and S150, and may also include step S160.
[0030] The online car-hailing demand prediction method in this embodiment performs demand prediction through a demand prediction network based on deep learning. The online car-hailing demand specifically refers to the number of online car-hailing orders.
[0031] Among them, the demand prediction network is a spatio-temporal multi-graph convolutional-long short-term memory network (ST-MGCLSTM), which mainly includes a context gated long short-term memory network (CG-LSTM) and multi-graph convolution. The context gated long short-term memory network is a time feature extraction network, and multi-graph convolution is a spatial feature extraction network. The demand prediction network is the observed data, and the observed data includes historical data in different regions. The historical data includes online car-hailing order data at different historical moments. The context gated long short-term memory network is used to extract the time features in the input data to model the time-dependent relationship, ensuring the ability of the demand prediction network to capture the time-dependent relationship. The time-dependent relationship is the correlation between the online car-hailing order data at different moments; multi-graph convolution is used to extract the spatial features in the input data to model the spatial-dependent relationship, ensuring the ability of the demand prediction network to capture the spatial-dependent relationship. The spatial-dependent relationship is the correlation between the online car-hailing order data in different regions. The context gated long short-term memory network includes modules such as graph convolution, variational autoencoder, attention mechanism block, context gating, and long short-term memory network.
[0032] Specifically, the online car-hailing demand prediction network can be expressed as G=(V, E, A). Using G to represent a spatial network, the predicted area is divided into grids of equal size, and each small grid is defined as a region v. V represents the set of all non-overlapping regions, |V| = N, where N is the number of regions. E is the set of edges, and A is the adjacency matrix. Each element represents the relationship between two regions. The spatial network G represents the relationship between nodes in the spatial dimension.
[0033] Description of the online car-hailing demand prediction problem: In this embodiment, the goal is to predict the online car-hailing demand in different regions within a short time interval. The online car-hailing demand prediction can be formulated as a function mapping:
[0034]
[0035] Map the historical demands of all regions to the demands at future time steps. Graph signal matrix C is the dimension of the feature, and t represents the time step. represents the observation value of the spatial network G at time step t. The online car-hailing demand prediction problem can be described as: learning a mapping function f that maps the historical spatio-temporal network sequence to the current spatio-temporal network sequence where T represents the length of the historical spatio-temporal network sequence, and T’ represents the length of the target spatio-temporal network sequence to be predicted.
[0036] Step S110, perform feature extraction on the observation data through graph convolution and variational autoencoder respectively. The observation data includes the online car-hailing order data of different regions at different historical time steps. The online car-hailing order data includes the order quantity and the order content, and the order content includes the starting point and the ending point.
[0037] Step S120, perform max-pooling operation on the features extracted from the observation data, graph convolution and variational autoencoder to obtain the global feature vector, and use the attention mechanism block to process the global feature vector to obtain the observation weights. The observation weights include the weights of the online car-hailing order data at different historical time steps, and weight the online car-hailing order data at different historical time steps according to the observation weights. The weighting process is achieved through context gating.
[0038] Specifically, assuming there are T time steps, then X (t) ∈R |V|×C represents the observation data at the t-th time step, V represents the set of regions, C represents the feature dimension. Since the feature is the number of online car-hailing orders, so C = 1. The context gating mechanism generates a region description by connecting the historical data of a specific region with the information of related regions. The context gating mechanism adjusts the internal state of the model according to the data at the current time step and other relevant information, so as to better understand the entire time series data. This mechanism helps the model better capture the patterns and correlations in the data, thereby improving the performance and expressiveness of the model.
[0039] The specific process of CG-LSTM is as follows: perform max-pooling processing on the observation data, the latent features extracted by VAE (variational autoencoder), and the features extracted by graph convolution (GCN). The introduction of VAE not only helps to reduce the data dimension, but also can remove noise and extract more representative latent features Z, thus providing a more accurate and information-rich regional representation. In addition, max-pooling combines the topological information of the data and aggregates the observation data from different sources, so that each observation point contains the original observation data, the features extracted by VAE, and the features output by GCN, forming the final global feature vector.
[0040] Among them, the variational autoencoder is used to learn the latent feature Z of the observed data X, and its learning function is as follows:
[0041] F VAE = E qf(Z∣X) [log pq(X|Z)] - D KL (qf(Z|X) ‖ p(Z))
[0042] E q(z∣x) [log p(X|Z)] is the reconstruction error, representing the accuracy of reconstructing X through Z, and D KL (qf(Z|X) ‖ p(Z)) is the Kullback-Leibler (KL) divergence, representing the degree of closeness between qφ(Z|X) and the prior distribution p(Z).
[0043] The latent feature Z generated by the VAE follows a Gaussian distribution:
[0044] Z ~ N(μ, s 2 )
[0045] Among them, μ and σ are the mean and variance respectively, usually obtained through neural network parameterized learning. Finally, the expression form of the region description is as follows:
[0046]
[0047] Among them, X (t) is the original observed data at time step t, is the feature extracted by graph convolution at time step t, and F VAE (X (t) ) is the feature Z extracted by the VAE at time step t.
[0048] After the region description extraction is completed, the model needs to further normalize and weight it to highlight the key features. First, the max pooling operation is used to aggregate the region description of each time step into a global feature vector z:
[0049]
[0050] z (t) represents the global feature vector z at time step t.
[0051] Then the attention mechanism block is used to calculate the observation weight s, and the expression of the attention mechanism block is as follows:
[0052] s (t) = s(W 2 d(W 1 z (t) ))
[0053] Among them, W 1 and W 2 represent the first weight and the second weight respectively, δ and σ represent the ReLU and sigmoid activation functions respectively, and z (t) represents the global feature vector at time step t, and s (t) represents the observation weight at time step t.
[0054] These observation weights are used to adjust the importance of each historical time step. This means that the demand forecasting network will assign different weights to regional descriptions according to their importance at different historical time steps.
[0055] The observation weight s is used to adjust the importance of observations at different time steps. Finally, the demand forecasting network uses s to weight the observation data X:
[0056]
[0057] is the weighted observation data at time step t. This step is equivalent to weighting the importance of online car-hailing order data for each time step, so that more important online car-hailing order data will have a greater weight in subsequent modeling.
[0058] Step S130, extract temporal features from the weighted online car-hailing order data at different historical time steps through a long short-term memory network (LSTM). To better capture the temporal correlation between regions, in this embodiment, temporal features are extracted from the online car-hailing order data of different regions through the same long short-term memory network to capture the temporal correlation between the online car-hailing order data of different regions, that is, a shared LSTM network is used for temporal modeling.
[0059] Specifically, the online car-hailing order data of all regions share an LSTM structure, which can learn long-term dependence information and extract temporal patterns. For each region i, the LSTM calculation formula is as follows:
[0060]
[0061] Among them, H i is the hidden vector extracted from the online car-hailing order data of the i-th region, and W 3 is a shared parameter.
[0062] Through the shared LSTM structure, the corresponding hidden vectors of each region can be obtained. The hidden vector of each region is obtained by aggregating the online car-hailing order data of different historical time steps in this region through LSTM.
[0063] The advantage of the shared LSTM structure is that it can adopt the same aggregation rule for all regions, thereby enhancing the generalization ability of the model while reducing the computational complexity and making the model consistent among different regions.
[0064] Therefore, in this embodiment, first, graph convolution and variational autoencoder are used to extract features from the observed data, and the extracted features are integrated and an attention mechanism block is adopted to obtain the observation weights to weight the online car-hailing order data at different historical time steps in the observed data. Finally, a shared long short-term memory network is used to aggregate the online car-hailing order data at different historical time steps in each region, thereby providing an efficient time correlation modeling framework and effectively enhancing the representation ability for complex spatio-temporal data.
[0065] Step S140, extract spatial features from the observed data through multi-graph convolution.
[0066] Multi-graph convolution can extract different types of graph features from the observed data, and the output of multi-graph convolution is composed of the fusion of multiple graph features. In this embodiment, the multiple graph features include neighborhood graph features, functional similarity graph features, and regional influence graph features. The neighborhood graph features include the adjacent relationships between different regions, the functional similarity graph features include the functional similarities between different regions, and the regional influence graph features include the influences between different regions. Among them, the influence between different regions is determined according to the geographical distance and demand difference between different regions.
[0067] The following specifically describes the three types of graphs.
[0068] Neighborhood graph G N =(V, A N ): Used to depict the spatial proximity relationship between regions, encode the geographical proximity, and thus reflect the interactive influence between adjacent regions. Functional similarity graph G F =(V, A F ): Based on the distribution of points of interest (POIs) within the region, measure the functional similarity between different regions to enhance the model's understanding of the potential functional relationships between regions. Regional influence graph G R =(V, A R ): Highlight the dual roles of geographical distance and demand intensity. Compared with the traditional regional influence graph that only considers a single factor, this regional influence graph realizes the accurate measurement of the multi-dimensional influence between regions by combining geographical distance and demand intensity difference. It can flexibly adapt to different application scenarios and balance the roles of demand difference and geographical distance by adjusting α.
[0069] For the neighborhood graph: The adjacency relationship between regions is defined by spatial proximity, mainly used to capture the interaction patterns between geographically adjacent regions. In this graph, each region is regarded as a node, and the connection relationship between regions is determined according to their physical spatial proximity. In this embodiment, a 3×3 neighborhood grid structure is adopted to construct the connections between regions, and each region v i will establish connections with the 8 directly adjacent regions, thus forming a nine-grid adjacency structure. This way ensures that the geographical relationships between regions can be fully modeled, facilitating the capture of the spread of spatial influence. The expression formula for the adjacency relationship between different regions is:
[0070]
[0071] where, v i and v j represent the i-th region and the j-th region respectively, A N,ij represents the adjacency relationship between the i-th region and the j-th region. If regions v i and v j are directly adjacent in the grid structure (including horizontal and vertical directions), then A N,ij = 1, otherwise it is 0.
[0072] For the functional similarity graph: In the urban environment, different regions exhibit different spatial attributes due to differences in their functions and land use patterns. For example, commercial areas are mainly composed of shopping centers and office buildings, while residential areas are mainly composed of residential buildings. Regions with similar functions often show similar travel demand patterns. For example, during the morning rush hour, commuters usually travel from residential areas to commercial areas, so the demand for online car-hailing in residential areas is relatively high; on the contrary, during the evening rush hour, the return demand leads to an increase in the departure volume in commercial areas and an increase in the arrival volume in residential areas. In order to quantify the functional similarity between different regions, in this embodiment, the points of interest (POIs) within each region are counted, and their distribution and quantity characteristics of different categories are calculated. In this embodiment, the cosine similarity is used to measure the functional similarity between two regions, and its calculation formula is as follows:
[0073] A F,ij = sim(P i , P j ) ∈ [0, 1]
[0074] where, A F,ij represents the functional similarity between the i-th region and the j-th region, sim represents the cosine similarity function, P i and P jThey respectively represent the POI vectors of the $i$-th region and the $j$-th region, whose dimension is equal to the number of POI categories. Each item represents the number of a specific POI category in the region. The value range of cosine similarity is between [0, 1]. 1 means that the functions of the two regions are exactly the same, and 0 means they are completely different.
[0075] For the regional influence map: The regional influence map comprehensively considers two key factors, geographical distance and demand intensity. Compared with the traditional methods that only focus on a single variable, this model realizes the multi-dimensional accurate measurement of the influence between regions by introducing the combination of the two. Its core idea is to calculate the mutual influence according to the spatial distance and travel demand difference between regions, and at the same time introduce a regulation factor $\alpha$ to balance their relative effects so that it can adapt to different application scenarios. Specifically, the core of the regional influence map lies in calculating the geographical distance and demand difference between regions and assigning weights to the influence between each pair of regions. The expression formula for the influence between different regions is:
[0076]
[0077] where, $v$ i and $v$ j respectively represent the $i$-th region and the $j$-th region, $A$ N,ij represents the adjacency relationship between the $i$-th region and the $j$-th region, $A$ F,ij represents the functional similarity between the $i$-th region and the $j$-th region, $\text{sim}$ represents the cosine similarity function, $P$ i and $P$ j respectively represent the POI vectors of the $i$-th region and the $j$-th region, $A$ I,ij represents the influence between the $i$-th region and the $j$-th region, $d(v$ i , $v$ j ) represents the geographical distance between the $i$-th region and the $j$-th region, $q(v$ i , $v$ j ) represents the number of online car-hailing orders from the $i$-th region to the $j$-th region, $q(v$ i , $J)$ represents the number of online car-hailing orders from the $i$-th region to other regions, $|J|$ represents the total number of other regions, and $\alpha$ represents the regulation factor. In this embodiment, the value of $\alpha$ is determined by the method of grid search (GridSearch). Generally speaking, $\alpha\in\{0.1, 0.5, 1, 1.5, 2\}$.
[0078] By constructing the above different types of graphs (determining the graph expressions), multi-graph convolution can extract different types of graph features, and aggregate different types of graph features to obtain spatial features. The formula for spatial dependence modeling of multi-graph convolution in this embodiment is:
[0079]
[0080] Among them, and are the feature vectors of each region in the l-th and (l + 1)-th layers of multi-graph convolution. Each region has a feature vector with a dimension of P l or P l+1 in the l-th or (l + 1)-th layer, where |V| is the number of regions. σ represents the activation function, introducing non-linearity into the model. U is an aggregation function, such as summation, taking the maximum value, or calculating the average value, etc., for combining the relevant information of adjacent regions. A represents a set of graphs, that is, A N,ij , A F,ij and A I,ij 's set, and A represents a kind of graph, that is, A N,ij , A F,ij and A I,ij among them. f(A; q i ) represents the aggregation matrix of different samples based on graph A and parameter q i . This matrix aggregates information from neighboring regions according to the specific graph A and its parameter q i . This equation describes how to transform the feature X i in one layer into the feature X l in the next layer through graph-specific aggregation f(A; q l ) and feature transformation W l+1 . According to the selection of the aggregation function and the aggregation matrix, in this embodiment, ChebNet or a fully connected network is used to implement the aggregation. By flexibly selecting the aggregation method and parameters, effective information transmission and learning can be carried out on graph-structured data.
[0081] Step S150, obtain the predicted values of the network car order data in different regions at different future moments according to the time feature and the space feature. In this step, the time feature and the space feature can be fused through a fully connected layer and the prediction result can be given.
[0082] As described above, the network car demand prediction method in this embodiment has been relatively completely described. Among them, a demand prediction network based on deep learning is mainly used for demand prediction. Correspondingly, the demand prediction network needs to be pre-trained, and its prediction effect is related to the sample data used during training. By training with the historical data in the regular period, the high prediction accuracy of the network in the regular period can be guaranteed. However, there are certain differences between the network car demand rules in some special periods (such as Spring Festival, morning and evening rush hours) and the network car prediction demand rules in the regular time, so the prediction accuracy of the network car demand in special periods is relatively low, and the sample data in special periods is relatively small, so it is difficult to overcome this problem through pre-training.
[0083] Correspondingly, in this embodiment, online real-time fine-tuning of the demand prediction network is performed, that is, model training and model prediction are carried out synchronously. That is, the online car-hailing demand prediction method further includes step S160.
[0084] Step S160: According to the predicted values and true values of the online car-hailing order data in different regions at different future time steps, joint optimization is performed on the graph convolution, variational autoencoder, attention mechanism block, long short-term memory network, and multi-graph convolution. The graph convolution, variational autoencoder, attention mechanism block, long short-term memory network, and multi-graph convolution constitute the demand prediction network of the online car-hailing.
[0085] In this step, an update period can be set. That is, every other update period, the true value of the online car-hailing demand in the latest update period is obtained and added to the demand prediction network, and the demand prediction network will adjust the parameters in real time according to the true value of the online car-hailing demand and the corresponding predicted value. For example, the update period can be designed to be half an hour. Assuming that the current time is 8 o'clock, the demand for online car-hailing after 8 o'clock can be predicted based on historical data. When it reaches 8:30, the true value of the demand from 8 o'clock to 8:30 can be given to the demand prediction network, and the demand prediction network will calculate the prediction loss during this period and update the parameters.
[0086] During the fine-tuning process, the optimizer adjusts the parameters based on mini-batch data and monitors the error changes (including MSE) to ensure that the demand prediction network maintains a high prediction accuracy in a constantly changing data environment. Finally, the prediction results, actual values, and error data before and after fine-tuning are all stored, and the improvement of the model performance is analyzed through error comparison. By gradually updating the data and dynamically adjusting the model, this method effectively reduces the error and improves the prediction accuracy, enabling the demand prediction network to maintain stability and adaptability in long-term prediction. At the same time, adopting the above steps during special periods can enable the demand prediction network to improve the prediction accuracy of special periods in real time.
[0087] To verify the effectiveness of the online car-hailing demand prediction method in this embodiment, it is illustrated below through some experimental data.
[0088] 1. Data source.
[0089] In this embodiment, experiments will be conducted on a large-scale real-world dataset in a square area of 100 square kilometers centered around Hefei Station. The duration of this dataset is from December 1st to December 28th, 2023. For data splitting, data from December 1st to December 6th, 2023 is used for training, data from December 7th to December 8th, 2023 is used for validation, and data from December 9th to December 10th, 2012 is used for testing. In this dataset, online car-hailing orders are set to be cut every 30 minutes and Z-Score normalization is applied. 60% of the data is used for training, 20% for testing, and the remaining 20% for validation. For the special period data, data from 10 days before the Spring Festival, from January 30th to February 8th, is used, with a time interval of 30 minutes, and 48 samples can be obtained every day. The POI data was collected in 2023 and contains 14 main POI categories. Each area is associated with a POI vector, and its entries are the number of instances of a certain POI category. The data for the distance between the central points of the areas is provided by OpenStreetMap.
[0090] The task is R |V|×T →R |V| (Mapping multiple time observations to one time observation), in the experiment, a square area of 10 km * 10 km near Hefei Station is divided into small square grids of 1 km * 1 km to generate a set of regions V, and there are a total of 100 small square regions v.
[0091] 2. Experimental settings.
[0092] (1) Evaluation metrics: To evaluate the model performance, commonly used error metrics are adopted, namely MSE (Mean Squared Error), Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE), which are defined by the following equations respectively:
[0093]
[0094]
[0095] Among them, n represents the number of samples in the experiment, X i is the actual value, is the predicted value (the normal predicted value without normalization). A smaller value among the three metrics corresponds to better model prediction performance. The smaller the values of these three error metrics (MSE, RMSE, and MAE), the better the model performance. The time step is set to 30 minutes.
[0096] (2) Parameter settings for conventional training:
[0097] In this embodiment, the demand prediction network does not set auxiliary data, and the input of the demand prediction network is only the online car-hailing order demand at the corresponding time step. In multi-graph convolution, the spatial dependence modeling formula is selected as the Chebyshev polynomial function of the graph Laplacian in ChebNet, and the time complexity is O(n). The aggregation function U is selected as the summation function. The graph convolution degree is set to 1, the number of LSTM hidden layers is set to 1, and each hidden unit is 64. This embodiment also applies L2 regularization, and the weight decay of each layer is equal to 1e-4. This demand prediction network is implemented using the TensorFlow framework, and the running environment is the Windows 10 operating system and the GeForce RTX 2060 graphics card. A comparative experiment with other baseline models was conducted in this environment. All baseline models are implemented or imported by combining existing libraries in the Python language. To improve the accuracy of the demand prediction network, all data in the online car-hailing dataset has been normalized by Z-score before being input into the demand prediction network.
[0098] Before inputting into the demand prediction network, the data in the online car-hailing dataset is normalized by the Z-score method to improve the accuracy of the model. To further optimize the performance of the demand prediction network, parameter and hyperparameter tuning are carried out, and the Adam optimization algorithm is selected for training. The input and output time steps of the demand prediction network are both set to 6, the dimensions of the input and output are both 100, the learning rate is 0.001, the decay rate is set to 0.2, and the number of networks is 100. During the training process, the training set is used to train the demand prediction network, and the validation set is used to determine the best hyperparameter configuration.
[0099] Other baseline models include:
[0100] Historical Average (HA): It uses the online car-hailing demand in the corresponding historical period to predict the demand.
[0101] Long Short-Term Memory Network (LSTM): It contains an input gate, a forget gate, and an output gate, and is used to solve time series prediction problems. The learning rate of this model is set to 0.001, Adam is used as the optimization algorithm, and the number of networks is set to 200.
[0102] Graph Convolutional Network (GCN): A graph convolution method based on semi-supervised classification of spectral graph convolution, which combines supervised learning (label data) and unsupervised information of the graph structure (adjacency matrix).
[0103] Spatio-Temporal Residual Network (ST-ResNet): ST-ResNet is a CNN-based traffic flow prediction framework. This model uses CNN with residual connections to capture trend, periodicity, and proximity information.
[0104] Spatio-Temporal Multi-Graph Convolutional Network (ST-MGCN): Context Gated Recurrent Neural Network (CGRNN) is used for time-related modeling in terms of time. In terms of space, domain graph, functional similarity graph, and road connection graph are used.
[0105] Attention-based Spatio-Temporal Graph Convolutional Network ASTGCN: This model combines spatio-temporal graph convolutional network and attention mechanism for traffic prediction to achieve dual capture of spatio-temporal features of traffic data. The batch size of this model is set to 64, K = 2 is set, and the learning rate is 0.0001. In the training stage, the batch size is 64.
[0106] (3) Parameter settings for real-time fine-tuning: When fine-tuning, the time step TIME_STEPS = 6; the batch size BATCH_SIZE = 1. After multiple experiments, the number of fine-tuning times is set to 50, and the initial learning rate is set to 0.0015.
[0107] Table 1 Comparison table of demand prediction errors of different time feature extraction networks for regular periods
[0108] Model MSE (Mean Squared Error) RMSE (Root Mean Squared Error) MAE (Mean Absolute Error) Transformer 36.81 5.97 3.81 GraphConv (GCN) 33.49 5.82 3.57 ST-ResNet 32.49 5.82 4.19 LSTM 31.33 5.60 3.94 ST-MGCN 26.45 5.33 3.25 ASTGCN 28.56 5.60 3.87 ST-MGCLSTM 20.69 4.55 2.81
[0109] As can be observed from Table 1, there are significant differences in the error performance of various network models in the prediction of online car-hailing demand, mainly reflected in the three core indicators of MSE, RMSE, and MAE, which reflect their different abilities in spatio-temporal feature modeling. Overall, ST-MGCLSTM achieved the best prediction effect, with the lowest MSE (20.69), and at the same time, RMSE and MAE were also at the minimum values, indicating that this model performed excellently in time series modeling and used VAE for denoising, thus improving the adaptability to sudden demand fluctuations. As the sub-optimal model, ST-MGCN was close to ST-MGCLSTM in terms of RMSE and MAE, but the MSE was relatively high (26.45), which shows that this model effectively modeled the spatial dependence between regions through the Graph Convolutional Network (GCN). However, due to the lack of an outlier handling mechanism, the prediction accuracy decreased slightly when facing extreme demand changes. In contrast, LSTM only used time series modeling, and its MSE reached 31.33, indicating that ignoring spatial factors would have a certain impact on the overall prediction effect. ST-ResNet relied on CNN for local feature extraction but had limited ability in modeling long-term dependencies, so the MSE was as high as 32.49 and the overall error was relatively large. Transformer performed relatively well in terms of MAE, only 3.81, which means it was relatively accurate in predicting most regular demands. However, both MSE (36.81) and RMSE (5.97) were the highest, indicating that there were large errors in predicting short-term demand fluctuations, probably because its self-attention mechanism focused on capturing global information, resulting in insufficient short-term trend modeling ability. Although GraphConvolution (GCN) could model the spatial interaction relationship between regions well, due to the lack of time series modeling ability, the MSE was still relatively high (33.49), indicating that pure spatial modeling could not effectively replace spatio-temporal joint modeling. In addition, as a spatio-temporal graph neural network, ASTGCN showed a certain balance in terms of RMSE and MAE, but the overall effect was still lower than that of ST-MGCLSTM and ST-MGCN. Generally speaking, the prediction of online car-hailing demand requires effective integration of time and space information. Relying solely on a single feature (time or space) will affect the prediction accuracy. ST-MGCLSTM modeled time through LSTM, extracted spatial features through GCN, and combined VAE for denoising, showing the best performance in complex spatio-temporal dependence modeling and outlier handling.
[0110] Table 2 Comparison table of demand prediction errors of different spatial feature extraction networks for regular periods
[0111] Model MSE RMSE MAE N 22.18 5.00 2.95 FS 22.00 4.99 2.99 RI 21.99 4.88 2.91 N + FS 21.55 4.77 2.95 N + RI 21.98 4.65 2.89 FS + RI 20.91 4.61 2.88 N + FS + RI 20.69 4.55 2.81
[0112] First, analyze the results of modeling using only the neighborhood graph (N). In this case, the MSE of the model is 22.18, the RMSE is 5.00, and the MAE is 2.95, indicating that the prediction accuracy of the model using only neighborhood information is relatively low. Neighborhood information mainly describes the spatial dependence between regions, but it fails to fully capture complex spatio-temporal relationships. Therefore, relying on neighborhood information for prediction is restricted by local spatial features, resulting in relatively large errors. Especially in scenarios with complex demand fluctuations, the performance of the model is mediocre.
[0113] Second, combine the neighborhood graph (N) with the functional similarity graph (FS) to construct a combined model of N+FS. The experimental results show that after adding functional similarity, the RMSE decreases from 5.00 to 4.77, indicating that functional similarity can optimize local features and make the model perform better when dealing with regions with similar demand patterns. Functional similarity enables the model to better identify regions with similar demand changes and improves the prediction accuracy of the model by optimizing the feature representation between regions. However, the MSE increases to 21.55 in this combination, which may be due to the differences in demand changes in some functionally similar regions, resulting in a negative impact of these differences on the overall error.
[0114] Furthermore, introduce the regional influence graph (RI) into the model to construct the N+RI combination. The experimental results show that after adding regional influence, the MSE decreases to 20.91, the RMSE decreases to 4.65, and the MAE decreases to 2.89. The addition of regional influence helps to capture the long-term trend of spatial demand, enabling the model to obtain a more stable prediction effect in the context of spatio-temporal changes. By modeling the long-term trends between regions, the model can identify which regions may be affected by similar factors during the demand change process, thereby improving the overall prediction accuracy. Compared with using only N or the N+FS combination, N+RI performs more excellently in all indicators and can effectively reduce errors.
[0115] Finally, combine the three types of information of the neighborhood graph (N), functional similarity (FS), and regional influence graph (RI) to construct the optimal combined model of N+FS+RI. This model achieves the best performance in terms of MSE, RMSE, and MAE: the MSE decreases to 20.69, the RMSE decreases to 4.55, and the MAE decreases to 2.81, indicating that this combination method can maximize the prediction accuracy of the model. In this combination, the neighborhood graph provides the most basic spatial dependence information, the functional similarity graph strengthens the ability to capture similar demand patterns between regions, and the regional influence graph supplements the long-term trend information of spatial dynamic changes. The combination of these three not only improves the accuracy of the model but also enhances its ability to model complex spatio-temporal relationships, thereby improving the stability and generalization ability of the model.
[0116] In summary, by analyzing different combinations of N, FS, and RI, the combination of N+FS+RI can effectively integrate various spatial relationship information, significantly improving the prediction performance of the model. The neighborhood graph provides the most basic spatial dependence, the functional similarity graph further enhances the model's ability to capture similar demand patterns, and the regional influence graph supplements the long-term trend of spatial dynamic changes. The comprehensive utilization of these three features not only reduces errors but also improves the accuracy and robustness of the model, enabling it to exhibit excellent performance in complex spatio-temporal demand prediction problems.
[0117] Refer to Figure 3 , Figure 4 and Figure 5, for abnormal data (data during special periods), it can be seen from the trend chart after fine-tuning that in the prediction of online car-hailing demand in the 100-square-kilometer area near Hefei Station, from 8 am to 8 pm on January 30, different models after online fine-tuning showed significant differences. The performance of each model during this period is affected by multiple factors, especially the adaptability to demand fluctuations and the modeling ability of spatial and temporal characteristics. The ST-MGCLSTM model combines the time series modeling ability of LSTM (Long Short-Term Memory Network) and the spatial feature modeling ability of GCN (Graph Convolutional Network), and makes dynamic adjustments through online fine-tuning of the model to adapt to changes in demand. Judging from the trend chart, the error fluctuation of ST-MGCLSTM is the smallest, and the overall error curve is very stable and lower than other models. This characteristic indicates that ST-MGCLSTM can quickly adapt to changes in demand, especially by optimizing parameters to improve prediction accuracy in a short period of time. This is crucial for the prediction of online car-hailing demand because demand changes are usually instantaneous and drastic, especially during traffic peaks or special events. It can be found through the overall average error table that ST-MGCLSTM is at the lowest level in all three indicators of MSE (Mean Squared Error), RMSE (Root Mean Squared Error), and MAE (Mean Absolute Error), showing relatively prominent superiority. Especially in the MSE indicator, ST-MGCLSTM performs particularly well, which indicates that ST-MGCLSTM can effectively capture the dynamic correlations between regions. Especially in the case of drastic demand fluctuations, it can maintain high prediction accuracy and stability through refined adjustments. Compared with other models, the performance of ST-MGCLSTM always remains leading, which is mainly due to its combination of time series and spatial feature modeling abilities, enabling effective capture of complex spatio-temporal dependencies. In contrast, due to the lack of a strong spatial feature modeling ability, the ST-ResNet model performs significantly worse than ST-MGCLSTM when facing complex demand changes. It can be seen from the trend chart that the error fluctuation of ST-ResNet is relatively large. Especially during the demand peak period, the volatility and amplitude of the error are relatively drastic, and the adaptability is the worst. This indicates that ST-ResNet cannot make effective adjustments in a timely manner when facing complex demand fluctuations, resulting in a large error in the prediction results. Especially during high-demand periods, the prediction error of ST-ResNet is significantly higher than that of other models, affecting the overall prediction accuracy. The deficiency of ST-ResNet is mainly reflected in its failure to fully consider the spatial dependence relationship between regions, resulting in its prediction results being unable to accurately capture the dynamic changes between the demands of different regions. The LSTM and Transformer models show good stability in time series modeling and can relatively accurately capture the trend of demand changes, but their short-term adaptability is still weaker than that of ST-MGCLSTM.In the face of periods of more drastic demand fluctuations, the prediction results of LSTM and Transformer are relatively stable, but they fail to adapt to these changes quickly, resulting in slightly inferior performance in short-term predictions. In contrast, ST-MGCLSTM can better cope with these changes through dynamic adjustment, further improving the prediction accuracy. GCN's performance in spatial modeling is relatively general and is suitable for scenarios with relatively stable demand. However, in terms of temporal feature modeling capabilities, GCN still needs to be optimized, especially in periods of large demand fluctuations, the prediction effect of GCN is relatively poor. The shortcoming of GCN is that it only focuses on spatial relationships and ignores the dynamic changes of time series, so it cannot effectively respond to rapid changes in demand during prediction. However, due to the high model complexity, the fine-tuning effect of ASTGCN is not as good as that of lighter models. In some peak demand periods, the error is large, resulting in poor model adaptability. Although ASTGCN can show good performance in some complex scenarios, its high computational complexity and limitations of model fine-tuning make it unable to adapt as quickly as other models when facing rapidly changing demand. This makes ASTGCN have large prediction errors in some peak demand periods and poor fine-tuning effects compared with other lightweight models. Therefore, the ST-MGCLSTM model, with its excellent spatial and temporal feature modeling capabilities, demonstrates strong adaptability and stability, and is able to quickly adapt through online fine-tuning and maintain high prediction accuracy in the case of large demand fluctuations, while other models, although they perform well in some scenarios, have poor adaptability in dealing with demand changes, especially in the case of large demand fluctuations, and cannot be optimized as quickly as ST-MGCLSTM.
[0118] The above experimental data illustrate the effectiveness of the online car-hailing demand forecasting method provided in this embodiment. Specifically, in the time-dependency modeling stage, a variational autoencoder is introduced to better capture the time dependency relationship, and in the spatial dependency modeling stage, neighborhood graph features, functional similarity graph features, and regional influence graph features are used to better capture the spatial dependency relationship, while the stability and accuracy of the network prediction are guaranteed by online real-time fine-tuning of the network. In summary, the online car-hailing demand forecasting method provided in this embodiment has high prediction accuracy and stability, which solves the problem of low demand prediction accuracy of the current online car-hailing demand forecasting method.
[0119] In this embodiment, a device for predicting the demand for online car-hailing is also provided, which is used to implement the method for predicting the demand for online car-hailing in this embodiment, and will not be repeated hereafter. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for predetermined functions. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0120] The online car-hailing demand prediction device includes:
[0121] A first extraction module, configured to extract features from the observation data respectively through graph convolution and variational autoencoder, where the observation data includes online car-hailing order data of different regions at different historical time steps;
[0122] A feature weighting module, configured to perform max pooling operation on the observation data, the features extracted by graph convolution and variational autoencoder to obtain a global feature vector, and use an attention mechanism block to process the global feature vector to obtain observation weights, where the observation weights include the weights of online car-hailing order data at different historical time steps, and weight the online car-hailing order data at different historical time steps according to the observation weights;
[0123] A second extraction module, configured to extract time features from the weighted online car-hailing order data at different historical time steps through a long short-term memory network;
[0124] A third extraction module, configured to extract spatial features from the observation data through multi-graph convolution;
[0125] A demand prediction module, configured to obtain prediction values of online car-hailing order data of different regions at different future time steps through a fully connected layer according to the time features and spatial features.
[0126] It should be noted that the above-mentioned each module can be a functional module or a program module, and can be implemented either by software or by hardware. For the modules implemented by hardware, the above-mentioned each module can be located in the same processor; or the above-mentioned each module can also be located in different processors in any combination form.
[0127] In this embodiment, an electronic device is further provided, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the online car-hailing demand prediction method in this embodiment.
[0128] In this embodiment, a computer-readable storage medium is further provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the online car-hailing demand prediction method in this embodiment are implemented.
[0129] It should be understood that the specific embodiments described here are only used to explain this application, rather than to limit it. According to the embodiments provided in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of this application.
[0130] Obviously, the accompanying drawings are only some examples or embodiments of the present application. For those of ordinary skill in the art, the present application can also be applied to other similar situations based on these drawings without creative efforts. Additionally, it can be understood that although the work done during this development process may be complex and time-consuming, for those of ordinary skill in the art, certain design, manufacturing, or production changes based on the technical content disclosed in the present application are only conventional technical means and should not be regarded as insufficient disclosure of the present application.
Claims
1. A method for predicting demand for online car-hailing, characterized in that: include: The observed data includes online ride-hailing order data from different regions at different historical time steps. Perform the maximum pooling operation on the observed data, graph convolution and features extracted by the variational autoencoder to obtain the global feature vector, and use the attention mechanism block to process the global feature vector to obtain the observation weight. The observation weight includes the weight of the online car-hailing order data at different historical time steps. The online car-hailing order data at different historical time steps are weighted according to the observation weight. The long short-term memory network is used to extract time features from the weighted online ride-hailing order data at different historical time steps; Extract spatial features from observation data through multi-graph convolution; According to the temporal and spatial features, the predicted values of online car order data in different regions at different future time steps are obtained through the fully connected layer.
2. The method for predicting online car-hailing demand according to claim 1, characterized in that: The functional expression of the attention mechanism block is: s (t) =s(W2d(W1z (t) )) Among them, W1 and W2 represent the first weight and the second weight respectively, δ and σ represent the ReLU and sigmoid activation functions respectively, and z (t) represents the global eigenvector at time step t, s (t) represents the observation weight at time step t.
3. The method for predicting online car-hailing demand according to claim 1, characterized in that: The time features extracted from the weighted online car-hailing order data in different regions through the long short-term memory network include: The same long short-term memory network is used to extract time features from the weighted online ride-hailing order data of different regions to capture the temporal correlation between the online ride-hailing order data of different regions.
4. The method for predicting online car-hailing demand according to claim 1, characterized in that: Extracting spatial features from observational data through multi-graph convolution includes: Extract multiple graph features from the observed data through multi-graph convolution and obtain spatial features based on the multiple graph features; Among them, the various graph features include neighborhood graph features, functional similarity graph features and regional influence graph features. The neighborhood graph features include the adjacent relationships between different regions, the functional similarity graph features include the functional similarities between different regions, and the regional influence graph features include the influence between different regions.
5. The method for predicting online car-hailing demand according to claim 4, characterized in that: The influence between different regions is determined by the geographical distance and demand differences between different regions.
6. The method for predicting online car-hailing demand according to claim 5, characterized in that: The expression formula of the adjacent relationship between different regions is: The expression formula of functional similarity between different regions is: THE F,ij =yes(P i ,P j )∈[0,1] The expression formula of influence between different regions is: Among them, v i and v j denote the i-th region and the j-th region respectively, A N,ij represents the adjacent relationship between the i-th region and the j-th region, A F,ij represents the functional similarity between the i-th region and the j-th region, sim represents the cosine similarity function, P i and P j Represent the POI vectors of the i-th area and the j-th area respectively, A I,ij represents the influence between the i-th region and the j-th region, d(v i , v j ) represents the geographical distance between the i-th region and the j-th region, q(v i , v j ) represents the number of online car-hailing orders from the i-th area to the j-th area, q(v i , J) represents the number of online car-hailing orders from the ith area to other areas, |J| represents the total number of other areas, and α represents the adjustment factor.
7. The method for predicting online car-hailing demand according to claim 1, characterized in that: Also includes: According to the predicted and true values of online car order data in different regions at different future time steps, graph convolution, variational autoencoder, attention mechanism block, long short-term memory network and multi-graph convolution are jointly optimized.
8. A device for predicting demand for online car-hailing, characterized in that: include: A first extraction module is used to extract features from the observation data by using graph convolution and variational autoencoder respectively, where the observation data includes online car-hailing order data from different regions at different historical time steps; The feature weighting module is used to perform the maximum pooling operation on the observed data, the features extracted by the graph convolution and the variational autoencoder to obtain the global feature vector, and use the attention mechanism block to process the global feature vector to obtain the observation weight. The observation weight includes the weight of the online car-hailing order data at different historical time steps, and the online car-hailing order data at different historical time steps are weighted according to the observation weight; The second extraction module is used to extract time features from the weighted online car-hailing order data at different historical time steps through a long short-term memory network; The third extraction module is used to extract spatial features from the observation data through multi-graph convolution; The demand forecasting module is used to obtain the predicted values of online car order data in different regions at different future time steps based on time characteristics and spatial characteristics through a fully connected layer.
9. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the online car-hailing demand prediction method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the online car-hailing demand prediction method described in any one of claims 1 to 7 are implemented.