Shared bicycle destination prediction method and system based on user travel behaviors

Through the shared bicycle destination prediction method based on user travel behavior, using the Transformer model and Stacking algorithm, the problem of supply and demand imbalance and high damage rate in the shared bicycle system is solved, and more accurate resource allocation and system efficiency improvement are achieved.

CN118863147APending Publication Date: 2024-10-29ZHEJIANG UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410889994.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

There are problems of supply and demand imbalance and high damage rate in the shared bicycle system, which leads to uneven distribution of parking points and waste of resources, making management more difficult.

Method used

A shared bicycle destination prediction method based on user travel behavior is adopted. By obtaining the travel demand information of users' macro-regions and micro-individuals, the Transformer model and Stacking algorithm are used for prediction, and the shared bicycle resources are adjusted and reallocated based on historical frequencies and spatiotemporal characteristics.

Benefits of technology

It improves the accuracy of shared bicycle destination prediction, optimizes resource allocation, reduces management difficulty and resource waste, and improves system efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118863147A_ABST
    Figure CN118863147A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of Internet of Things prediction, and particularly relates to a shared bicycle destination prediction method and system based on user travel behaviors, and the method comprises the steps: obtaining the travel demand prediction information of a user macroscopic region, and inputting the appearance demand information of a user in a historical time period to obtain the travel demand information of the user in a future time period; obtaining microscopic individual travel destination prediction information; according to the method, the prediction promotion information of the user macroscopic travel demand is obtained based on the travel demand prediction information of the user macroscopic region, and the individual travel prediction destination is adjusted and redistributed based on the probability matrix of algorithm and historical frequency fusion by using the macroscopic shared bicycle travel demand prediction amount of the research region. Therefore, the purpose of improving the destination prediction accuracy is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Internet of Things prediction, and specifically is a method and system for predicting a shared bicycle destination based on user travel behavior. Background Art

[0002] In recent years, the development of urbanization and industrialization has brought strong impetus to the global economy, but also brought unprecedented pressure to the environment. As the world enters the post-industrial and post-modernization era, green economy has become a global consensus. People's choice of travel mode has also gradually changed from fuel vehicles to green travel and low-carbon travel.

[0003] With the rapid development of technologies such as mobile Internet and the Internet of Things, shared bicycles have gradually become one of the main choices for residents to travel, and the advantages of shared bicycle travel have gradually emerged. For residents, the reasonable distribution and location of shared bicycle parking spots provide more convenience for residents to travel. For urban transportation, the rise of shared bicycles has alleviated road congestion and passenger flow pressure on urban rail transit to a certain extent, and solved the "last mile" problem of the distance between rail transit stations and bus stations and the user's actual destination in urban travel at the lowest cost.

[0004] In addition, shared bicycles have also made important contributions to promoting low-carbon travel, green travel and sustainable development of transportation. In urban shared bicycle travel, users' travel characteristics show strong diversity. For different users, the different living and working areas lead to different time and space regularities in their use of shared bicycles; in addition, for different functional areas, users' travel destinations will also show diversity. With the large-scale deployment of shared bicycles in various cities, people's massive travel data also provides researchers with an excellent entry point to understand users' travel methods, and provides strong support for better optimization and design of the entire city's transportation system.

[0005] The rapid development of shared bicycles has also brought about a series of social problems, such as the tidal phenomenon and the imbalance in the deployment of shared bicycles. The reason for this is the imbalance between the demand and supply of shared bicycles for travel by residents in different regions. The phenomenon of too many shared bicycles parked in a certain place will not only cause congestion of pedestrians and vehicles, but also indicate that there will be a shortage of shared bicycles in another place.

[0006] The main reason for this phenomenon is the unbalanced flow of shared bicycles, that is, a large number of users always ride one-way when using shared bicycles, that is, when users ride shared bicycles from one place to another, they rarely use shared bicycles for the return trip. The failure of managers to reallocate inventory in a timely manner has led to an imbalance in the supply and demand of the entire shared bicycle system. In addition, due to the high frequency of use and unattended characteristics of shared bicycles, high damage and loss rates are also problems faced by shared bicycles.

[0007] Therefore, under the condition of having massive user travel data, it has become the focus of the current work of shared bicycle companies to analyze user travel behavior in detail, extract user travel characteristics, and use user travel characteristics to predict user travel destinations to support managers in timely recycling, deployment, and reallocation of shared bicycles. Summary of the invention

[0008] In order to make up for the deficiencies of the prior art and solve the above-mentioned technical problems, the present invention proposes a method and system for predicting the destination of a shared bicycle based on user travel behavior.

[0009] On the one hand, the present invention proposes a method for predicting a shared bicycle destination based on user travel behavior, the method comprising the following steps:

[0010] S10: Obtaining the travel demand forecast information of the user's macro-region, which is used to input the user's historical time period's emerging demand information to obtain the user's future time period's travel demand information;

[0011] S20: Obtaining information for predicting the travel destination of micro individuals;

[0012] S30: Obtain prediction improvement information of the user's macro travel demand based on the travel demand prediction information of the user's macro region.

[0013] Specifically, S10 includes:

[0014] S11: Obtain a set of model parameters to achieve the minimum error between the predicted value and the true value, and obtain it in the following way:

[0015]

[0016] Among them, for a given area l, the travel demand in the time period of time t is expressed as X l,t , the feature of region l in this time period is set to W l,t , H is the historical time step, and P is the predicted future time step;

[0017] S12: Mark the relative position or absolute position information of the travel demand sequence by using a coding method, and use the sine function and cosine function in the following coding method:

[0018]

[0019] Among them, pos represents the position of the travel demand of a single time step in the sequence, i represents the dimension of the position encoding, and d represents the dimension of the model input;

[0020] S13: Using encoder and decoder;

[0021] S14: Use self-attention to calculate the dependencies and weights between different positions in the input travel demand sequence, and establish the dependencies between elements by calculating the attention weights. The calculation formula is as follows:

