Online car-hailing order volume prediction method based on multi-level neighborhood matrix and sequence model
By using a multi-level neighborhood matrix and sequence model in the online car-hailing order quantity prediction system, the problem of difficulty in using spatial information and neighborhood relationships in the existing system is solved, and the prediction accuracy and model accuracy are significantly improved. It is applicable to The refined needs of online ride-hailing operation and management.
Patent Information
- Application Number
- CN202411370287.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-09-29
AI Technical Summary
The existing online ride-hailing order volume prediction system is difficult to make full use of spatial information and neighborhood relationships, resulting in low prediction accuracy and difficult to meet the needs of refined management.
Using prediction methods based on multi-level neighborhood matrix and sequence model, we trained through geographical hash grid division, representative grid screening, multi-level neighborhood matrix construction and neighborhood feature calculation, using Sequence-to-Sequence model. Forecast the number of online car-hailing orders in the future.
It significantly improves the prediction accuracy and model accuracy, better considers the temporal and spatial correlation and characteristics of online car-hailing demand, conforms to the actual influence laws, and improves the referenceability of online car-hailing operation and management.
Smart Images

Figure CN118886572B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic data prediction, and in particular to a method for predicting the order volume of online car-hailing vehicles based on a multi-level neighborhood matrix and a sequence model. Background Art
[0002] With the increasing development of information technology, shared travel has greatly changed residents' travel habits. The two-sided market of online ride-hailing services relies on the platform to connect drivers and passengers to achieve a rapid balance between supply and demand. However, in popular riding areas and during peak travel periods, passengers still face the dilemma of "difficulty in getting a taxi"; at the same time, there is often an oversupply of online ride-hailing drivers during off-peak travel periods. These mismatches in supply and demand have led to varying degrees of problems in the service capabilities and passenger experience of online ride-hailing services.
[0003] Therefore, in the modern operation and management of online ride-hailing, order demand forecasting is an important task of online ride-hailing operations. Its goal is to predict the order demand in a certain period of time in the future based on the historical and current order data in urban traffic roads. A high-precision order demand forecasting model can not only help online ride-hailing platforms to reasonably allocate and dispatch vehicles and improve vehicle utilization, but also reduce passenger waiting time and improve user travel experience; it also plays an important role in planning public transportation routes and managing the number of transportation vehicles.
[0004] Existing online car-hailing order volume prediction systems usually rely on time series prediction models, such as ARIMA, LSTM, etc. These methods can capture the laws of time series data to a certain extent, but the use of spatial information and neighborhood relationships is very limited. Especially in complex urban environments, the mutual influence between different regions is significant, and existing methods are difficult to fully utilize this spatial information, resulting in low prediction accuracy and difficulty in meeting the needs of refined management. Summary of the invention
[0005] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a method for predicting the order volume of online ride-hailing vehicles based on a multi-level neighborhood matrix and a sequence model.
[0006] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention includes:
[0007] In a first aspect, the present invention provides a method for predicting online car-hailing order volume based on a multi-level neighborhood matrix and a sequence model, which comprises:
[0008] Divide the forecast area into geographic hash grids, and aggregate the online car-hailing order data in each geographic grid in time series based on historical records to obtain order volume data;
[0009] Based on clustering and analysis of the order volume data, selecting a plurality of representative grids;
[0010] Using the plurality of representative grids, a multi-level neighborhood matrix is constructed, wherein the multi-level neighborhood matrix represents the neighbor relationship between any representative grid and other representative grids at multiple levels;
[0011] Calculating neighborhood features using the multi-level neighborhood matrix and the order volume data, wherein the neighborhood features represent a weighted sum of the order volume data of each representative grid and other representative grids having the neighboring relationship calculated based on the multi-level neighborhood matrix;
[0012] Using the order volume data and the neighborhood features in the first period as inputs of a sequence-sequence model, and using the order volume data in the second period as labels, to train the sequence-sequence model, wherein the first period and the second period are continuous in time series and the second period is later in time;
[0013] The real-time sequence data of the current period is input into the trained sequence-sequence model to obtain the prediction results of the online car-hailing order volume in the future period according to the time series distribution.
[0014] In a second aspect, the present invention further provides a system for predicting online car-hailing order volume based on a multi-level neighborhood matrix and a sequence model, which comprises:
[0015] The data acquisition module is used to divide the predicted area into geographic hash grids, and to aggregate the online car-hailing order data in each geographic grid in time series based on historical records to obtain order volume data;
[0016] A representative grid module, used for selecting a plurality of representative grids based on clustering and analysis of the order volume data;
[0017] A neighborhood relationship module, used to construct a multi-level neighborhood matrix using a plurality of the representative grids, wherein the multi-level neighborhood matrix represents the neighbor relationship between any of the representative grids and other representative grids at multiple levels;
[0018] A neighborhood feature module, used to calculate neighborhood features using the multi-level neighborhood matrix and order volume data;
[0019] a model training module, configured to use the order volume data and the neighborhood features in a first period as inputs of a sequence-sequence model, and use the order volume data in a second period as labels to train the sequence-sequence model, wherein the first period and the second period are continuous in time series and the second period is later in time;
[0020] The data prediction module is used to input the real-time sequence data of the current period into the trained sequence-sequence model to obtain the prediction results of the online car-hailing order volume in the future period based on the time series distribution.
[0021] In a third aspect, the present invention further provides a readable storage medium, in which a computer program is stored. When the computer program is executed, the steps of the above-mentioned online car-hailing order volume prediction method are performed.
[0022] Based on the above technical solution, compared with the prior art, the beneficial effects of the present invention at least include:
[0023] The online car-hailing order volume prediction method provided by the present invention utilizes geographic hash grid division and screening of representative grids to train the sequence-sequence model, thereby avoiding the interference of invalid data on the training process and significantly improving the training efficiency and model accuracy. In addition, the present invention also identifies multi-level neighborhood features for the multiple representative grids obtained by screening, and uses the multi-level neighborhood features as input variables in the model training process, and participates in the model training process together with historical order volume data, so that the model training fully considers the influence of neighborhood relationships and conforms to the actual influence law of the distribution of online car-hailing demand. Therefore, the obtained prediction results are closer to the actual situation, the accuracy is guaranteed, and the reference for the operation and management of online car-hailing is stronger.
[0024] The above description is only an overview of the technical solution of the present invention. In order to enable those skilled in the art to more clearly understand the technical means of the present application and implement them according to the contents of the specification, the following is a description of the preferred embodiments of the present invention in conjunction with detailed drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a schematic diagram of the network structure of a sequence-sequence model provided by a typical implementation case of the present invention;
[0026] Figure 2 It is a schematic diagram of the overall process of a method for predicting online car-hailing order volume provided by a typical implementation case of the present invention;
[0027] Figure 3a is an example diagram of a direct neighbor matrix provided by a typical implementation case of the present invention;
[0028] Figure 3b is an example diagram of a secondary neighborhood matrix provided by a typical implementation case of the present invention;
[0029] Figure 3c is an example diagram of a functional neighborhood matrix provided by a typical implementation case of the present invention;
[0030] Figure 4It is a schematic diagram of the LSTM unit structure in a sequence-sequence model provided by a typical implementation case of the present invention;
[0031] Figure 5 It is a prediction performance test chart of the prediction model provided by a typical implementation case of the present invention and multiple control cases. DETAILED DESCRIPTION
[0032] In view of the deficiencies in the prior art, the inventor of this case has proposed the technical solution of the present invention after long-term research and extensive practice. The technical solution, its implementation process and principle will be further explained as follows.
[0033] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0034] Moreover, relational terms such as “first” and “second” are merely used to distinguish one component or method step from another with the same name, but do not necessarily require or imply any such actual relationship or order between these components or method steps.
[0035] The embodiment of the present invention provides a method for predicting the order volume of online car-hailing vehicles based on a multi-level neighborhood matrix and a sequence model, which includes the following steps:
[0036] Divide the forecast area into geographic hash grids, and aggregate the online car-hailing order data in each geographic grid in time series based on historical records to obtain order volume data;
[0037] Based on clustering and analysis of the order volume data, selecting a plurality of representative grids;
[0038] Using the plurality of representative grids, a multi-level neighborhood matrix is constructed, wherein the multi-level neighborhood matrix represents the neighbor relationship between any representative grid and other representative grids at multiple levels;
[0039] Calculating neighborhood features using the multi-level neighborhood matrix and the order volume data, wherein the neighborhood features represent a weighted sum of the order volume data of each representative grid and other representative grids having the neighboring relationship calculated based on the multi-level neighborhood matrix;
[0040] Using the order volume data and the neighborhood features in the first period as inputs of a sequence-sequence model, and using the order volume data in the second period as labels, to train the sequence-sequence model, wherein the first period and the second period are continuous in time series and the second period is later in time;
[0041] The real-time sequence data of the current period is input into the trained sequence-sequence model to obtain the prediction results of the online car-hailing order volume in the future period according to the time series distribution.
[0042] In the existing technology, the main methods for predicting online ride-hailing order demand include knowledge-driven and data-driven methods. The current research focus is on data mining methods based on a large amount of historical data. Data-driven prediction can also be divided into two categories: traditional (based on statistical analysis, nonlinear theory, traditional machine learning) and deep learning-based methods. Traditional prediction methods are mainly based on statistical and regression analysis of historical data, but cannot fully consider the spatiotemporal characteristics and nonlinear relationships of online ride-hailing demand.
[0043] Therefore, it is necessary to study a new method for online car-hailing demand forecasting to improve the forecasting accuracy and efficiency.
[0044] In some existing technologies, although technical solutions for predicting traffic index using Sequence-to-Sequence model are also involved, such as the Chinese invention patent "Traffic Index Prediction Method and Device Based on Sequence-to-Sequence Learning Model" with publication number CN110619427A, although data prediction in the field of transportation has certain universal laws, directly transferring its technical concept to the field of online car-hailing order volume prediction cannot achieve good application results; the inventors of the present invention found that when a simple Sequence-to-Sequence model is used for online car-hailing order volume prediction, it still faces accuracy problems. This is because the order demand of online car-hailing is different from traffic data such as buses, subway entrances and exits, and parking lot saturation. It has distinct dual hot and cold characteristics of time and space, and the correlation and influence of adjacent spaces are more significant. The results obtained by only using Sequence-to-Sequence model in combination with traditional geographical segmentation method of uniform grid segmentation cannot fully fit the actual changes in the demand for online car-hailing.
[0045] The multi-level neighborhood matrix used in the present invention can fully consider the temporal and spatial correlation and characteristics of the online car-hailing order demand. The sequence-to-sequence model (Sequence-to-Sequence model, the structure of which can be seen in Figure 1 As shown in the figure, it can process variable-length sequences and has high adaptability to indefinite-length sequences. It performs well in the fields of machine translation and dialogue systems. The present invention migrates it to the time series prediction of online car-hailing orders, which is an innovative attempt. Compared with conventional demand forecasting methods, it also shows strong adaptability. It can fully consider the nonlinear relationship of online car-hailing demand, automatically learn complex features from the data, and improve prediction accuracy.
[0046] For the geographic grid processing part, existing studies often do not reasonably classify the online car-hailing travel prediction area. The conventional method adopts uniform grid division or multi-scale spatial division. This division method has the advantages of simplicity, convenience, and strong portability. However, in the process of online car-hailing order demand prediction, due to the phenomenon of spatial hot spots and cold spots, the online car-hailing demand is unevenly distributed in various regions. The use of this type of grid division method is likely to lead to large differences in demand in various regions, causing the problem of reduced prediction accuracy. The present invention has made certain improvements to the characteristics of the grid, and can mine the spatiotemporal correlation of grid areas of the same category, thereby improving the accuracy of demand prediction. At the same time, the scheme proposed by the present invention fully considers the adjacent relationship of the selected grid, and uses the adjacent relationship as an input feature for model training. The calculation of neighborhood features can be achieved by combining the neighborhood matrix and order volume data, so as to better capture the spatial relationship between different grid areas and their impact on order volume. Specifically, introducing order volume data into the calculation of neighborhood features can help the model understand the dependencies between various regions, and how the order volume of a certain grid area is affected by the changes in the order volume of its neighborhood. The final model can make full adjustments to the corresponding grid neighborhood relationship during prediction, so as to be as close to the actual law as possible.
[0047] As some typical application examples of the above technical solutions, see Figure 2 As shown, the process of the online car-hailing order volume prediction method provided by the present invention may include, for example:
[0048] 1. Data input and preprocessing:
[0049] a) Collect historical online ride-hailing order volumes and aggregate the quantities by grid based on the longitude and latitude of the order initiation location.
[0050] b) Generate multi-level neighborhood matrices through various methods, including direct adjacency matrix, second-order neighborhood matrix and functional neighborhood matrix.
[0051] c) Calculate the neighborhood features of each grid based on the neighborhood matrix and order volume data.
[0052] 2. Construct a multi-level neighborhood matrix:
[0053] a) Generate a direct adjacency matrix based on the direct proximity relationship between grids.
[0054] b) The second-order neighborhood matrix representing the second-order proximity relationship between grids.
[0055] c) Generate a functional neighborhood matrix based on regional characteristics, such as residential areas and commercial concentrated areas.
[0056] 3. Preprocess the collected data, including data cleaning, data normalization, time series segmentation and other operations.
[0057] 4. Build a Sequence-to-Sequence model and input data into the model for training. The model structure includes:
[0058] a) Input layer: receives order quantity data and neighborhood feature data.
[0059] b) Encoder: Encode the input data through the LSTM layer to extract time series features.
[0060] c) Decoder: Decode the encoder output through the LSTM layer to predict future order volume.
[0061] d) Output layer: Output the prediction results through the fully connected layer.
[0062] 5. Input the real-time data into the trained prediction model and output the prediction results of the demand for online ride-hailing services in the next 24 hours.
[0063] The above scheme proposes an online car-hailing order volume prediction system based on a multi-level neighborhood matrix and a Seq2Seq model (i.e., a sequence-sequence model), which can make full use of the multi-level neighborhood characteristics between different grid areas and improve the accuracy of order volume prediction.
[0064] In the above exemplary scheme, the time granularity is divided into units of 1 hour, but it is not limited to this. Usually, predictions are made in units of half an hour or two hours, which can also reflect the changing patterns of the day. At the same time, the input data generally uses the sequence data of the past 48 hours, but it is also not limited to this. The output data is similar, and usually the sequence prediction of the next 24 hours is output, but it does not mean that the prediction results can only be output for 24 hours.
[0065] The loss function used in the model training process can be multiple. For example, the mean square error function (MSE) can be used to express the difference between the predicted value and the label value. The calculation formula is:
[0066] ;
[0067] Where MSE represents the value of the mean square error loss function, n represents the number of samples, and Y i Represents the label value, Represents the predicted value.
[0068] Of course, in addition to the mean square error loss function, other types of loss functions that can reflect the difference between the predicted value and the label value can theoretically guide the model training process.
[0069] In some embodiments, the representative grid selection process specifically includes the following sub-steps:
[0070] Kmeans clustering is performed on the geographic grid to form multiple groups, and each group has consistent order characteristics.
[0071] Geographical grids satisfying a preset order rule are selected from the plurality of groups to form a set of representative grids.
[0072] In some embodiments, the order characteristics include peak order volume, order volume mean, variance, and change trend;
[0073] In some implementation schemes, the preset order regularity includes the corresponding representative grid having a stable order volume performance regularity on different dates, which is calculated based on the order characteristics. The so-called stable order volume generally refers to the consistent performance of order characteristics such as peak order volume, peak time, and order volume average on multiple dates. It can be screened by multi-day variance or multi-day floating range. The specific stability calculation method is not limited, as long as it can show that the representative grid has a relatively stable regularity.
[0074] As a typical application example of the above technical solution, step (1) mentioned above is specifically: collecting online car-hailing historical orders, weather, traffic and other related data, and aggregating the order volume by hour according to the geographic hash grid code. Since some natural scenery and river areas do not generate orders, the specific example of the present invention uses the Kmeans clustering algorithm to screen out redundant grids to improve the prediction accuracy and calculation efficiency of the model.
[0075] In the clustering results of Kmeans, the geographic grids in each group have similar order characteristics, such as the order volume during peak hours, the order volume mean, variance, and change trend. Feature analysis can directly reduce data redundancy. Finally, geographic grids with certain preset order patterns are selected as the training data set, and the accuracy of the algorithm classification can be ensured through cross-validation and performance evaluation. This geographic grid selection method significantly improves the efficiency and accuracy of the prediction model. Compared with the traditional method of directly using all grids for training, the geographic grid selection method adopted has the following advantages:
[0076] a. Improved computing efficiency: Reduced the size of training data and accelerated model training.
[0077] b. Improved prediction accuracy: Clustering and importance analysis ensures the representativeness of the selected geographic grid, thereby improving the accuracy of the prediction model.
[0078] c. Enhanced versatility of the model: It is applicable to data sets in different regions and time periods, ensuring the stable performance of the model in a variety of application scenarios.
[0079] It can be seen that the present invention not only achieves a technological breakthrough in the order volume prediction model, but also further improves the performance and application value of the overall system through the optimized geographic grid selection method.
[0080] As for how to consider the influence of neighboring relationships, in some embodiments, the neighboring relationships include direct neighboring, second-order neighboring, and functional neighboring; the direct neighboring means that the two representative grids have a common boundary; the second-order neighboring means that the representative grid has a direct neighboring relationship with at least two other representative grids; the functional neighboring means that the two representative grids having a neighboring relationship have the same functional attributes.
[0081] In some embodiments, the functional attributes include multiple types of commercial areas, school areas, tourist areas, hospital areas, and air-rail hub areas, and are not limited thereto. In some specific examples, the functional attributes can be divided based on the building attributes within the geographic grid, such as the presence of hospitals, schools, residential areas, or scenic spots. If there are multiple types, they can be classified based on the proportion. The specific classification method is not limited, and reference can be made to many existing technologies.
[0082] In some embodiments, the multi-level neighborhood matrix is represented as a combined neighborhood matrix, and the calculation method of the combined neighborhood matrix is represented as:
[0083]
[0084]
[0085]
[0086]
[0087] in, represents the combined neighborhood matrix; represents the direct neighborhood matrix; represents the second-order neighborhood matrix; represents the multiplication operation of the direct neighborhood matrix. The second-order neighborhood matrix is obtained by multiplying the first-order neighborhood matrix, which can capture a wider range of spatial relationships and the spatial information of orders at a slightly longer distance; represents the functional neighborhood matrix; is the weight coefficient; i and j represent the index numbers of the representative grids.
[0088] When analyzing spatial data, it is very important to consider the neighboring relationship, because the properties of spatial data are often affected by the surrounding areas. Specifically, the order data of a city belongs to spatial data, and spatial data generally has the following characteristics:
[0089] 1. Spatial autocorrelation: Spatial data often exhibit autocorrelation, that is, the attributes of one area are somewhat correlated with the attributes of neighboring areas. This autocorrelation may not only be limited to the immediate neighborhood, but may also extend to more distant areas.
[0090] 2. Scale effect: Data may have different characteristics at different scales. Direct neighbors may capture local characteristics, while second-order neighbors may reveal broader patterns or trends.
[0091] 3. Increased complexity: Real-world problems often have complexity that may need to be captured by considering a wider range of adjacent relationships.
[0092] Analysis of the role of second-order neighborhood and functional neighborhood matrix:
[0093] 1. More comprehensive pattern recognition: By considering second-order neighbor relationships, more complex spatial patterns can be recognized that may be overlooked when only considering the immediate neighborhood.
[0094] 2. Improve prediction accuracy: When making spatial predictions, second-order neighbor relationships can provide additional information and help improve the accuracy of predictions.
[0095] 3. Enhanced robustness: In the presence of noise or missing data, considering second-order neighbor relationships can increase the robustness of the model because it can utilize broader spatial information to compensate for local uncertainties.
[0096] 4. Multi-scale analysis: Second-order neighbor relations allow the model to perform analysis at multiple scales, which helps capture spatial features at different scales.
[0097] 5. Improve interpretability: Considering second-order neighbor relationships can provide a deeper understanding of spatial data and help explain and understand complex phenomena in the data.
[0098] In geographic information systems (GIS), when analyzing issues such as land use and urban planning, second-order neighbor relations can help better understand spatial distribution and spatial relations. The same can be applied to the prediction of online car-hailing orders. In machine learning: When training a model for spatial data, considering second-order neighbor relations can improve the model's ability to learn spatial features, thereby improving the model's performance.
[0099] In summary, the second-order neighbor relationship provides a more comprehensive perspective to analyze and understand spatial data. Its importance lies in its ability to capture more complex spatial patterns and improve the model's predictive power. In addition, grid areas with the same attributes often have similar order volume characteristics, so adding functional features can improve the model's ability to capture features of similar areas.
[0100] Therefore, compared to simply considering one adjacent relationship, comprehensively considering multiple adjacent relationships of different categories and orders is more critical to obtaining accurate prediction results.
[0101] As a typical example, the process of step (2) described above may specifically be:
[0102] First, construct a multi-level neighborhood matrix, the direct neighborhood matrix Indicates the direct adjacent relationship of each grid. The specific generation method is as follows:
[0103]
[0104] The second-order neighborhood matrix represents the relationship between each grid and its second-order neighborhood. The specific generation method is as follows:
[0105] For the direct adjacency matrix , the second-order neighborhood matrix The calculation method is:
[0106]
[0107] Then, a functional neighborhood matrix is constructed based on the grid attributes (such as commercial areas and residential areas), and the grid attributes are defined according to the proportion of POI categories stored in each grid. The construction method is:
[0108]
[0109] The exemplary images of the above three neighborhood matrices can be found in Figure 3a-3c As shown, in order to fully consider the above three neighborhood relationships, a weighted fusion strategy is introduced in the specific example of the present invention to fuse the three matrices. Specifically, the combined neighborhood matrix The calculation formula is as follows:
[0110]
[0111] Here, α, β and γ satisfy the following conditions:
[0112] α + β + γ = 1.
[0113] This weighted fusion method has the following advantages:
[0114] Comprehensiveness: The fused neighborhood matrix can simultaneously consider local and global spatial relationships, as well as the relationships between functionally similar areas, providing more comprehensive neighborhood information.
[0115] Flexibility: By adjusting the values of α, β and γ, the influence of each neighborhood matrix can be flexibly changed to optimize model performance according to different application scenarios and data characteristics (for example, the weights of training corresponding models for prediction in different types of cities, such as tourist cities, industrial cities, and comprehensive cities, are different).
[0116] Adaptability: This method can adapt to the characteristics of different urban structures and different types of regions, improving the generalization ability and prediction accuracy of the model.
[0117] As a reference for weight setting of a preferred example, in general settings, direct neighbors may have a direct impact on order volume, while second-order neighbors and functional neighbors may provide indirect or more complex impacts. Therefore, as a basic starting point, α can be set to a slightly higher weight (such as 0.4), and β and γ can be set to equal weight (0.3); and the value and selection of weights in the combined neighborhood matrix can be adjusted according to different scenarios and needs:
[0118] 1. Principles and value range of weight selection
[0119] Basically equal: In some cases, the relationships of direct neighbors, second-order neighbors, and functional neighbors may be equally important. For example, in a well-developed city, the impact of these three types of relationships on order volume may not be significantly different. In this case, equal or close weights can be selected, such as α = 0.33, β = 0.33, γ = 0.34.
[0120] Emphasize direct neighbor relationships: In some cities, spatial distance plays a dominant role in the prediction of grid order volume, such as densely populated metropolitan areas with convenient inter-regional transportation. In this case, the weight of direct neighbors may need to be larger, and a typical setting may be α = 0.6, β = 0.2, γ = 0.2.
[0121] Emphasize functional neighborhood relationships: If there are obvious functional areas in the city (such as CBD, commercial areas, tourist attractions, etc.), the interaction between these functional areas has a significantly greater impact on the order volume than the spatial distance. In this case, the weight of the functional neighborhood may be higher, such as α = 0.2, β = 0.2, γ = 0.6.
[0122] 2. Adjust weights based on basic city types
[0123] For first-tier cities (large metropolitan areas):
[0124] Features: dense regional distribution, developed transportation, and frequent interactions between different functional areas.
[0125] Recommended weights: You can appropriately reduce the weight of direct neighbors and increase the weight of functional neighbors, such as α = 0.3, β = 0.2, γ = 0.5.
[0126] Second-tier cities (medium-sized cities):
[0127] Features: There are certain functional divisions, but the distance between areas is still an important factor.
[0128] Recommended weights: A more balanced weight setting may be used, such as α = 0.4, β = 0.3, γ = 0.3.
[0129] Third-tier and below cities (small cities or towns):
[0130] Characteristics: Urban development is relatively uniform, functional zoning is not obvious, and spatial distance has a greater impact on interaction.
[0131] Recommended weights: Strengthen the weights of direct neighbors and second-order neighbors, such as α = 0.5, β = 0.3, γ = 0.2.
[0132] It should be noted that in the above weight settings, appropriate floating to a certain extent does not affect the basic size relationship. Even if it is slightly different from the above recommended value (for example, within ±0.03), it still reflects the same rule and can achieve nearly equivalent effects.
[0133] It can be seen that in terms of weight strategy adjustment, the initial weights can be set by analyzing the city's geographic spatial layout, population density, transportation network, and functional zoning, and then fine-tuned through model training. Through these strategies and discussions, the weighted fusion method of the neighborhood matrix can be flexibly applied to adapt to different application scenarios and further improve the model's predictive ability.
[0134] The above technical solution can pre-process the collected data, and combine the multi-level neighborhood matrix characteristics to remove outliers and missing values, and can normalize data of different dimensions to unify the dimensions to ensure data quality; finally, the time series is segmented: the time series data is divided into time periods of a certain length as model input, specifically, 48 steps (one step is 1 hour) of input and 24 steps of output can be constructed, and the processed data is input into the sequence-sequence model adopted by the present invention for training to obtain a prediction model.
[0135] Regarding the structure and characteristics of the above-mentioned model, in some embodiments, the sequence-sequence model includes an encoder and a decoder, and the encoder and the decoder both include multiple LSTM units connected in series; the serialized input data are respectively input into the multiple LSTM units in the encoder, and any of the LSTM units combines the corresponding input data and the output of the previous LSTM unit to generate the corresponding hidden state and cell state, and the final hidden state and the final cell state are input into the decoder as the encoding information of the entire input sequence to generate predicted sequence data.
[0136] In some embodiments, the encoder's calculation process is expressed as:
[0137] ;
[0138] The operation process of the decoder is expressed as:
[0139] ;
[0140] in, represents the coded information; represents the encoder; represents the input data; represents the neighborhood feature; represents the predicted sequence data, wherein is an integer greater than 1, representing the number of time series in the second period or the future period; represents the decoder; Indicates the order quantity data.
[0141] generally, The value of is 24, which means that the time series is divided into 1-hour granularity in a day, but it is not limited to this. For example, it can be divided into half-hour granularity. The value of is usually 48. If it is divided into 2-hour granularity, the value is usually 12.
[0142] As a typical example, step (3) described above can be specifically as follows: building a deep learning network Sequence-to-Sequence model to achieve sequence-to-sequence mapping, that is, mapping a sequence as input to a sequence as output. In the prediction of online car-hailing order demand, the order input sequence of the previous 48 hours is used to predict the output of the next 24 hours. The granularity of the time series in this example is divided into 1 hour. This process consists of two links: encoding (Encoder) input and decoding (Decoder) output. The former is responsible for encoding the sequence into a fixed-length vector, which is passed as input to the latter and outputs a variable-length vector. The embodiment of the present invention selects a long short-term memory network (LSTM, whose structure is as follows: Figure 4 The deep learning encoder-decoder (as shown in Figure 1) is constructed. In the LSTM Encoder, the input data of each time step is processed by an LSTM unit to generate the corresponding hidden state and cell state. The final hidden state and cell state of the encoder are passed to the decoder as the encoding information of the entire input sequence. The structure and principle of the LSTM Decoder are similar to those of the LSTM Encoder, but its task is to generate a sequence based on the output of the encoder and the prediction of the previous moment.
[0143] The input of the encoder includes the order volume time series Xi and neighborhood relationship features of the current grid:
[0144] ;
[0145] The decoder generates a forecast of the order volume for the next 24 hours based on the encoder’s hidden state and the initial input:
[0146] ;
[0147] Corresponding to the training process of step (3), step (4) is specifically as follows: using the sequence model proposed in step (3), the sequence data 48 hours before the predicted date is selected as input when the latest historical data is obtained every day. Since the Sequence-to-Sequence model can accept variable-length sequences as model input, the input length can be adjusted in real time according to the actual application scenario, thereby further improving the prediction effect and obtaining the order volume 24 hours before the predicted date.
[0148] The embodiment of the present invention also provides a system for predicting the order volume of online car-hailing vehicles based on a multi-level neighborhood matrix and a sequence model, which includes:
[0149] The data acquisition module is used to divide the predicted area into geographic hash grids, and to aggregate the online car-hailing order data in each geographic grid in time series based on historical records to obtain order volume data;
[0150] A representative grid module, used for selecting a plurality of representative grids based on clustering and analysis of the order volume data;
[0151] A neighborhood relationship module, used to construct a multi-level neighborhood matrix using a plurality of the representative grids, wherein the multi-level neighborhood matrix represents the neighbor relationship between any of the representative grids and other representative grids at multiple levels;
[0152] A neighborhood feature module, used to calculate neighborhood features using the multi-level neighborhood matrix and order volume data;
[0153] a model training module, configured to use the order volume data and the neighborhood features in a first period as inputs of a sequence-sequence model, and use the order volume data in a second period as labels to train the sequence-sequence model, wherein the first period and the second period are continuous in time series and the second period is later in time;
[0154] The data prediction module is used to input the real-time sequence data of the current period into the trained sequence-sequence model to obtain the prediction results of the online car-hailing order volume in the future period based on the time series distribution.
[0155] In addition, an embodiment of the present invention further provides a readable storage medium, in which a computer program is stored. When the computer program is executed, the steps of the above-mentioned online car-hailing order volume prediction method are executed.
[0156] The technical solution of the present invention is further described in detail below through several embodiments and in conjunction with the accompanying drawings. However, the selected embodiments are only used to illustrate the present invention, and do not limit the scope of the present invention.
[0157] Example 1
[0158] The selected training data is the historical order data of online ride-hailing in Shanghai from March 2023 to March 2024. The grid division method is based on the 7-bit geographic grid code. Specifically, the latitude and longitude information of the location where each online ride-hailing order occurred is mapped to the corresponding 7-bit grid code. In this way, the order data of different regions can be clearly integrated, laying the foundation for subsequent feature extraction and model training.
[0159] This approach ensures that order data can be accurately allocated to specific urban areas, helping to capture the differences in demand for different functional areas in the city (such as commercial areas and residential areas). At the same time, the accuracy of the 7-bit code can not only reflect the urban structure in detail, but also avoid the problem of data sparsity caused by over-segmentation.
[0160] Based on the data based on 7-bit grid coding, the direct adjacency matrix, the second-order neighborhood matrix and the functional neighborhood matrix were constructed, and the multi-step prediction of online car-hailing order volume was carried out in combination with the seq2seq model. This method significantly improves the accuracy and stability of the prediction by incorporating spatial neighborhood features into the time series model.
[0161] The root mean square error is used to show the accuracy of the trained model and compared with various technical solutions. For specific results, see Figure 5 As shown in the figure, compared with the traditional LSTM model, the accuracy of the pure Seq2Seq model is improved, but if the grid screening mechanism that does not consider the neighborhood features is introduced, a decrease in model accuracy can be observed. When the multi-level neighborhood features are taken into consideration during the training process of the Seq2Seq model, the prediction performance of the model reaches the optimal level.
[0162] This fully demonstrates that simply introducing a screening mechanism for grid order features to obtain a representative grid does not help the training of the Seq2Seq model in this scenario, but will have a negative impact. Therefore, the grid screening mechanism needs to be combined with multi-level neighborhood features to synchronously guide the model training process in order to achieve a positive effect.
[0163] It should be understood that the above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for predicting online car-hailing order volume based on multi-level neighborhood matrix and sequence model, characterized in that: include: Divide the forecast area into geographic hash grids, and aggregate the online car-hailing order data in each geographic grid in time series based on historical records to obtain order volume data; Based on clustering and analysis of the order volume data, selecting a plurality of representative grids; A multi-level neighborhood matrix is constructed using the plurality of representative grids, wherein the multi-level neighborhood matrix represents the neighboring relationship between any representative grid and other representative grids at multiple levels, wherein the neighboring relationship includes direct neighboring, second-order neighboring, and functional neighboring, wherein the direct neighboring means that the two representative grids have a common boundary; the second-order neighboring means that the representative grid has a direct neighboring relationship with at least two other representative grids; and the functional neighboring means that the two representative grids having a neighboring relationship have the same functional attributes; Specifically, the multi-level neighborhood matrix is expressed as a combined neighborhood matrix, and the calculation method of the combined neighborhood matrix is expressed as: ; in, represents the combined neighborhood matrix; represents the direct neighborhood matrix; represents the second-order neighborhood matrix; represents the multiplication operation of the direct neighbor matrix; represents the functional neighborhood matrix; is a weight coefficient; i and j represent the index numbers of the representative grids; k represents the index numbers of other representative grids except the representative grids i and j; Calculating neighborhood features using the multi-level neighborhood matrix and the order volume data, wherein the neighborhood features represent a weighted sum of the order volume data of other representative grids having the neighboring relationship with any of the representative grids calculated based on the multi-level neighborhood matrix; Using the order volume data and the neighborhood features in the first period as inputs of a sequence-sequence model, and using the order volume data in the second period as labels, to train the sequence-sequence model, wherein the first period and the second period are continuous in time series and the second period is later in time; Specifically, the sequence-sequence model includes an encoder and a decoder, each of which includes a plurality of LSTM units connected in series, the serialized input data is respectively input into the plurality of LSTM units in the encoder, any of the LSTM units combines the corresponding input data and the output of the previous LSTM unit to generate a corresponding hidden state and cell state, and the final hidden state and the final cell state are input into the decoder as the encoding information of the entire input sequence to generate predicted sequence data; The calculation process of the encoder is expressed as: ; The operation process of the decoder is expressed as: ; in, represents the coded information; represents the encoder; Represents the order volume data of the representative grid with index number i The order quantity data of the representative grid with index number j is represented; represents the neighborhood feature; represents the predicted sequence data, wherein is an integer greater than 1, representing the number of time series in the second period or the future period when the prediction is made, and t represents the starting time value; represents the decoder; When predicting the volume of online ride-hailing orders, the real-time sequence data of the current period is input into the trained sequence-sequence model to obtain the prediction results of the volume of online ride-hailing orders in the future period according to the time series distribution.
2. The method for predicting online car-hailing order volume according to claim 1, characterized in that: The representative grid selection process specifically includes: Performing Kmeans clustering on the geographic grid to form a plurality of groups, wherein each group has consistent order characteristics; Geographical grids satisfying a preset order rule are selected from the plurality of groups to form a set of representative grids.
3. The method for predicting online car-hailing order volume according to claim 2, characterized in that: The order characteristics include peak order volume, order volume mean, variance and change trend; The preset order rule includes a corresponding representative grid having a stable order volume performance rule on different dates, which is calculated based on the order characteristics.
4. The method for predicting online car-hailing order volume according to claim 1, characterized in that: The functional attributes include commercial areas, school areas, tourist areas, hospital areas, and air-rail hub areas.
5. A system for predicting online car-hailing order volume based on a multi-level neighborhood matrix and a sequence model, used to implement the online car-hailing order volume prediction method described in any one of claims 1 to 4, characterized in that: include: The data acquisition module is used to divide the predicted area into geographic hash grids, and to aggregate the online car-hailing order data in each geographic grid in time series based on historical records to obtain order volume data; A representative grid module, used for selecting a plurality of representative grids based on clustering and analysis of the order volume data; A neighborhood relationship module, used to construct a multi-level neighborhood matrix using a plurality of the representative grids, wherein the multi-level neighborhood matrix represents the neighbor relationship between any of the representative grids and other representative grids at multiple levels; A neighborhood feature module, used to calculate neighborhood features using the multi-level neighborhood matrix and order volume data; a model training module, configured to use the order volume data and the neighborhood features in a first period as inputs of a sequence-sequence model, and use the order volume data in a second period as labels to train the sequence-sequence model, wherein the first period and the second period are continuous in time series and the second period is later in time; The data prediction module is used to input the real-time sequence data of the current period into the trained sequence-sequence model to obtain the prediction results of the online car-hailing order volume in the future period based on the time series distribution.
6. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed, the steps of the online car-hailing order volume prediction method described in any one of claims 1 to 4 are executed.
Citation Information
Patent Citations
Traffic index prediction method and device based on sequence-to-sequence learning model
CN110619427A
Travel demand prediction method and system for interaction between urban functional areas
CN115204445A
Method for bus arrival time prediction when lacking data
WO2023029234A1