A method for predicting the number of shared bikes entering and exiting docked bikes based on graph neural networks
By constructing a spatiotemporal graph neural network model based on graph neural networks, combining dynamic graph attention networks and temporal convolutional networks, the problem of the existing technology failing to accurately predict the number of entries and exits of shared bicycle stations is solved, and a more accurate prediction effect is achieved.
Patent Information
- Application Number
- CN202310103289.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-13
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2043-02-13
AI Technical Summary
Existing shared bicycle prediction methods fail to effectively capture the graph structure attributes and historical time series data of shared bicycle stations, resulting in inaccurate predictions and the inability to accurately predict the entry and exit numbers of all shared bicycle stations at the same time.
A graph neural network-based method is adopted. Through the local spatiotemporal information extraction module and the global information extraction module, combined with the dynamic graph attention network and the temporal convolutional network, the local and global spatiotemporal information of shared bicycle stations is captured, and a spatiotemporal graph neural network model is constructed to predict the number of shared bicycles entering and leaving.
The accuracy of the prediction of the number of shared bicycles entering and exiting is improved, and the predicted values of all shared bicycle stations can be output simultaneously, which improves the prediction accuracy and generalization performance of the model.
Smart Images

Figure CN116167512B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of smart transportation-traffic flow prediction, and specifically provides a method for predicting the number of shared bicycles entering and exiting with docking stations based on graph neural networks. Background Art
[0002] Bike-sharing is a convenient and green mode of transportation that has become widely popular worldwide. The complementary nature of bike-sharing and other public transportation can reduce social costs. As of August 2022, 1,880 bike-sharing systems have been deployed in over 50 countries and regions, with over eight million bikes available for consumer use. Due to network marginal effects, more bike-sharing stations further enhance user experience and increase company revenue. Therefore, bike-sharing companies often deploy a large number of stations. For example, as of May 2022, New York's Citi Bike system had 1,627 stations, and Chicago's Divvy Bike system had 1,111 stations. While these numerous stations provide convenience to users, the sheer number of stations and the complex and dynamic relationships between them pose operational challenges for companies. To improve user satisfaction and increase company revenue, bike-sharing system managers need to proactively monitor the number of bikes entering and leaving each station—that is, the expected number of bikes entering and leaving each station over a period of time—to assist in decision-making regarding issues like bike-sharing balance.
[0003] The existing shared bicycle predictions are mainly divided into three categories: cluster-based predictions, grid-based predictions, and station-based predictions. Cluster-based predictions mean that it is impossible to make predictions for each station. Usually, stations are clustered according to attributes, the number of stations is simplified, and the number of entries and exits for each class is predicted. Grid-based predictions, since geographical location is an important feature of shared bicycle predictions, in order to capture the location information of the station time, studies usually divide a city into a grid, and then use models such as convolutional neural networks to extract relevant spatial location factors. For predictions based on a single station, previous studies were unable to directly predict the number of entries and exits for a single station. With the emergence and development of graph neural networks, the relevant information of the scenario can be better captured. The nodes of the graph represent bicycle stations, and the edges of the graph represent the connection between two stations. This method has been applied to capture the spatial relationship between stations and has made progress in station prediction.
[0004] Existing methods have the following shortcomings: 1. Clustering-based prediction methods and grid-based prediction methods do not take into account the graph structure properties of shared bicycle stations, such as the connectivity of stations, the degree properties of stations, etc. At the same time, clustering-based prediction methods and grid-based prediction methods cannot make predictions for all shared bicycle stations; 2. Graph neural network-based prediction methods focus on the locality of the graph and ignore the relationship between the entire shared bicycle system, resulting in inaccurate predictions; 3. The above methods focus on the spatial relationship of shared bicycle stations and focus on extracting spatial information between stations, while ignoring the historical time series data of individual shared bicycle stations, resulting in inaccurate predictions. Summary of the Invention
[0005] In order to address the shortcomings of the above-mentioned existing technologies, the present invention proposes a method for predicting the entry and exit numbers of shared bicycles with docking stations based on graph neural networks, in order to extract local and global spatiotemporal information in the shared bicycle system through a local spatiotemporal information extraction module and a global information extraction module, so as to more accurately predict the number of shared bicycles leaving and entering the station, and help shared bicycle operators to adjust vehicle distribution strategies in a timely manner to ensure a reasonable distribution of shared bicycles.
[0006] In order to achieve the above-mentioned object, the present invention adopts the following technical solutions:
[0007] The method for predicting the number of shared bicycles entering and exiting a docked bicycle based on a graph neural network is characterized by comprising the following steps:
[0008] Step 1: Obtain the inbound and outbound vehicle data of all shared bicycle stations and pre-process them:
[0009] Step 1.1: Obtain the shared bike riding records, and each riding record includes: the initial station, the end station, the start time, and the end time;
[0010] Step 1.2: Construct a graph structure dataset G based on the predicted time interval, where the graph structure data of the tth time interval is recorded as G t =(V t ,A t ,H t ), V t A represents the set of shared bicycle stations at the tth time interval, t Represents the adjacency matrix between each shared bicycle station in the tth time interval; in the tth time interval, if there is a bicycle riding record from shared bicycle station i to shared bicycle station j, then let A t The element a in row i and column j in ij The value is 1, otherwise, let a ij The value is 0; H t represents the characteristics of all shared bicycle stations in the tth time interval, where represents the characteristics of shared bicycle station j in the tth time interval, including: the number of vehicles entering shared bicycle station j and the number of vehicles leaving shared bicycle station j;
[0011] Step 1.3: Set the width of the sliding window to T', and divide the graph structure dataset G into samples through the sliding window to obtain the sample set D = {(X1, Y1), (X2, Y2), ..., (X n ,Y n ),...,(X L ,Y L )}, where (X n ,Y n ) represents the nth sample, X n represents the historical data of the nth sliding window, and X n ={G n,1 ,G n,2 ,...,G n,t ,...,G n,T'}, G n,t =(V t ,A n,t ,H n,t ) represents the historical data X of the nth sliding window n The graph structure data of the t-th time interval in A n,t Indicates the nth historical data X n The adjacency matrix of the t-th time period in , Indicates the nth historical data X n The characteristics of all shared bicycle stations in the t-th time period, N represents the number of shared bicycle stations, Represents the historical data X of the nth sliding window n The characteristics of the shared bicycle station i in the t-th time period; Y n Represents the historical data X of the nth sliding window n The predicted number of vehicles entering and leaving all shared bicycle stations in the n+1th time interval; L represents the total number of samples;
[0012] Step 2: Build a spatiotemporal graph neural network, including: a local spatiotemporal information extraction module, a global information extraction module, and an output layer; wherein the local spatiotemporal information extraction module includes: a dynamic graph attention network and a temporal convolutional network; the global spatiotemporal information extraction module includes: a shared fully connected network and a shared graph neural network;
[0013] Step 2.1: Define the current number of iterations as z, initialize z=1, define the iteration threshold as Z; initialize the parameters in the neural network;
[0014] Step 2.2: The local spatiotemporal information extraction module extracts historical data X of the nth sliding window n Processing, the historical data X of the nth sliding window n The local spatiotemporal characteristics of the shared bicycle stations after update at all time intervals in χ” n ;
[0015] Step 2.3: The global spatiotemporal information extraction module extracts local spatiotemporal features χ" n Process and obtain the historical data X of the nth sliding window n Global spatiotemporal characteristics of
[0016] Step 2.4: The output layer uses formula (13) to output features The dimension is compressed to obtain the historical data X of the nth sliding window n The final output result O n :
[0017]
[0018] In formula (13), W h , are two weight parameters to be learned, b h , are two bias parameters to be learned;
[0019] Step 2.5: Use formula (14) to construct the adaptive objective function Loss, and use the gradient descent algorithm to train the spatiotemporal graph neural network. With the goal of minimizing the loss function, the time backpropagation algorithm is used to optimize and update the parameters in the spatiotemporal graph attention network until z>Z and stop training. In this way, a trained spatiotemporal graph attention network model is obtained, which is used to predict the number of shared bicycles entering and leaving the station in the future time period.
[0020]
[0021] In formula (14), α is a weight parameter.
[0022] The method for predicting the number of docked shared bicycles entering and exiting based on a graph neural network according to the present invention is also characterized in that step 2.2 includes:
[0023] Step 2.2.1: The dynamic graph attention network uses formula (1) to calculate the historical data X of the nth sliding window output by the kth attention head n The attention score between shared bicycle station i and shared bicycle station j in the tth time period Thus, the historical data X of the nth sliding window output by the kth attention head is obtained nThe attention score matrix between all shared bicycle stations in the tth time period
[0024]
[0025] In formula (1), a is the parameter to be learned, a T represents the transpose of a, LeakyReLU is a nonlinear activation function, W k represents the parameters to be learned for the kth attention head, ‖ represents the concatenation operation, represents the set of shared bicycle stations in the t-th time interval under the n-th sliding window; k = 1, 2, .., K, K represents the number of attention heads;
[0026] Step 2.2.2: The dynamic graph attention network uses formula (2) to calculate the historical data X of the n-th sliding window n Characteristics of shared bicycle station i in the tth time period Update and obtain the updated features of shared bicycle station i in the tth time period Thus, we can obtain the attention feature set of all shared bicycle stations
[0027]
[0028] In formula (2), represents the set of shared bicycle stations adjacent to shared bicycle station i; σ represents the Sigmoid activation function;
[0029] Step 2.2.3: The temporal convolutional network first extracts historical data X from the nth sliding window n Extract the features of shared bicycle stations at all time intervals χ n ={H n,1 ,H n,2 ,...,H n,t ,...,H n,T'}, It is time series data, F=2 represents the feature dimension, including: outbound quantity feature and inbound quantity feature;
[0030] Step 2.2.4: The temporal convolutional network integrates the shared bicycle station features χ at all time intervals n Divided into inbound vehicle characteristics and outbound vehicle characteristics And use formula (3) and formula (4) to calculate the inbound vehicle characteristics I n and outbound vehicle characteristics O n Perform convolution operation to obtain the convolved inbound vehicle feature I' n and outbound vehicle characteristics O'n :
[0031] I' n =I n*d Θ I (3)
[0032] O' n =O n*d Θ O (4)
[0033] In formula (3) and formula (4), * d represents the convolution operation, Θ I ,Θ O Represent the inbound and outbound parameters of the convolution operation respectively;
[0034] Step 2.2.5: The local spatiotemporal information extraction module uses formula (5) to convert I' n , O' n , H' n,t Splice in the last dimension to get the historical data X of the nth sliding window n The local spatiotemporal characteristics of the shared bicycle stations after update at all time intervals in χ” n ={H” n,1 ,H” n,2 ,...,H” n,t ,...,H” n,T'}, where H” n,t Represents the historical data X of the nth sliding window n The local spatiotemporal characteristics of the shared bicycle station after update at the t-th time interval in :
[0035] χ” n =Concat(I" n ,O” n ,H' n,t ) (5)
[0036] In formula (5), Concat(·) represents the concatenation operation.
[0037] The step 2.3 includes:
[0038] Step 2.3.1: The shared fully connected network uses formula (6) to input local spatiotemporal features χ” n Perform convolution processing to obtain the historical data X of the nth sliding window n Fully connected features
[0039]
[0040] In formula (6), Represents the convolution kernel parameters;
[0041] Step 2.3.2: The shared graph neural network uses formula (7) to input the local spatiotemporal feature χ” n Perform linear transformation and obtain the historical data X of the nth sliding window n The linearly transformed characteristic χ"' n :
[0042] χ”' n =χ” n W (7)
[0043] In formula (7), W is the linear weight;
[0044] Step 2.3.2: The shared graph neural network uses formula (8) to obtain the historical data X of the nth sliding window n The total adjacency matrix of
[0045]
[0046] In formula (8), Represents the exclusive OR operation;
[0047] Step 2.3.3: The shared graph neural network uses equations (9) and (10) to obtain the historical data X of the nth sliding window n Updated inbound features of all shared bike stations and updated outbound features
[0048]
[0049]
[0050] In formula (9) and formula (10), ⊙ represents the dot product operation, and Mean(·,dim=d) represents the average value in dimension d;
[0051] Step 2.3.4: The shared graph neural network uses formula (11) to obtain the historical data X of the nth sliding window n Global spatial characteristics of
[0052]
[0053] In formula (11), Φ in ,Φ out Represent the inbound convolution parameters and outbound convolution parameters respectively, Concat(·) represents the concatenation operation, * 2d Represents a 2D convolution operation;
[0054] Step 2.3.5: The global spatiotemporal information extraction module uses formula (12) to obtain the historical data X of the nth sliding window n Global spatiotemporal characteristics of
[0055]
[0056] An electronic device of the present invention includes a memory and a processor, and is characterized in that the memory is used to store a program that supports the processor to execute any of the methods for predicting the entry and exit numbers of shared bicycles with docking stations, and the processor is configured to execute the program stored in the memory.
[0057] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, executes any step of the method for predicting the number of entry and exit of docked shared bicycles.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] 1. This paper designs a dynamic graph attention network (DGAN) that utilizes multiple graph attention networks. The DGAN can capture local spatial dependencies between shared bike stations and dynamic information from different station graphs in historical time slots. The temporal convolutional network (TCN) utilizes layer-by-layer and dilated convolutions to capture long-term temporal information. Combining the DGAN and TCN effectively captures local and dynamic temporal and spatial information, helping to improve the model's prediction accuracy.
[0060] 2. This invention constructs a global information extraction layer to capture local spatial dependencies and short-term temporal information. The global information extraction layer is composed of a shared fully connected network and a shared graph neural network. The shared fully connected network uses a convolutional network to capture temporal dependencies between adjacent time slots. The shared graph neural network is used to capture global spatial dependencies. Combining the shared fully connected network and the shared graph neural network effectively captures global temporal and spatial information, helping to improve the model's prediction accuracy.
[0061] 3. This invention can simultaneously output predicted values for all shared bike stations in a shared bike system. It outperformed all baseline models on two large-scale real-world datasets with different time slots, demonstrating its effectiveness. Furthermore, extended experiments were conducted on both datasets during the morning and evening rush hours. The results demonstrate the accuracy of the predictions. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 This is a network structure diagram of the present invention;
[0063] Figure 2 This is an expanded diagram of the shared graph neural network layer of the present invention;
[0064] Figure 3 This is the expanded diagram of the shared fully connected layer of the present invention;
[0065] Figure 4 It is a flowchart of the overall process of the present invention. DETAILED DESCRIPTION
[0066] In this embodiment, a data-driven adaptive shared bicycle prediction method is used to build a shared bicycle prediction system based on a graph neural network by modeling the entry and exit data of all shared bicycle stations in the city and using the graph attention neural network and TCN time series prediction module. The system constructs a local spatiotemporal information extraction module and a global information extraction module to dynamically capture the connection between shared bicycle stations from the vehicle interaction data between all shared bicycle stations in the city, and predict the number of shared bicycles entering and exiting the station at each station within a certain time interval in the future. Specifically, if Figure 4 The specific steps are as follows:
[0067] Step 1: Obtain the inbound and outbound vehicle data of all shared bicycle stations and pre-process them:
[0068] Step 1.1: Obtain the shared bike riding records, and each riding record includes: the initial station, the end station, the start time, and the end time;
[0069] Step 1.2: Construct a graph structure dataset G based on the predicted time interval, where the graph structure data of the tth time interval is recorded as G t =(V t ,A t ,H t ), V t A represents the set of shared bicycle stations at the tth time interval, t Represents the adjacency matrix between each shared bicycle station in the tth time interval; in the tth time interval, if there is a bicycle riding record from shared bicycle station i to shared bicycle station j, then let A t The element a in row i and column j in ij The value is 1, otherwise, let a ij The value is 0; H t represents the characteristics of all shared bicycle stations in the tth time interval, where represents the characteristics of shared bike station j in the tth time interval, including the number of vehicles entering and leaving shared bike station j. The shared bike system data used in this example comes from the Capital Bike Shared System in Washington, D.C. From January 1, 2021 to June 1, 2022, there were 3,259,791 ride records in the Capital system, which has N = 362 shared bike stations. t = 1 hour is considered as an interval.
[0070] Step 1.3: Set the width of the sliding window to T', and use the sliding window to divide the graph structure dataset G into samples, and obtain the sample set D = {(X1, Y1), (X2, Y2), ..., (X n ,Y n ),...,(X L ,Y L )}, where (X n ,Y n ) represents the nth sample, X n represents the historical data of the nth sliding window, and X n ={G n,1 ,G n,2 ,...,G n,t ,...,G n,T'}, G n,t =(V t ,A n,t ,H n,t ) represents the historical data X of the nth sliding window n The graph structure data of the t-th time interval in A n,t Indicates the nth historical data X n The adjacency matrix of the t-th time period in , Indicates the nth historical data X n The characteristics of all shared bicycle stations in the t-th time period, N represents the number of shared bicycle stations, Represents the historical data X of the nth sliding window n The characteristics of the shared bicycle station i in the t-th time period; Y n Represents the historical data X of the nth sliding window n The predicted number of vehicles entering and leaving all shared bicycle stations in the n+1th time interval; L represents the total number of samples;
[0071] In this example, T' = 8 indicates that the number of shared bikes entering and leaving the station during the ninth day is predicted using the data from the same eight days preceding the prediction period. 70% of the data in the dataset is used for training, 20% for validating the model, and 10% for testing.
[0072] Step 2: If Figure 1 As shown, a spatiotemporal graph neural network is constructed, including: a local spatiotemporal information extraction module, a global information extraction module, and an output layer; wherein the local spatiotemporal information extraction module includes: a dynamic graph attention network and a temporal convolutional network; the global spatiotemporal information extraction module includes: a shared fully connected network and a shared graph neural network;
[0073] Step 2.1: Define the current number of iterations as z and initialize z = 1. Define the iteration threshold as Z. Initialize the parameters in the neural network. In this example, define the maximum threshold Z = 200.
[0074] Step 2.2: local spatiotemporal information extraction module processing;
[0075] Step 2.2.1: In order to improve the generalization performance of the model, the present invention uses a multi-head attention mechanism. The dynamic graph attention network uses formula (1) to calculate the historical data X of the n-th sliding window output by the k-th attention head n The attention score between shared bicycle station i and shared bicycle station j in the tth time period Thus, the historical data X of the nth sliding window output by the kth attention head is obtained n The attention score matrix between all shared bicycle stations in the tth time period
[0076]
[0077] In formula (1), a is the parameter to be learned, a T represents the transpose of a, LeakyReLU is a nonlinear activation function, W k represents the parameters to be learned for the kth attention head, ‖ represents the concatenation operation, represents the set of shared bicycle stations in the t-th time interval under the n-th sliding window; k = 1, 2, .., K, K represents the number of attention heads;
[0078] Step 2.2.2: Dynamic graph attention network uses formula (2) to calculate the historical data X of the n-th sliding window n Characteristics of shared bicycle station i in the tth time period Update and obtain the updated features of shared bicycle station i in the tth time period Thus, we can obtain the feature set of all shared bicycle stations after using the attention mechanism to update
[0079]
[0080] In formula (2), represents the set of shared bicycle stations adjacent to shared bicycle station i; σ represents the Sigmoid activation function;
[0081] Step 2.2.3: The temporal convolutional network abandons the original recurrent neural network to capture sequence information, and instead adopts causal convolution to capture sequence information, which greatly improves the running speed of the model and alleviates the problem of parameter disappearance and parameter explosion. The temporal convolutional network first starts from the historical data X of the nth sliding window. n Extract the features of shared bicycle stations at all time intervals χ n ={H n,1 ,H n,2 ,...,H n,t ,...,H n,T}, It is time series data, F=2 represents the feature dimension, including: outbound quantity feature and inbound quantity feature;
[0082] Step 2.2.4: Temporal convolutional network combines the shared bicycle station features χ at all time intervals n Divided into inbound vehicle characteristics and outbound vehicle characteristics And use formula (3) and formula (4) to calculate the inbound vehicle characteristics I n and outbound vehicle characteristics O n Perform convolution operation to obtain the convolved inbound vehicle feature I' n and outbound vehicle characteristics O' n :
[0083] I' n =I n*d Θ I (3)
[0084] O' n =O n*d Θ O (4)
[0085] In formula (3) and formula (4), * d represents the convolution operation, Θ I ,Θ O Represent the inbound and outbound parameters of the convolution operation respectively.
[0086] Step 2.2.5: The local spatiotemporal information extraction module uses formula (5) to convert I' n , O' n , H' n,t Splice in the last dimension to get the historical data X of the nth sliding window n The local spatiotemporal characteristics of the shared bicycle stations after update at all time intervals in χ” n={H” n,1 ,H” n,2 ,...,H” n,t ,...,H” n,T'}, where H” n,t Represents the historical data X of the nth sliding window n The local spatiotemporal characteristics of the shared bicycle station after update at the t-th time interval in :
[0087] χ” n =Concat(I′ n ,O′ n ,H' n,t ) (5)
[0088] In formula (5), Concat(·) represents the concatenation operation;
[0089] Step 2.3: Global spatiotemporal information extraction module processing:
[0090] Step 2.3.1: Shared fully connected network processing flow is as follows Figure 3 As shown, use formula (6) to input feature χ” n Perform convolution processing. Using convolution operation can reduce model parameters, improve model training speed, and obtain the historical data X of the nth sliding window n Fully connected features
[0091]
[0092] In formula (6), Θ represents the convolution kernel parameter, As the output of the shared fully connected layer.
[0093] Step 2.3.2: The shared graph neural network processing flow in the global spatiotemporal information extraction module is as follows Figure 2 As shown, the local spatiotemporal feature χ" of the input is obtained using formula (7). n Perform linear transformation and obtain the historical data X of the nth sliding window n The linearly transformed characteristic χ"' n :
[0094] χ”' n =χ” n W (7)
[0095] In formula (7), W is the linear weight;
[0096] Step 2.3.2: The shared graph neural network uses formula (8) to obtain the historical data X of the nth sliding window n The total adjacency matrix of
[0097]
[0098] In formula (8), Represents the exclusive OR operation;
[0099] Step 2.3.3: The shared graph neural network uses equations (9) and (10) to obtain the historical data X of the n-th sliding window respectively. n Updated inbound features of all shared bike stations and updated outbound features
[0100]
[0101]
[0102] In formula (9) and formula (10), ⊙ represents the dot product operation, and Mean(·,dim=d) represents the average value in dimension d;
[0103] Step 2.3.4: The shared graph neural network in the global spatiotemporal information extraction module uses formula (11) to extract the global spatial information and obtain the updated features of the nth sample
[0104]
[0105] In formula (11), Φ in ,Φ out Represent the inbound convolution parameters and outbound convolution parameters respectively, Concat(·) represents the concatenation operation, * 2d Represents a 2D convolution operation;
[0106] Step 2.3.5: The global spatiotemporal information extraction module uses formula (12) to extract the output of the shared graph neural layer and shared fully connected layer output Perform splicing operations to obtain the output features of the global spatiotemporal information extraction module
[0107]
[0108] Step 2.4: Output layer processing:
[0109] Step 2.4.1: The output layer uses formula (13) to output features The dimension is compressed to obtain the historical data X of the nth sliding window n The final output result O n :
[0110]
[0111] In formula (13), Wh , W o are two weight parameters to be learned, b h , b o Two bias parameters to be learned;
[0112] In step 2.5, using MAE as the loss function can easily lead to the model converging to the average value of the output data; using MSE as the loss function can easily affect the convergence of the model by outliers. Since the shared bicycle dataset is too sparse, the adaptive objective function Loss is constructed using formula (14), and the gradient descent algorithm is used to train the spatiotemporal graph neural network. With the goal of minimizing the loss function, the parameters in the spatiotemporal graph attention network are optimized and updated through the time back propagation algorithm until z>Z is reached and the training is stopped. Thus, a trained spatiotemporal graph attention network model is obtained, which is used to predict the number of shared bicycles entering and leaving the station in the future time period.
[0113]
[0114] In formula (14), α is a weight parameter. In this example, α is generally set to 0.5.
[0115] In this embodiment, an electronic device includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the above method, and the processor is configured to execute the program stored in the memory.
[0116] In this embodiment, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are executed.
[0117] This example uses the shared bicycle systems of two foreign cities for real-time prediction: the Capital Bike system in Washington, D.C., and the Bay Bike system in California. It compares the predictions with three machine learning methods: moving average (HA), time period moving average (HA_s), and autoregressive integrated moving average (ARIMA), as well as three deep learning methods: TCN, BiLSTM, ConvLSTM, ASTGCN, and LSGCN. The experimental results are as follows:
[0118] Table 1: Comparison of model test results
[0119]
[0120] As shown in Table 1, the graph neural network-based model for predicting the number of docked shared bikes entering and exiting stations was tested on the Capital and Bay datasets at three different time intervals: 20 minutes, 40 minutes, and 60 minutes. Overall, the experimental results of this paper show improvements in both MAE (mean absolute error) and RMSE (root mean square error), demonstrating the effectiveness of the model in predicting the number of vehicles entering and exiting actual shared bike stations.
[0121] To further verify the effectiveness of the present invention, this example was tested on the Capital Bike system in Washington, D.C., and the Bay Bike system in California during the morning and evening rush hours. The experimental results are as follows:
[0122] Table 2: Comparison of model test results
[0123]
[0124] As shown in Table 2, the graph neural network-based model for predicting the number of docked shared bikes entering and exiting stations was tested during the morning and evening rush hours of the Capital and Bay datasets. The experimental results show significant improvements in both MAE (mean absolute error) and RMSE (root mean square error), demonstrating the model's effectiveness in predicting the number of vehicles entering and exiting actual shared bike stations.
Claims
1. A method for predicting the number of shared bikes entering and exiting a docked bike system based on a graph neural network, characterized in that: The following steps are involved: Step 1: Obtain the inbound and outbound vehicle data of all shared bicycle stations and pre-process them: Step 1.1: Obtain the shared bike riding records, and each riding record includes: the initial station, the end station, the start time, and the end time; Step 1.2: Construct a graph structure dataset G based on the predicted time interval, where the graph structure data of the tth time interval is recorded as , represents the set of shared bicycle stations at the t-th time interval, represents the adjacency matrix between the shared bicycle stations in the tth time interval; in the tth time interval, if there is a bicycle riding record from shared bicycle station i to shared bicycle station j, then let The element in row i and column j in The value is 1, otherwise, The value is 0; represents the characteristics of all shared bicycle stations in the tth time interval, where represents the characteristics of shared bicycle station j in the tth time interval, including: the number of vehicles entering shared bicycle station j and the number of vehicles leaving shared bicycle station j; Step 1.3: Set the width of the sliding window to T', and use the sliding window to divide the graph structure dataset G into samples to obtain the sample set ,in, represents the nth sample, represents the historical data of the nth sliding window, and , Represents the historical data of the nth sliding window The graph structure data of the t-th time interval in , Indicates the nth historical data The adjacency matrix of the t-th time period in , Indicates the nth historical data The characteristics of all shared bicycle stations in the t-th time period, Indicates the number of shared bicycle stations, Represents the historical data of the nth sliding window The characteristics of shared bicycle station i in the t-th time period; Represents the historical data of the nth sliding window The predicted number of vehicles entering and leaving all shared bicycle stations in the n+1th time interval; represents the total number of samples; Step 2: Build a spatiotemporal graph neural network, including: a local spatiotemporal information extraction module, a global spatiotemporal information extraction module, and an output layer; wherein the local spatiotemporal information extraction module includes: a dynamic graph attention network and a temporal convolutional network; the global spatiotemporal information extraction module includes: a shared fully connected network and a shared graph neural network; Step 2.1: Define the current number of iterations as z, initialize z=1, define the iteration threshold as Z; initialize the parameters in the neural network; Step 2.2: The local spatiotemporal information extraction module extracts historical data from the nth sliding window. Process the historical data of the nth sliding window The local spatiotemporal characteristics of shared bicycle stations after update at all time intervals ; Step 2.3: The global spatiotemporal information extraction module extracts local spatiotemporal features Process and obtain the historical data of the nth sliding window Global spatiotemporal characteristics of ; Step 2.4: The output layer uses formula (13) to output features The dimension is compressed to obtain the historical data of the nth sliding window The final output result : (13) In formula (13), are two weight parameters to be learned, are two bias parameters to be learned; represents a nonlinear activation function; Step 2.5: Use Equation (14) to construct the adaptive objective function , and uses the gradient descent algorithm to train the spatiotemporal graph neural network. With the goal of minimizing the loss function, the time backpropagation algorithm is used to optimize and update the parameters in the spatiotemporal graph attention network until z>Z and the training is stopped. In this way, a trained spatiotemporal graph attention network model is obtained, which is used to predict the number of shared bicycles entering and leaving the station in the future time period; (14) In formula (14), is the weight parameter.
2. The method for predicting the number of shared bikes entering and exiting a docked bike based on a graph neural network according to claim 1, characterized in that: The step 2.2 includes: Step 2.2.1: The dynamic graph attention network uses formula (1) to calculate the first The historical data of the nth sliding window output by the attention head The attention score between shared bicycle station i and shared bicycle station j in the tth time period , thus obtaining the The historical data of the nth sliding window output by the attention head The attention score matrix between all shared bicycle stations in the tth time period : (1) In formula (1), are the parameters to be learned, express The transpose of is a nonlinear activation function, represents the parameters to be learned for the kth attention head, Represents a splicing operation, represents the set of shared bicycle stations in the t-th time interval under the n-th sliding window; , K represents the number of attention heads; Step 2.2.2: The dynamic graph attention network uses formula (2) to calculate the historical data of the n-th sliding window Characteristics of shared bicycle station i in the tth time period Update and obtain the updated features of shared bicycle station i in the tth time period , thus obtaining the attention feature set of all shared bicycle stations : (2) In formula (2), represents the set of shared bicycle stations adjacent to shared bicycle station i; Represents the Sigmoid activation function; Step 2.2.3: The temporal convolutional network first extracts historical data from the nth sliding window Extract the features of shared bicycle stations at all time intervals , is time series data, Represents feature dimensions, including outbound quantity features and inbound quantity features; Step 2.2.4: The temporal convolutional network combines the shared bicycle station features of all time intervals Divided into inbound vehicle characteristics and outbound vehicle characteristics , and use formula (3) and formula (4) to respectively calculate the characteristics of the incoming vehicles and outbound vehicle characteristics Perform convolution operation to obtain the convolved inbound vehicle features and outbound vehicle characteristics : (3) (4) In formula (3) and formula (4), represents the convolution operation, , Represent the inbound and outbound parameters of the convolution operation respectively; Step 2.2.5: The local spatiotemporal information extraction module uses formula (5) to convert , , Splice in the last dimension to get the historical data of the nth sliding window The local spatiotemporal characteristics of shared bicycle stations after update at all time intervals ,in, Represents the historical data of the nth sliding window The local spatiotemporal characteristics of the shared bicycle station after update at the t-th time interval in : (5) In formula (5), Represents a splicing operation.
3. The method for predicting the number of shared bikes entering and exiting a docked bike based on a graph neural network according to claim 1, characterized in that: The step 2.3 includes: Step 2.3.1: The shared fully connected network uses formula (6) to transform the local spatiotemporal features of the input Perform convolution processing to obtain the historical data of the nth sliding window Fully connected features : (6) In formula (6), Represents the convolution kernel parameters; Step 2.3.2: The shared graph neural network uses formula (7) to calculate the local spatiotemporal features of the input Perform linear transformation and obtain the historical data of the nth sliding window The linearly transformed features : (7) In formula (7), is a linear weight; Step 2.3.2: The shared graph neural network uses formula (8) to obtain the historical data of the nth sliding window The total adjacency matrix of : (8) In formula (8), Represents the exclusive OR operation; Step 2.3.3: The shared graph neural network uses equations (9) and (10) to obtain the historical data of the nth sliding window Updated entry characteristics of all shared bike stations in and updated outbound features : (9) (10) In formula (9) and formula (10), represents the dot product operation, Indicates finding the average value over dimension d; Step 2.3.4: The shared graph neural network uses formula (11) to obtain the historical data of the nth sliding window Global spatial characteristics of : (11) In formula (11), denote the inbound convolution parameters and outbound convolution parameters respectively, Represents a splicing operation, Represents a 2D convolution operation; Step 2.3.5: The global spatiotemporal information extraction module uses formula (12) to obtain the historical data of the nth sliding window Global spatiotemporal characteristics of : (12)。 4. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store a program that supports the processor to execute the method for predicting the entry and exit number of docked shared bicycles as described in any one of claims 1-3, and the processor is configured to execute the program stored in the memory.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for predicting the number of entry and exit of docked shared bicycles described in any one of claims 1 to 3 are executed.
Citation Information
Patent Citations
Passenger flow distribution prediction method and device based on multi-view passenger flow change trend modeling
CN114169632A
Commodity purchase prediction method and system based on user dynamic click module graph
CN114862477A