[0022]

[0023] Where Q represents the query matrix, K represents the key matrix, V represents the value matrix, and d k The dimension representing multi-head attention;

[0024] Among them, the multi-head attention mechanism is composed of the self-attention mechanism. The multi-head attention mechanism allows the model to pay attention to information from different representation subspaces at different positions; the calculation formula is as follows:

[0025] MutiHead(Q,K,V)=Concat(h eda1,…,h ead n )W O

[0026]

[0027] in, and They represent the query vector, key vector and value vector transformed by the weight matrix respectively, i represents the output of the i-th attention head.

[0028] Specifically, S20 includes using the XGBoost algorithm and the CatBoost algorithm as base learners in the Stacking algorithm to predict the travel destination of shared bicycles.

[0029] Specifically, the CatBoost algorithm includes:

[0030] S21: Randomly arrange the entire data set;

[0031] S22: For each sample, calculate the average label value of the data of the same category that have appeared in the data sequence, and use it as the numerical categorical feature of the sample.

[0032] Specifically, the Stacking adopts a k-fold cross-validation method when training data;

[0033] Let D = {(x i,j ,y j ), i=1…P, j=1…N} is the original data set, where x i,j represents the i-th feature of the j-th sample, y j is the label of the jth sample, and D is divided into training set D according to a certain ratio train ={X train ,Y train} and test set D test ={X test ,Y test}; Assume that the first layer has base learners BC1, BC2…BC n , divide the training set into k parts to get the data set D train 1 ,D train 2 …,D train k , select one of them as the validation set in turn, and input the remaining k-1 pieces of data as the training set to the base learner for training;

[0034] For any base learner BC t ,t=1,2,…,n, k sub-models will be obtained during training, and k groups of verification values ​​will also be obtained. Combining these verification values ​​in order will obtain a data set Vali_Prediction with the same label dimension as the original training set t ; Set the test set D test Input to BC t Among the k sub-models obtained through training, the average of these k prediction results is calculated to obtain a dataset Prediction with the same label dimension as the original test set. t ;

[0035] Vali_Prediction t By horizontal splicing, we can get a feature matrix VP with a feature dimension of n, which is consistent with Y train Together as a training data set input meta-learner for training;

[0036] Prediction t By horizontal splicing, we can get a feature matrix P with a feature dimension of n, which is similar to Y test Together they are used as a test data set to input the meta-learner for testing.

[0037] Specifically, S30 includes:

[0038] S31: Obtaining macro-regional travel demand forecast and regional supply capacity aggregation information;

[0039] S32: Based on micro-individual travel destination prediction and historical travel distribution weighting;

[0040] S33: Develop a destination prediction improvement strategy.

[0041] Specifically, S31 includes constructing a macro-regional travel demand forecasting dataset

[0042] Specifically, S32 includes the following steps: α The training set and test set are based on The same time sequence is used for division;

[0043] Among them, the feature set of the data set Where u represents the user ID, st represents the departure time, sl represents the departure location, and el represents the arrival location. represents the time feature, ξ represents the user’s individual feature. In addition, the set of k candidate destinations is K;

[0044] The destination prediction problem is defined as:

[0045]

[0046] Among them, P el is the probability that the destination of this trip is el given the above conditions;

[0047] Since for k destinations, the Stacking algorithm will generate k probabilities for each travel record in the test set, the probability matrix output by the destination prediction algorithm is defined as P α , with dimension N test *k;

[0048] Select P α The area corresponding to the maximum probability of each row in is taken as the prediction result of the record, and the prediction result of the test set is defined as

[0049] For the prediction result C, the user cluster is calculated according to the destination, and the destination demand capacity set R = {r1, r2, …, r k};

[0050] Perform a weighted operation on the historical travel distribution. For each user u, extract the frequency of reaching each el in the training set, and obtain the historical travel frequency sequence H of each user u After the standardization operation, the historical travel destination probability distribution of each user is obtained, denoted as P u , then the weighted operation of historical travel distribution is expressed as the following formula:

[0051]

[0052] Where P * represents the weighted probability distribution matrix of historical travel, λ,μ represent P α ,P u The weight of The operation is to add the probability distributions of corresponding rows in the two probability matrices.

[0053] Specifically, S33 includes identifying the demand overflow destination area and adjusting the destination prediction result.

[0054] A shared bicycle destination prediction system based on user travel behavior, the system is used to implement a shared bicycle destination prediction method based on user travel behavior and method, including:

[0055] The user's macro-region travel demand prediction module is used to input the user's historical time period's emerging demand information to obtain the user's future time period's travel demand information;

[0056] Micro-individual travel destination prediction information, used to obtain micro-individual travel destination prediction information;

[0057] The prediction and improvement module of the user's macro travel demand is used to obtain the prediction and improvement information of the user's macro travel demand based on the travel demand prediction information of the user's macro area.

[0058] The beneficial effects of the present invention are as follows:

[0059] 1. The stacking-based ensemble learning model of the present invention is used to solve the problem of micro-individual travel destination prediction. In this model, the present invention takes into account the time characteristics and user travel characteristics, and better describes the user travel rules by extracting the above characteristics.

[0060] 2. The present invention constructs a Transformer-based macro-regional travel demand prediction model, which performs sequence transmission through self-attention and takes into account different spatiotemporal characteristics. It can better extract features from the travel demand of shared bicycle users and make predictions.

[0061] 3. The present invention utilizes the macro-shared bicycle travel demand forecast in the study area, and adjusts and reallocates the predicted destinations of individual travel based on the probability matrix fused with the algorithm and historical frequency, so as to achieve the purpose of improving the accuracy of destination prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] The present invention will be further described below in conjunction with the accompanying drawings.

[0063] Figure 1is a flow chart of the method of the present invention;

[0064] Figure 2 It is an algorithm flow chart of the macro-regional travel demand forecast and capacity aggregation, micro-individual travel destination forecast and historical travel weighting, and destination forecast enhancement strategy in the present invention;

[0065] Figure 3 is a schematic diagram of the spatial distribution of shared bicycles in Beijing in the experiment provided by the present invention;

[0066] Figure 4 is a distribution diagram of passenger flow of different travel modes in the experiment provided by the present invention;

[0067] Figure 5 This is a diagram of the predicted passenger flow of shared bicycles in the experiment provided by the present invention. DETAILED DESCRIPTION

[0068] The embodiments of the present invention provide a shared bicycle destination prediction method and system based on user travel behavior, which utilizes the macro shared bicycle travel demand forecast in the study area and adjusts and reallocates the predicted destinations of individual travel based on a probability matrix fused with an algorithm and historical frequency, so as to improve the accuracy of destination prediction.

[0069] After introducing the basic principles of the present invention, various non-limiting implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings.

[0070] Embodiment 1:

[0071] like Figure 1 As shown, an embodiment of the present invention provides a method for predicting a shared bicycle destination based on user travel behavior, and the method includes the following steps:

[0072] S10: Obtaining the travel demand forecast information of the user's macro-region, which is used to input the user's historical time period's emerging demand information to obtain the user's future time period's travel demand information;

[0073] S20: Obtaining information for predicting the travel destination of micro individuals;

[0074] S30: Obtain prediction improvement information of the user's macro travel demand based on the travel demand prediction information of the user's macro region.

[0075] In this embodiment, step S10 is specifically described, that is, the shared bicycle travel demand prediction is a high-dimensional and high-complexity time series prediction problem, the goal is to learn a suitable model, input the travel demand of the historical time period and output the travel demand of the future time period. The goal of the model is to obtain a set of optimal model parameters to achieve the minimum error between the predicted value and the true value. The specific expression is as follows:

[0076]

[0077] Among them, for a given area l, the travel demand in the time period of time t is expressed as X l,t , the feature of region l in this time period is set to W l,t ,The present invention takes into account the historical passenger flow, time ,characteristics, weather characteristics, POI characteristics, etc. H is the historical time step, and P is the ,predicted future time step.

[0078] Transformer is mainly composed of an Encoder-Decoder structure, which abandons the cyclic transmission mode of models such as RNN and LSTM and the convolution transmission mode of CNN-type models. It performs sequence transmission completely based on the self-attention mechanism, and adds the previous output as input to the next sequence transmission. This method allows Transformer to break through the limitation that the cyclic method cannot be calculated in parallel compared to RNN; compared to CNN, the number of operations required to calculate the correlation between two positions does not increase with the distance; in addition, the model built based on self-attention has stronger interpretability, and the present invention can judge the different tasks learned by each attention head by analyzing the distribution of attention. Transformer can automatically learn the importance of different variables in the sequence without being affected by their position. Such a mechanism has great advantages in dealing with problems with high complexity and randomness such as travel demand forecasting.

[0079] Among them, for the travel demand prediction problem, the order of travel demand at each time step is one of its important features. Since the Transformer model does not conduct sequence transmission in a recursive and convolutional manner, it is necessary to design a method to mark the relative position or absolute position information of the travel demand sequence. The common position encoding method is composed of sine function and cosine function:

[0080]

[0081] Among them, pos represents the position of the travel demand of a single time step in the sequence, i represents the dimension of the position encoding, and d represents the dimension of the model input.

[0082] The encoder is composed of multiple encoding layers, each of which consists of two sub-layers. The first is a multi-head attention layer, and the second is a feed-forward layer consisting of a fully connected layer, with residual connection processing after each sub-layer.

[0083] The decoder is composed of multiple decoding layers. Compared with the encoder, the decoder adds a multi-head attention sublayer and residual connection to process the encoder output. At the same time, a masking mechanism is also added to the attention layer of the Transformer decoder. The masking mechanism can cover up the subsequent part of the current travel demand, ensuring that the prediction for a specific location can only rely on the known output of the current location.

[0084] Among them, Transformer uses self-attention to calculate the dependencies and weights between different positions in the input travel demand sequence. It allows the model to take all elements in the sequence into account at the same time, and can weight them using the Sigmoid activation function according to the similarity between the elements. The dependencies between the elements are established by calculating the attention weights. The calculation formula is as follows:

[0085]

[0086] Where Q represents the query matrix, K represents the key matrix, V represents the value matrix, and d k Represents the dimension of multi-head attention.

[0087] The multi-head attention mechanism is composed of the self-attention mechanism. The multi-head attention mechanism allows the model to pay attention to information from different representation subspaces at different positions. The calculation formula is as follows:

[0088] MutiHead(Q,K,V)=Concat(h head1,…,head n )W O

[0089]

[0090] in, and They represent the query vector, key vector and value vector transformed by the weight matrix respectively, i represents the output of the i-th attention head.

[0091] In the Encoder-Decoder structure, multi-head attention layers at different positions play different roles. In the Encoder layer, all query, key, and value matrices come from the output of the previous layer, and the Encoder can pay attention to the information of all positions in the sequence; the first multi-head attention layer of the Decoder layer receives the matrix after the Masking operation to achieve the function of only paying attention to the impact of the value before the current position; in the second multi-head attention layer of the Decoder layer, the query matrix comes from the output of the first multi-head attention layer of the Decoder layer, and the key and value matrices come from the output of the Encoder. Such operations allow the Decoder to also pay attention to global features.

[0092] Embodiment 2:

[0093] In this embodiment, step S20 is specifically described. The shared bicycle travel destination prediction problem can be divided into a trajectory-based prediction problem and a start and end point location-based prediction problem according to different data types. The former belongs to a type of regression problem, and the latter belongs to a type of classification problem. The present invention studies and describes the latter.

[0094] For the latter, the shared bicycle destination prediction problem can be defined as: given the starting point, end point, and other related information of some shared bicycle users, predict the end point of the user's trip for a given user and related information. Currently, researchers have proposed a variety of methods for analyzing the destination prediction problem. The Stacking algorithm can integrate a variety of different models and use the characteristics of various algorithms to extract complex nonlinear relationships in shared bicycle travel data. The present invention uses the XGBoost algorithm and the CatBoost algorithm as the base learners in the Stacking algorithm to predict the shared bicycle travel destination.

[0095] Among them, the XGBoost algorithm is a highly scalable end-to-end tree structure boosting system. It is a parallel tree boosting algorithm that can quickly and accurately optimize the training process. The objective function of XBGoost consists of two parts: training loss and regularization. Regularization is conducive to smoothing the learning weights to avoid overfitting. When solving the objective function, XGBoost performs a second-order Taylor expansion on the objective function to be solved, so that the loss function of each sample only needs to calculate the first-order derivative and the second-order derivative, thereby increasing the parallel rate of the algorithm.

[0096] Among them, the CatBoost algorithm is a powerful gradient boosting algorithm that successfully handles categorical feature problems and processes categorical features during training rather than preprocessing time. In addition, the algorithm uses a tree structure in a new mode to calculate the weights of leaf nodes, which also helps reduce the probability of overfitting.

[0097] Categorical features are a set of discrete values ​​representing categories, most of which are in the form of strings. Such feature data cannot be directly used in binary decision trees, so the common practice when processing such features is to convert them into numbers in preprocessing, such as one-hot encoding. CatBoost uses a more effective strategy.

[0098] This strategy first randomly arranges the entire data set, and then for each sample, calculates the average label value of the same category data that has appeared in the data sequence, and uses it as the numerical category feature of the sample. Assume that the random sample sequence is σ=(σ1…σ n ), then the categorical feature of the kth sample for:

[0099]

[0100] Where P represents the prior term, and a is the weight coefficient of the prior term. Adding a prior term is a common calculation method, which helps reduce the noise caused by low-frequency category data. For regression tasks, the prior term is the average value of the category features in the data set. For binary classification tasks, the prior term is usually the prior probability of encountering the positive class.

[0101] Specifically, the Stacking ensemble learning method is another major ensemble algorithm besides Bagging and Boosting, and is also a typical representative of heterogeneous ensemble methods. The general Stacking algorithm consists of two layers. The first layer consists of multiple different prediction models to train the same batch of training set data. These models are also called base learners. This helps the model to use the advantages of different base learners to train the nonlinear relationship between different features and obtain representative new generated feature values. The second layer consists of only one algorithm, also called a meta-learner. During training, the original data is input into each base learner of the first layer, and the obtained prediction results are used as the input of the second layer. After training by the meta-learner, the final prediction results are obtained.

[0102] However, since many models need to be built during training, overfitting is prone to occur if the model is built according to the original training set. Therefore, Stacking usually adopts the k-fold cross-validation method when training data.

[0103] Let D = {(x i,j ,y j ), i=1…P, j=1…N} is the original data set, where x i,j represents the i-th feature of the j-th sample, y j is the label of the jth sample, and D is divided into training set D according to a certain ratio train ={X train ,Y train} and test set D test ={X test ,Y test}. Assume that the first layer has base learners BC1, BC2…BC n , divide the training set into k parts to get the data set D train 1 ,D train 2 …,D train k , select one of them as the validation set in turn, and the remaining k-1 pieces of data are input into the base learner as the training set for training.

[0104] For any base learner BC t ,t=1,2,...,n, k sub-models will be obtained during training, and k groups of verification values ​​will also be obtained. Combining these verification values ​​in order will obtain a data set Vali_Prediction with the same label dimension as the original training set t . The test set D test Input to BC t Among the k sub-models obtained through training, the average of these k prediction results is calculated to obtain a dataset Prediction with the same label dimension as the original test set. t . t By horizontal splicing, we can get a feature matrix VP with a feature dimension of n, which is consistent with Y train As a training data set, input the meta-learner for training; t By horizontal splicing, we can get a feature matrix P with a feature dimension of n, which is similar to Y test The two sets of data are input together as a test data set into the meta-learner for testing, and the result obtained is the final prediction result.

[0105] Embodiment three:

[0106] In this embodiment, step S30 is specifically described as follows: Figure 2 As shown, in obtaining the prediction improvement information of the user's macro travel demand based on the user's macro regional travel demand prediction information, it includes macro regional travel demand prediction and capacity aggregation, micro individual travel destination prediction and historical travel weighting, and destination prediction improvement strategy;

[0107] Specifically, first, the present invention constructs a macro-regional travel demand prediction dataset Destination prediction dataset D α The size is N*F, where N is the number of samples in the data set, N=N train +N test ; F is the feature dimension of the data set. For the destination prediction data set D α The present invention calculates the time series data set for each candidate destination area el according to the departure time st, and can obtain the time series data Will By dividing the training set and the test set in chronological order, the input of the travel demand prediction part can be obtained.

[0108] Then use the Transformer model to make predictions, and you can get a length of N test The travel demand forecast result sequence

[0109] Here, we set the regional supply capacity to v el , the regional supply capacity is the sum of the arrival quantities of a single region el within a certain period of time, which can be expressed by the following formula:

[0110]

[0111] Where T is the number of time steps, is the arrival volume of area el in the i-th time step. The destination supply capacity set is V = {v1, v2, …, v k}.

[0112] The above variables are defined as shown in Table 1 below:

[0113] Table 1

[0114]

[0115]

[0116] Specifically, the goal of the destination prediction task is to learn the user's travel characteristics based on the user's historical travel records, and then predict the user's destination location based on the user's new travel starting point and departure time.

[0117] The present invention converts the destination prediction data set D α The training set and test set are based on The same time order is divided; the feature set of the data set Where u represents the user ID, st represents the departure time, sl represents the departure location, and el represents the arrival location. represents the time feature, ξ represents the user's individual feature. In addition, the set of k candidate destinations is K.

[0118] In terms of prediction algorithms, the destination prediction algorithm is implemented based on the Stacking ensemble learning algorithm. In terms of the selection of base learners, the present invention selects the XGBoost algorithm and the CatBoost algorithm for integration, and selects the Logistic algorithm as the meta-learner, and uses the obtained prediction data set as the feature for the second-level training. Based on the above concepts, the destination prediction problem can be defined as:

[0119]

[0120] Among them, P el Given the above conditions, the probability that the destination of this trip is el. Since for k destinations, the Stacking algorithm will generate k probabilities for each travel record in the test set, the probability matrix output by the destination prediction algorithm in this invention is defined as P α , with dimension N test *k.

[0121] In addition, the present invention selects P α The area corresponding to the maximum probability of each row in is taken as the prediction result of the record, and the prediction result of the test set is defined as For the prediction result C, the present invention performs user aggregation according to the destination, and obtains the destination demand capacity set R = {r1, r2, ..., r k}.

[0122] Based on the above results, the present invention performs a weighted operation on the historical travel distribution. For each user u, the present invention extracts the frequency of its arrival at each el in the training set and obtains the historical travel frequency sequence H of each user u After the standardization operation, the historical travel destination probability distribution of each user can be obtained, denoted as P u Then the weighted operation of historical travel distribution can be expressed as the following formula:

[0123]

[0124] Where P * represents the weighted probability distribution matrix of historical travel, λ,μ represent P α ,P u The weight of The operation is to add the probability distributions of corresponding rows in the two probability matrices.

[0125] Specifically, in the above embodiment, the present invention obtains the destination prediction result C, the user's historical travel weighted probability distribution P *, destination demand capacity set R, destination supply capacity set V, now design the destination prediction improvement strategy based on the above variables;

[0126] Among them, the destination prediction improvement strategy uses the supply capacity of the destination area as a limit, limiting the number of users arriving in the area within a certain time period to no more than the destination supply capacity. The destination demand capacity represents the number of demands for all users to reach each destination. For a specified destination, if the predicted demand for users to reach the destination is greater than the predicted supply of the destination, the destination prediction results of some users will be modified according to specific rules. Therefore, the destination prediction improvement strategy can be divided into two steps: identification of demand overflow destination areas and fine-tuning of destination prediction results. The specific method is described as follows.

[0127] First, the present invention identifies the demand overflow destination area. For each el, if R el ≤V el , indicating that the predicted demand of el is less than the predicted supply, then all predicted destinations in the current destination prediction result C are l e Users do not need to change the destination prediction results.

[0128] If R el >V el , indicating that the predicted demand of el is greater than the predicted supply. The present invention calls this type of area a demand overflow destination. It is necessary to adjust the destination of the user whose predicted destination is el and proceed to the second step.

[0129] The second step is to fine-tune the destination prediction results. First, find out P * The probability distribution of all the overflow destinations of the demand is el, and this probability distribution set is defined as Then all u in Sort the probability of reaching el in the sequence and find the one with the lowest probability of reaching el The probability distribution corresponding to u is defined as

[0130] for Change the predicted destination of each u trip to the el corresponding to the next maximum value of its corresponding probability distribution (such as the second largest, third largest, etc.), change the result in C and recalculate R and V. Until the capacity of R in all regions is less than or equal to the capacity of V, define the output prediction result C at this time * This is the final output result of the destination prediction improvement strategy.

[0131] In order to verify the effectiveness of the present invention, the present invention uses the shared bicycle travel records of Beijing for two weeks in May 2017 as the data source for analysis experiments. The travel records of shared bicycles in Beijing mainly include: order number, user number, vehicle number, departure time, starting point longitude and latitude, and end point longitude and latitude. Table 2 shows some travel record data.

[0132] Table 2

[0133]

[0134] Among them, Figure 3 As shown in the figure, it describes the spatial distribution of shared bicycle travel destinations in Beijing in different time periods. The brighter the color of the area in the figure, the greater the passenger flow with the area as the destination. The spatial distribution of the four figures shows that Beijing's shared bicycle destination areas are concentrated in many points and widely distributed, which is closely related to the fact that Beijing has fixed parking spots for shared bicycles.

[0135] The present invention selects 8:00-9:00 as the peak time period and 20:00-21:00 as the off-peak time period.

[0136] in, Figure 3 (a) and (c) show the distribution of travel destinations during the morning peak hours on weekdays and non-workdays in the dataset period. As can be seen from the figure, area 1 is home to a large number of enterprises, administrative agencies, banks, and commercial centers. During the peak hours on weekdays, residents' travel purposes are mostly commuting to work. In area 4, there are many commercial centers and natural parks that can provide residents with places for leisure and entertainment. It can be seen that during the peak hours on non-workdays, residents' travel purposes are mainly leisure and entertainment.

[0137] in, Figure 3 (b) and (d) show the distribution of travel destinations during the off-peak hours on weekdays and non-workdays in the dataset. The evening time period of 20:00-21:00 is when most residents choose to go home. There are many subway lines intersecting in Area 2, Area 3, and Area 5, and there are also a large number of residential areas. The two figures also reflect that some residents choose to return home by subway-shared bicycle travel.

[0138] Among them, Figure 4 The figure shows the distribution of different travel modes involving shared bicycle travel. The horizontal axis represents different travel modes, and the vertical axis represents the number of residents who travel in this mode on a single day. Above the picture is a schematic diagram of different travel modes.

[0139] The midpoint in the diagram represents the starting point or end point of a resident's single-day trip. If the midpoint is blue, it means that the point is the starting point of a single-day trip. The edges represent a trip of the resident. The solid line represents the use of shared bicycles for travel, and the dotted line represents the use of other travel modes for travel. This diagram selects the travel modes chosen by most residents for display. As can be seen from the figure, the common travel modes of residents involving shared bicycles are mostly mixed transportation modes. The strategy of shared bicycles + other travel modes can quickly and economically meet the travel needs of residents. The most popular travel mode involving shared bicycles is the "shared bicycle-other modes-shared bicycle" mode. In Beijing, this travel mode is very common. For the travel mode of taking the subway or bus, the fixed bus stop is often a distance away from the actual destination. Using shared bicycles can quickly complete the journey between the bus stop / subway station and the departure / destination; in addition, the travel modes of mode 2 and mode 3 are the modes of travel that completely use shared bicycles, which are mostly satisfied with the situation of short commuting distance. Mode 4 corresponds to the situation that most people are far from their homes to bus stops or subway stations, so they choose to use shared bikes as the beginning and end of their daily commutes. The remaining travel modes describe shared bike travel in various modes. In general, shared bikes play a key role in solving the last mile problem in urban transportation, providing more possibilities for residents' convenient travel.

[0140] Based on Examples 1-3 of the present invention, the present invention predicts the travel demand of shared bicycles in Beijing. In order to compare and analyze the effectiveness and accuracy of the Transformer model, in terms of algorithms, the present invention selected eight baseline algorithms, including HA, ARIMA, SVR, LSTM, GRU, BiLSTM, LSTM-Attention, and BiLSTM-Attention, for comparative analysis; in terms of data, the present invention selected three representative areas: commercial areas, residential areas, and scenic areas for travel demand prediction, and used MAE, RMSE, and R2 to evaluate the prediction results. The calculation methods of the three evaluation indicators are shown in the following formulas:

[0141]

[0142] Among them, Table 3 shows the three indicators corresponding to the above three types of areas. For these three types of areas, the calculation effect of residential areas is the best under most algorithms; among the selected algorithms, the Transformer algorithm has obtained the best results, and the BiLSTM-Attention algorithm and the HA algorithm have also obtained good results. For the commercial area, the MAE and RMSE of the Transformer algorithm are respectively reduced by 5.31% and 18.55% compared with the optimal model (HA) in the baseline model, and the R2 is increased by 10.88%; for the residential area, the MAE and RMSE of the Transformer algorithm are respectively reduced by 31.34% and 38.34% compared with the optimal model (BiLSTM-Attention) in the baseline model, and the R2 is increased by 18.69%. For the scenic area, the MAE and RMSE of the Transformer algorithm are respectively reduced by 12.66% and 14.37% compared with the optimal model (BiLSTM-Attention) in the baseline model, and the R2 is increased by 11.99%.

[0143] Table 3 Comparison of shared bicycle travel demand prediction results of different models in different functional areas

[0144]

[0145] Figure 5 The real data of commercial areas, residential areas and scenic areas, LSTM prediction results, GRU prediction results and Transformer prediction results were selected for visualization. Figure 5 (a) represents the forecast results of the commercial area. Figure 5 (b) represents the prediction results of residential areas. Figure 5 Middle (c) represents the prediction results of scenic areas.

[0146] It can be seen from the present invention that the travel demand in residential areas has stronger bimodal characteristics, periodicity and relatively small volatility, and such data characteristics can obtain better prediction results; while the regional characteristics corresponding to commercial areas and scenic areas also lead to large fluctuations in the shared bicycle passenger flow, and the periodicity is not obvious, so the prediction effect is poor.

[0147] Table 4 shows the impact of adding different variables on the Transformer algorithm at different time granularities. The present invention considers historical volume (HV), weather feature (WF), the day of the week (DOW), the hour of the day (HOD), and the POI feature (POI) of the selected area, and conducts ablation experiments based on the above features at different time granularities. It can be seen that different features and different time granularities have different impacts on the experimental results. In the test results of 30 minutes / weekends, after adding the week feature, the MAE decreased by 8.54%, the RMSE decreased by 15.96%, and the R2 increased by 9.91% compared with the non-addition time, which has a good impact on the prediction results, but the same feature has a poor impact on the 1 hour / working day data. In addition, in the 30-minute / weekend test results, the addition of weather factors increased MAE by 17.97%, RMSE by 15.90%, and R2 by 11.66%. In the 1-hour / weekday test results, the indicators also deteriorated. It can be seen that weather features are poor features for this experiment. Similarly, adding time features on the premise of adding historical passenger flow and week features will make the indicators worse. It can be seen that time features are poor features for this experiment. For the 1-hour / weekday test results, on the premise of adding historical passenger flow, week, and time features, the addition of POI features reduced MAE by 9.45%, RMSE by 7.13%, and R2 by 9.15%. It can be seen that the addition of POI features has a positive impact on the experiment.

[0148] Table 4. Ablation experiment of travel demand prediction

[0149]

[0150] Furthermore, in terms of destination prediction evaluation indicators, the present invention uses four evaluation indicators, Accuracy, Precision, Recall, and F1_score, to evaluate the method of the present invention. The calculation method of the four evaluation indicators is as follows, where TP represents a true positive example, TN represents a true negative example, FP represents a false positive example, and FN represents a false negative example. Since the destination prediction problem is a multi-classification problem, when processing the three evaluation indicators of Precision, Recall, and F1, for each region, all samples in the region are positive classes, and samples in all other regions constitute negative classes, and then Macro averaging is used, that is, averaging is performed in a way that the same weight is given to all categories.

[0151]

[0152] A large grid will only make the starting and ending points of most shared bicycle trips fall into the same area, which will undoubtedly greatly reduce the significance of the experiment; although a grid with too small a side length can more accurately describe the location of the starting and ending points of shared bicycle trips, the problem of too many categories will not only greatly increase the calculation cost, but also cause a decrease in calculation accuracy, and the model is difficult to learn data features. The present invention uses the Stacking algorithm to experiment with data divided into grids of 250m, 500m, 1000m, 2000m and 4000m in size, and the experimental results are shown in Table 5.

[0153] Table 5 The influence of grid size on destination prediction results

[0154]

[0155]

[0156] Through the experimental results, it can be seen that the accuracy of the two cases with a grid size of 250m and 500m is 0.003 and 0.135 respectively. Such low accuracy indicates that the model has not learned the features of the shared bicycle data very well, which may be related to the large number of categories caused by too fine granularity.

[0157] The four indicators of Accuracy, Precision, Recall, and F1_score are 0.804, 0.798, 0.794, and 0.795 when the grid size is 2000m, and 0.872, 0.868, 0.867, and 0.867 when the grid size is 4000m. The four indicators in both cases have reached a very high level, but considering the short average distance of shared bicycle travel, this situation may also be caused by the large grid size. The four indicators of Accuracy, Precision, Recall, and F1_score when the grid size is 1000m are 0.566, 0.554, 0.537, and 0.544, respectively. The calculation results of the four indicators show that the model has a certain generalization ability for the data in this case, and for shared bicycle travel, the grid size of 1000m also meets the characteristics that most of its trips are short-distance trips. Therefore, the present invention adopts a grid size of 1000m*1000m to divide the research area into grids.

[0158] Table 6 shows the calculation results of the Stacking algorithm and the prediction improvement strategy based on user travel behavior under different weights of user historical probability distribution. When the prediction improvement strategy based on the user travel behavior destination is not performed, the accuracy of the algorithm is 0.566, the precision is 0.554, the recall is 0.537, and the F1_score is 0.544. After the probability distribution output by the Stacking algorithm is weighted with different weights with the user's historical travel probability distribution, the calculation results also change accordingly. It can be seen that the calculation indicators obtained by using only the probability distribution of the Stacking algorithm, the weight of the user's historical travel probability distribution is 80%, and the calculation indicators obtained by using only the user's historical travel probability distribution are lower than the calculation indicators of the Stacking algorithm, while the calculation indicators of the user's historical travel probability distribution weight at 20%, 40%, and 60% are better than those of the Stacking algorithm. Among them, when the weight is 60%, it is the best, and the four calculation indicators are improved by 34.8%, 26.2%, 28.1%, and 27.4% respectively compared with the case when the destination prediction improvement strategy is not performed.

[0159] Table 6 The impact of different user historical travel probability distribution weights on destination prediction results

[0160]

[0161]

[0162] From the experimental results in Table 6, it can be seen that the intervention of the user's historical travel probability distribution has a significant improvement in the accuracy of the destination prediction problem. However, it can also be seen that when the user's historical travel probability distribution is used completely to improve the destination prediction, it cannot achieve the effect of using the machine learning algorithm alone. Therefore, the features extracted by the machine learning algorithm from a large number of data sets and the results obtained are also crucial to this problem. How to combine the two probability distributions has become the key to improving the destination prediction algorithm.

[0163] Table 7 The impact of two improvement strategies on destination prediction accuracy under different spatiotemporal distributions

[0164]

[0165]

[0166] Table 7 shows the impact of two improvement strategies on the prediction accuracy of different spatiotemporal distributions, where the improvement before refers to the calculation result index of the prediction using only the Stacking algorithm; Method 1 refers to the case where the historical travel distribution is not added, and the probability distribution output by the Stacking algorithm is directly used as the destination prediction improvement strategy; Method 2 refers to the weighted sum of the historical travel distribution and the probability distribution output by the Stacking algorithm as the input destination prediction improvement strategy, where the weight of the historical travel probability distribution is 60%. In terms of spatiotemporal distribution, the present invention selects travel records with three types of areas in the target area, namely commercial areas, residential areas, and scenic areas, as the starting points, and calculates the destination prediction result indicators for working days, non-working days, peak hours, and off-peak hours.

[0167] From the table, we can see that compared with the non-improvement strategy, the average accuracy of method 1 in commercial areas is reduced by 5.10%, the average accuracy in residential areas is reduced by 3.80%, and the average accuracy in scenic areas is reduced by 4.98%. It can be seen that method 1 cannot improve the destination prediction results. Compared with before the improvement, many calculation indicators of method 2 have been improved, which can also prove the importance of historical travel probability distribution for the destination prediction improvement strategy proposed by the present invention.

[0168] For method 2, the prediction results of the peak hours on weekdays are the best in all three types of areas. Compared with before the improvement, the accuracy of the commercial area increased by 25.90%, the accuracy of the residential area increased by 24.16%, and the accuracy of the scenic area increased by 27.11%. This result is related to the regularity of residents' travel during the peak hours on weekdays. During the morning peak hours on weekdays, most residents' travel destinations are places of study and work, while during the evening peak hours, most of them are in residential areas. In addition, during the peak hours on weekdays, users who frequently use shared bicycles are mostly regular. The prediction effect of the off-peak hours on non-weekdays is the worst among the four times. The accuracy of the commercial area increased by 47.76%, the accuracy of the residential area increased by 40.12%, and the accuracy of the scenic area increased by 42.59%. This result may be due to the fact that the travel needs of residents during this period are often random, and the algorithm cannot fit and predict the data well. However, in terms of the improvement effect, the improvement ratio of non-working days and off-peak periods with poor prediction accuracy is much greater than that of working days and peak periods with high prediction accuracy. This phenomenon also shows that the prediction improvement strategy proposed in the present invention can effectively improve the algorithm accuracy when the prediction accuracy is poor, and use the information contained in the probability matrix constructed by the user's historical travel distribution to make up for the defect of insufficient generalization performance of the algorithm.

Claims

1. A method for predicting the destination of a shared bicycle based on user travel behavior, characterized by: The steps include: S10: Obtaining the travel demand forecast information of the user's macro-region, which is used to input the user's historical time period's emerging demand information to obtain the user's future time period's travel demand information; S20: Obtaining information for predicting the travel destination of micro individuals; S30: Obtain prediction improvement information of the user's macro travel demand based on the travel demand prediction information of the user's macro region.

2. The method for predicting a shared bicycle destination based on user travel behavior according to claim 1, characterized in that: S10 includes: S11: Obtain a set of model parameters to achieve the minimum error between the predicted value and the true value, and obtain it in the following way: Among them, for a given area l, the travel demand in the time period of time t is expressed as X l,t , the feature of region l in this time period is set to W l,t , H is the historical time step, and P is the predicted future time step; S12: Mark the relative position or absolute position information of the travel demand sequence by using a coding method, and use the sine function and cosine function in the following coding method: Among them, pos represents the position of the travel demand of a single time step in the sequence, i represents the dimension of the position encoding, and d represents the dimension of the model input; S13: Using encoder and decoder; S14: Use self-attention to calculate the dependencies and weights between different positions in the input travel demand sequence, and establish the dependencies between elements by calculating the attention weights. The calculation formula is as follows: Where Q represents the query matrix, K represents the key matrix, V represents the value matrix, and d k The dimension representing multi-head attention; Among them, the multi-head attention mechanism is composed of the self-attention mechanism. The multi-head attention mechanism allows the model to pay attention to information from different representation subspaces at different positions; the calculation formula is as follows: MutiHead(Q,K,V)=Concat(head1,…,head n )W O in, and They represent the query vector, key vector, and value vector after transformation by the weight matrix, head i represents the output of the i-th attention head.

3. The method for predicting a shared bicycle destination based on user travel behavior according to claim 2, characterized in that: S20 includes using the XGBoost algorithm and the CatBoost algorithm as base learners in the Stacking algorithm to predict the travel destination of shared bicycles.

4. The method for predicting a shared bicycle destination based on user travel behavior according to claim 3 is characterized in that: The CatBoost algorithm includes: S21: Randomly arrange the entire data set; S22: For each sample, calculate the average label value of the data of the same category that have appeared in the data sequence, and use it as the numerical categorical feature of the sample.

5. The method for predicting a shared bicycle destination based on user travel behavior according to claim 4 is characterized in that: The stacking method adopts the k-fold cross validation method when training data; Let D = {(x i,j ,y j ), i=1…P, j=1…N} is the original data set, where x i,j represents the i-th feature of the j-th sample, y j is the label of the jth sample, and D is divided into training set D according to a certain ratio train ={X train ,Y train } and test set D test ={X test ,Y test }; Assume that the first layer has base learners BC1, BC2…BC n , divide the training set into k parts evenly to obtain the data set D train1 ,D train2 …,D traink , select one of them as the validation set in turn, and input the remaining k-1 pieces of data as the training set to the base learner for training; For any base learner BC t ,t=1,2,...,n, k sub-models will be obtained during training, and k groups of verification values ​​will also be obtained. Combining these verification values ​​in order will obtain a data set Vali_Prediction with the same label dimension as the original training set t ; Set the test set D test Input to BC t Among the k sub-models obtained through training, the average of these k prediction results is calculated to obtain a dataset Prediction with the same label dimension as the original test set. t ; Vali_Prediction t By horizontal splicing, we can get a feature matrix VP with a feature dimension of n, which is consistent with Y train Together as a training data set input meta-learner for training; Prediction t By horizontal splicing, we can get a feature matrix P with a feature dimension of n, which is similar to Y test Together they are used as a test data set to input the meta-learner for testing.

6. The method for predicting a shared bicycle destination based on user travel behavior according to claim 5, characterized in that: S30 includes: S31: Obtaining macro-regional travel demand forecast and regional supply capacity aggregation information; S32: Based on micro-individual travel destination prediction and historical travel distribution weighting; S33: Develop a destination prediction improvement strategy.

7. The method for predicting a shared bicycle destination based on user travel behavior according to claim 6, characterized in that: S31 includes building a macro-regional travel demand forecasting dataset 8. The method for predicting a shared bicycle destination based on user travel behavior according to claim 7, characterized in that: S32 includes converting the destination prediction data set D α The training set and test set are based on The same time sequence is used for division; Among them, the feature set of the data set Where u represents the user ID, st represents the departure time, sl represents the departure location, and el represents the arrival location. represents the time feature, ξ represents the user’s individual feature. In addition, the set of k candidate destinations is K; The destination prediction problem is defined as: Among them, P el is the probability that the destination of this trip is el given the above conditions; Since for k destinations, the Stacking algorithm will generate k probabilities for each travel record in the test set, the probability matrix output by the destination prediction algorithm is defined as P α , with dimension N test *k; Select P α The area corresponding to the maximum probability of each row in is taken as the prediction result of the record, and the prediction result of the test set is defined as For the prediction result C, the user cluster is calculated according to the destination, and the destination demand capacity set R = {r1, r2, …, r k }; Perform a weighted operation on the historical travel distribution. For each user u, extract the frequency of reaching each el in the training set, and obtain the historical travel frequency sequence H of each user u After the standardization operation, the historical travel destination probability distribution of each user is obtained, denoted as P u , then the weighted operation of historical travel distribution is expressed as the following formula: Where P* represents the weighted probability distribution matrix of historical travel, λ,μ represent P α ,P u The weight of The operation is to add the probability distributions of corresponding rows in the two probability matrices.

9. The method for predicting a shared bicycle destination based on user travel behavior according to claim 8, characterized in that: S33 includes identifying the demand overflow destination area and adjusting the destination prediction result.

10. A shared bicycle destination prediction system based on user travel behavior, the system being used to implement the shared bicycle destination prediction method based on user travel behavior as described in any one of claims 1 to 9, characterized in that: include: The user's macro-region travel demand prediction module is used to input the user's historical time period's emerging demand information to obtain the user's future time period's travel demand information; Micro-individual travel destination prediction information, used to obtain micro-individual travel destination prediction information; The prediction and improvement module of the user's macro travel demand is used to obtain the prediction and improvement information of the user's macro travel demand based on the travel demand prediction information of the user's macro area.

Citation Information

Cited By

  • User portrait-based resident travel demand prediction method and system

    CN122114557A

  • A method and system for predicting residents' travel demand based on user profiles

    CN122114557B