A context-aware graph recurrent network based bicycle flow prediction method

By using a context-aware graph recursive network to cluster bicycle parking stations into functional areas, dynamically modeling spatiotemporal correlations and integrating external information, the problem of spatiotemporal correlations and the influence of external factors in bicycle traffic prediction is solved, achieving higher prediction accuracy and real-time scheduling support.

CN115204477BActive Publication Date: 2026-03-20BEIHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-30
Publication Date
2026-03-20

Smart Images

  • Figure CN115204477B_ABST
    Figure CN115204477B_ABST
Patent Text Reader

Abstract

The application provides a bicycle flow prediction method of a context-aware graph recurrent network, which is used for intelligent traffic management. The application uses a pattern constraint clustering method to cluster independent stops into groups, each stop group is a functional area, the bicycle flow in and out of each area stop is counted, and weather data is obtained as external information; a context-aware graph recurrent network is used to construct a bicycle flow prediction model based on an area, which includes an encoder and a decoder composed of context-aware graph recurrent units, each unit integrates a context embedding layer and an adaptive graph generator into a gated recurrent unit (GRU), and replaces a linear transformation layer in the GRU with an adaptive graph convolution to form; the trained prediction model is deployed on a shared bicycle management system. The method improves the accuracy of bicycle flow prediction, can effectively resist flow fluctuations caused by external factors, and is beneficial to the development of a bicycle dispatching system and strategy making.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of spatio-temporal data mining and intelligent transportation, and relates to a traffic flow prediction method, in particular to a bicycle flow prediction method of a context-aware graph recurrent network (CAGRN). BACKGROUND

[0002] In recent years, the shared bicycle system has been widely used in urban public transportation due to its convenience and environmental protection. The shared bicycle system includes shared bicycles and shared infrastructure (i.e. parking piles) for renting and returning bicycles. Users can rent or return public bicycles at self-service stations throughout the city, providing a convenient transportation method for commuters, and the shared bicycle system is hailed as the best solution for the "last mile" of urban transportation. As a representative of the intelligent transportation system (ITS), effective allocation of shared bicycle resources to improve system service quality is one of the key problems. However, due to the high frequency and randomness of bicycle use throughout the city, it is often easy to cause imbalance between supply and demand of shared bicycle stations. With the use of users, it is often easy to have "shortage" and "surplus" of shared bicycle stations, reducing the satisfaction of users and the utilization rate of resources. Therefore, it is necessary to accurately predict the bicycle flow of each commuting area, i.e. the number of shared bicycles rented and returned in this area. According to the results of bicycle flow prediction, a real-time dynamic bicycle scheduling scheme is specified to alleviate the problem of imbalance between supply and demand of shared bicycles, which is also the urgent need of shared bicycle system operators and urban planning managers.

[0003] Generally, bicycle flow prediction can be defined as a spatio-temporal sequence prediction problem based on multi-source heterogeneous data. Most bicycle flow prediction studies can be divided into three categories: city level, grid level and station level. City-level bicycle flow prediction predicts the daily use and damage of bicycles at the city level by analyzing the bicycle flow distribution of the entire city, which aims to facilitate the transportation and management of bicycles as a whole. Although this method simplifies the prediction problem, it cannot help shared bicycle managers develop real-time dynamic scheduling strategies. The grid-level method usually divides the study area into uniform grids of the same size and calculates the inflow / outflow and transfer flow between grids. However, cities are usually divided into irregular areas by road network structures, and these areas may have different functional patterns such as education and business areas, which lead to different bicycle flow patterns. Therefore, uniform grids are difficult to effectively simulate the real spatial distribution of shared bicycles.

[0004] The site-level approach focuses on each delineated bike-share docking station. As shown in Figure 1 (a), hundreds of bike docking stations are densely distributed in Manhattan, New York City, which generates a large number of random trips. As shown in Figure 1 (b), according to the historical data analysis in 2019, the amount of commute route trips that occur at least once per weekday morning accounts for 12% of the total amount of trips throughout the year. Due to the dense bike docking stations in the city, users will randomly choose to rent a bike at a station around the origin and return the bike at a station around the destination, subject to the constraint of whether there is an available bike or docking slot at the station. As shown in Figure 1 (e), the random trip problem results in very sparse and irregular traffic at individual docking stations. Therefore, it is difficult to estimate the inflow and outflow of each docking station.

[0005] Meanwhile, the bike traffic data contains strong dynamic correlations and complex nonlinearities in the spatio-temporal dimension. As shown in Figure 1 (f), region 1 has similar traffic distribution with region 2 and region 3 in the morning peak, while it has similar traffic distribution with region 0 in the evening peak. Therefore, modeling the dynamic and nonlinear spatio-temporal correlations is crucial for accurate prediction of bike traffic. However, in most Graph Convolutional Networks (GCN)-based traffic flow prediction methods, the adjacency matrix that determines the information propagation of nodes is predefined by spatial distance or temporal similarity, and does not change during the prediction process, which makes the model unable to capture dynamic dependencies over time.

[0006] In addition, the traffic distribution and spatio-temporal dependencies of bikes are also affected by external factors. As shown in Figure 1 (f), time factors and weather can greatly limit the use of bikes, for example, rainy days will cause users to travel more by taxi than by bike, and people will choose to travel by bike when the weather is suitable and the trip is short. Moreover, weekdays and weekends have completely different spatio-temporal dependencies. Most previous methods for predicting bike traffic simply insert external factors into the model through fully connected layers, which weakens the influence of external information on bike traffic. SUMMARY

[0007] The problem to be solved by the present application is that the traffic data of the bicycle parking station is random and has poor periodicity, making it difficult to accurately predict future bicycle traffic; the existing bicycle traffic prediction method is based on a predefined adjacency matrix, and the spatial and temporal modules are processed independently, which cannot dynamically capture the spatio-temporal correlation in the traffic data; most bicycle traffic prediction methods weaken the influence of external factors on bicycle traffic, resulting in poor prediction effect; and there is a need for an effective bicycle parking station clustering method that divides bicycle parking stations with random traffic into regions with stable rules.

[0008] To solve the above problems, the present application provides a novel context-aware graph recurrent network bicycle traffic prediction method, which is applied to guide shared bicycle management personnel to formulate real-time dynamic scheduling strategies.

[0009] Step 1: Obtain bicycle rental order data based on the parking station in the shared bicycle system, and count the traffic of each bicycle parking station; use a bicycle parking station clustering method based on pattern constraints to cluster independent bicycle parking stations into groups, and each parking station group with the same / similar traffic distribution is considered as a functional area, and further count the bicycle traffic of each area; obtain weather data from the weather station, and the weather data and time factor form external information;

[0010] The bicycle parking station clustering method based on pattern constraints first uses bicycle rental order data based on the parking station to count the traffic distribution of each parking station, and each traffic distribution is a time series; the dynamic time adjustment algorithm (Dynamic Time Warping, DTW) is used to calculate the time series distance between different parking stations, and the actual geographic distance between the parking stations is calculated according to the geographic location; then the time series distance and the actual geographic distance are weighted and summed as the difference between each parking station; finally, the spectral clustering algorithm is used to cluster the parking stations into groups, and a group is regarded as a functional area, and the bicycle traffic of each area is counted as the output.

[0011] Step 2: Construct a context-aware graph recurrent network model (CAGRN) for predicting regional bicycle traffic.

[0012] The area-based bicycle flow prediction model comprises an encoder (Encoder) and a decoder (Decoder) composed of a context-aware graph recurrent unit (CAGRU); the area-based bicycle historical flow and historical external information are divided into multiple time segments, and are input into the encoder in time segments, and the CAGRU of the encoder extracts the spatio-temporal state features of the corresponding time period; the CAGRU in the decoder is initialized using the spatio-temporal state output by the encoder, inputs the bicycle flow predicted by the decoder in the previous time period and the external information of the time segment to be predicted currently, and outputs the predicted bicycle flow in the current time period.

[0013] The context-aware graph recurrent unit CAGRU replaces the linear transformation layer in the gated recurrent unit (GRU) with an adaptive graph convolution (AGC), and adds a contextual embedding layer (CEL) and an adaptive graph generator (AGG) to form. The input of the CAGRU is the spatio-temporal state of the previous time period, the bicycle flow of the current time period and the external information of the current time period, so as to extract the spatio-temporal correlation and effectively fuse the external information, and output the spatio-temporal features of the current time period.

[0014] Step 3: The CAGRN model established in step 2 is trained, and the trained bicycle flow prediction model is deployed on the shared bicycle management system, and the future bicycle flow is output according to the historical flow of each area, which is used to assist the administrator to formulate the real-time dynamic scheduling strategy of shared bicycles.

[0015] In step 2, the bicycle flow of P time periods of the area is used to predict the bicycle flow of Q time periods of the area in the future, P CAGRUs are arranged in the encoder, which correspond to P historical time periods in turn, the input of the CAGRU is the bicycle flow of the area in the current time period and external information, and the spatio-temporal state of the previous time period, and the output is the spatio-temporal state of the current time period; Q CAGRUs are arranged in the decoder, which correspond to one time period to be predicted respectively, the input of the CAGRU in the decoder is the bicycle flow predicted in the previous time period, and the external information of the time period to be predicted currently, and the output is the spatio-temporal state of the time period to be predicted currently, and the bicycle flow of the time period to be predicted currently is output through a fully connected layer.

[0016] In the CAGRU, the context embedding layer CEL fuses the input bicycle flow and external information in the manner of gated linear units, and outputs context-aware features to the adaptive graph generator AGG and the adaptive graph convolution AGC, further strengthening the overall perception of the model to the context environment; the AGG calculates the similarity between regions by coupling the spatio-temporal state of the previous time period and the context-aware features of the current input, following the self-attention manner, embeds the dynamic spatio-temporal correlation into the dynamic graph, and outputs the dynamic graph to the AGC; the AGC combines the spatio-temporal state of the previous time period and the context-aware features of the current input, and uses the diffusion graph convolution manner on the dynamic graph to further model the spatial correlation of the dynamic graph; finally, the CAGRU generates the spatio-temporal state of the current time period in the manner of GRU.

[0017] Compared with the prior art, the advantages and positive effects of the present application are: (1) The method of the present application changes the traditional bicycle flow prediction method. In order to avoid the shortcomings of single station flow sparsity and poor regularity, the present application clusters the bicycle docking stations into functional areas by constraining the historical bicycle flow distribution and geographical distance, and the bicycle flow distribution in the same functional area is similar. Through the bicycle flow prediction of the area, the accuracy of the flow prediction can be improved, and it is also beneficial to the development of the bicycle dispatching strategy.(2) The present application fuses bicycle flow data and external factors through the context embedding layer CEL, extracts the spatio-temporal state of the bicycle flow, and strengthens the context perception ability of the prediction model to improve the prediction accuracy.(3) The adaptive graph generator AGG in the prediction model of the present application can embed dynamic spatio-temporal correlation and context perception ability into the dynamic graph by learning the vectorized representation of the importance perception of each graph node, and gradually evolve according to the input features over time, further improving the prediction accuracy.(4) The context-aware graph recurrent unit CAGRU in the present application can process spatial and temporal dimensions at the same time, and further extract the dynamic spatio-temporal correlation in the shared bicycle system.(5) The experimental results on real data sets show that the method of the present application has good performance, can effectively resist the flow fluctuation caused by external factors, and is beneficial to the development of the shared bicycle system. BRIEF DESCRIPTION OF DRAWINGS

[0018] Figure 1are the bike docking station distribution and bike flow distribution maps; (a) bike docking station distribution map of Manhattan, New York City, (b) average daily morning commute routes that occur at least once per weekday at bike docking stations in 2019, (c) flow distribution map of a single bike docking station over a week, (d) result map of clustering bike docking stations into regions by the clustering method of the present application, (e) average daily morning commute routes that occur at least once per weekday in the clustered regions, (f) flow distribution map of the clustered regions over a week;

[0019] Figure 2 is a schematic diagram of the context-aware graph recurrent network CAGRN of an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of the context embedding layer of the present application;

[0021] Figure 4 is a schematic diagram of the adaptive graph generator of the present application;

[0022] Figure 5 is a schematic diagram of the test results of the method of the present application on the Citibike data set of New York City;

[0023] Figure 6 is a schematic diagram of the dynamic graph evolving over time in the present application. DETAILED DESCRIPTION

[0024] The present application will be further described in detail below with reference to the accompanying drawings and embodiments.

[0025] Since modeling the dynamic nature and nonlinear spatiotemporal dependencies of the bike-sharing system is crucial for accurate prediction of bike flow, in compliance with this fact, the present application proposes a bike flow prediction method of a context-aware graph recurrent network. As shown in Figure 2As shown, the context-aware graph recurrent network used in the method of the application comprises: (1) a mode constraint-based clustering method is invented to cluster bicycle stops into groups, and the stops in the same group are regarded as a functional area, and the bicycle flow data based on the functional area is counted; (2) the CEL (Contextual Embedding Layer) extracts the context-aware features in the shared bicycle system by inputting the bicycle flow data based on the functional area and external factors such as time and weather; (3) the AGG (Adaptive Graph Generator) generates a dynamic graph structure by inputting the context-aware features and the spatio-temporal state of the previous time period, which is used to capture the spatio-temporal correlation changing over time; (4) the AGC (Adaptive Graph Convolution) models the implicit spatial correlation in the shared bicycle system by inputting the dynamic graph and the context-aware features; (5) the linear transformation layer in the Gate Recurrent Unit (GRU) is replaced by the adaptive graph convolution layer, and the context embedding layer GEL and the adaptive graph generator AGG are integrated to form the context-aware graph recurrent unit (CAGRU), which outputs the spatio-temporal state of each time period; (6) the CAGRU forms the context-aware graph recurrent network CAGRN, which follows the encoder-decoder structure of sequence to sequence, and the encoder inputs the bicycle flow data and external factors, and the decoder outputs the predicted flow sequence.

[0026] The implementation and effect verification of the bicycle flow prediction method of the context-aware graph recurrent network of the application are illustrated in the following three steps.

[0027] Step 1: The data collection module obtains the bicycle rental order data based on the stop station through the shared bicycle system, and obtains the weather data through the weather station; the mode constraint-based bicycle stop clustering method is used to cluster independent bicycle stops into groups, and the stop groups with different flow distribution are considered as a functional area. The bicycle flow data based on the functional area and the external information data are counted as the input of the CAGRN model. This step includes the following steps 1.1-1.4.

[0028] Step 1.1: The bicycle rental order data based on the stop station is represented as tr={s ori ,t ori ,s des ,t des}, which represents that the bicycle is started from the stop station s ori at t ori , and t desArrival time at stop s des This invention divides historical data into T time periods and calculates the inflow matrix S for each stop within a time segment. in and outflow matrix S out S out , in Let S represent real numbers, M be the number of bicycle parking stations, and S be the flow matrix. in elements in This indicates that during the t-th time period, the train departs from stop s. i The number of bicycles returned. This indicates that during the t-th time period, the train departs from stop s. i The number of bicycles rented.

[0029] Step 1.2: In this embodiment of the invention, a day is divided into T2 = 48 time periods, each time period t2 is 30 minutes. The sum of the inflow and outflow of the bicycle parking station in the corresponding time period is defined as the flow distribution of the parking station, which is expressed as a 48-dimensional time series.

[0030] Step 1.3: To avoid the problems of sparse and irregular traffic flow at individual bicycle stops, this invention proposes a clustering method based on pattern constraints. This method transforms the prediction scope from a single stop to an entire region based on the traffic flow distribution and geographical distance between bicycle stops. Bicycle stops within the same region have similar traffic distributions. In practice, it is not necessary to estimate the bicycle traffic flow at each stop. Understanding the bicycle traffic flow in each region is sufficient to redistribute bicycles, as conditions affecting bicycle use typically affect an entire region, not just a single stop. The two main constraints of the clustering method in this invention are as follows:

[0031] (1) Geographic proximity: Since most users will choose bicycles when the travel distance is moderate, and urban functions are often clustered together on certain streets, bicycle parking stations in a region should be geographically close to each other.

[0032] (2) Similarity of traffic distribution. Considering that it is easier to discover the inherent regularity of periodic time series, in order to improve the prediction accuracy, this invention assigns bicycle parking stations with similar traffic distribution to the same group.

[0033] To satisfy the above constraints, the present invention first calculates the stopping station s. i and s j Euclidean distance between 1≤i,j≤M, and then two bicycle traffic distribution patterns are constructed by statistically analyzing historical travel records: a weekday traffic distribution pattern and a holiday traffic distribution pattern. In this embodiment of the invention, a day is divided into T2 time periods, each lasting 30 minutes, i.e., t2 is 30 minutes, T2=48. The traffic distribution pattern is represented as a time series, defined as follows:

[0034]

[0035] in S represents the i-th bicycle parking station. i Outflow in the second time period (t2) S represents the i-th bicycle parking station. i Inflow during the t2th time period.

[0036] Then, the Dynamic Time Warping (DTW) algorithm is used to calculate the time-series distance between stops, and a weighted sum is applied to the time-series distances between weekday and holiday traffic distribution patterns. The difference between stops i and j is then calculated. The calculation is as follows:

[0037]

[0038] Where ρ represents the proportion of weekday travel records to total travel records. For the stop s i Traffic distribution on weekdays and holidays, For the j-th stop s j Traffic distribution on weekdays and holidays.

[0039] Stops i and s j The overall difference between them is defined as:

[0040]

[0041] Where λ∈[0,1] represents the weight parameter. Considering that a region should have relatively strict geographical proximity, λ=0.7 is set in this embodiment of the invention.

[0042] Finally, spectral clustering was used to cluster the stops based on their differences. The clustering results were then visualized, such as... Figure 1 As shown in (d) and (f), inter-regional commuter route records account for 97% of the total annual records. Furthermore, the periodicity and regularity of regional traffic flow are more pronounced than those of single-station traffic flow. This invention focuses on regional-level bicycle traffic flow prediction. Let the regional-based bicycle inflow matrix be represented as... N represents the number of regions, wherein the inflow quantity of the kth region r k is defined as the sum of the returned quantities of all bicycle docking stations belonging to the region r k The region-based bicycle outflow quantity matrix is represented as N represents the number of regions, wherein the outflow quantity of the region r k is defined as the sum of the rental quantities of all bicycle docking stations belonging to the region r k The inflow quantity matrix and the outflow quantity matrix are spliced to form a bicycle flow tensor as part of the CAGRN model input.

[0043] Step 1.4: The external information consists of weather information and time factors, wherein the weather data is obtained from a weather meteorological station, and the time factors consist of information such as the day of the week, the time period of the day, whether the current time period is a holiday, etc., the external information is also differentiated according to the site location and the time period, and the external information matrix is represented as wherein c represents the feature dimension of the external information. The element f k,t in the external information matrix F is represented as the time point information and the weather state of the region r k in the time period t. The external information matrix is another part of the CAGRN model input.

[0044] Step 2: The present application constructs a context-aware graph recurrent network CAGRN for bicycle flow prediction. The main advantage is that the CAGRN can effectively capture dynamic spatio-temporal correlation and enhance the influence of external information on flow prediction.

[0045] The CAGRN model of the present application is shown in Figure 2 The present application utilizes flow data (X t-P+1 ,…,X t ​​), and predicts the flow of the next Q time periods. The CAGRN is an encoder-decoder structure composed of CAGRUs, which is formed by integrating a context embedding layer CEL and an adaptive graph generator AGG into a GRU and replacing a linear transformation layer with an adaptive graph convolution AGC. For the CAGRU, the CEL first inputs the flow data and external information data to strengthen the context awareness of the model and outputs context-aware features; then the AGG couples the context-aware features and the spatiotemporal state of the previous time period, extracts the inter-regional similarity relationship in a self-attention manner, and embeds the spatiotemporal correlation into a dynamic graph; next, the AGC inputs the context-aware features and the spatiotemporal state of the previous time period and performs message passing on the dynamic graph to further model the spatial relationship between regions; finally, the spatiotemporal state of the current time period is generated in the manner of a GRU, which is input into the CAGRU of the next time period in a loop. The CAGRU in the encoder inputs P historical time period flow data (X t-P+1 ,…,X t ) and external information data (F t-P+1 ,…,F t ) and outputs a spatiotemporal state; the CAGRU in the decoder is initialized using the spatiotemporal state output by the encoder, inputs the predicted flow of the previous time period and the external information data of the current prediction time period, and outputs the prediction result of the current time period, in a step-by-step prediction manner, to output the bicycle flow of the next Q time periods

[0046] Step 2.1, a context embedding layer CEL is designed and implemented.

[0047] Most traffic flow prediction methods only use a fully connected layer to process external information and simply insert the external information at the tail of the model, which weakens the influence of external information on the flow. As shown in Figure 3 , the context embedding layer of the present application combines bicycle flow data and external information data to strengthen context awareness. Let the flow data of the tth time period be , and the external information data be , where the feature dimension of the bicycle flow data of each region is 2, including two values of inflow and outflow, and the feature dimension of the external information data is c. First, X t and F t are spliced along the feature dimension and input to a fully connected layer FC to obtain input features , where d represents the number of feature channels, and || represents a feature splicing operation. Then the input features are processed in a gated linear unit manner to extract context embedding perception features The calculation formula is as follows:

[0048]

[0049] where Θ1, Θ2, a and b are learnable parameters, ⊙ denotes element-wise multiplication, φ(·) denotes the tanh activation function, and σ(·) denotes the sigmoid function.

[0050] Context-aware features The traffic data and the external information data are effectively fused, and then merged with the CAGRU output of the previous time period along the feature dimension to be input into all subsequent modules, further enhancing the perception of the spatio-temporal context.

[0051] Step 2.2, design an adaptive graph generator AGG.

[0052] Since the regions after clustering are typical non-Euclidean spaces, the relationship between the regions in the bike-sharing system can be described as a directed weighted graph where represents a node set composed of regions, and ε represents an edge set composed of the relationships between regions. When a large number of people exist from a region r l to a region r k , there will be a directed edge ε lk . A represents a weighted adjacency matrix, which presents the strength of the relationship between regions in a numerical manner. The present application proposes an adaptive graph generator to dynamically calculate the weighted adjacency matrix A.

[0053] Traditional traffic flow prediction methods based on graph neural networks use a pre-defined static graph as the relationship between nodes. However, the bike-sharing system is a complex system, and the relationship between regions is not only affected by the spatio-temporal relationship, but also greatly affected by external information such as weather, time, etc. Therefore, as Figure 4 shown, the present application designs an adaptive graph generator with closely coupled spatio-temporal state and context-aware features. First, the present application concatenates the spatio-temporal state feature H t-1 of the previous time period and the context-aware feature E t of the current time period along the feature dimension, and after linear transformation, the input I t of the adaptive graph generator is obtained, and the calculation process is as follows:

[0054] I t =(E t ‖H t-1 )Θ dyn +b dyn (5)

[0055] where, and are model parameters, and d represents the number of feature channels.

[0056] The application calculates the similarity between regions in a self-attention manner, and embeds dynamic spatio-temporal correlation into a dynamic graph In the application, the prediction accuracy is further improved, and the calculation process is as follows:

[0057]

[0058] where W Q and W K are model parameters. The input feature I t is respectively passed through a fully connected layer to form the transformation features Q and K. Softmax(·) represents a normalization function, which is defined as ReLU(·) represents an activation function, which is defined as ReLU(x) = max(0, x).

[0059] Step 2.3, design adaptive graph convolution AGC.

[0060] The traditional traffic flow prediction method based on graph convolution is only for static graph structure, while the graph convolution of the application is for a graph structure that dynamically changes with time. The dynamic graph based on the shared bicycle system reflects the correlation between regions changing with time, so it is necessary to design a data-driven adaptive graph convolution technology to capture the implicit spatial correlation in the dynamic graph. The adaptive graph convolution calculation process is as follows:

[0061]

[0062] where represents a regularized adjacency matrix, which is defined as and are model parameters, and n represents the depth of graph convolution propagation. is the output result of the adaptive graph generator. is the intermediate output feature of the convolution process, is the final output result of the adaptive graph convolution.

[0063] For convenience of representation, formula (7) is simplified as where A represents a regularization matrix, that is, Θ1 and Θ2 are graph convolution parameters, and G represents graph convolution. Since the dynamic graph is a directed and weighted graph, the adaptive graph convolution uses diffusion convolution to propagate the inflow and outflow information of each node in the directed graph, and the calculation method is as follows:

[0064]

[0065] where, A T represents the transpose of matrix A.

[0066] Step 2.4, design context-aware graph recurrent unit CAGRU.

[0067] The cycle unit is a classic design in RNN-based models. The application integrates the context embedding layer CEL and the self-adaptive graph generator AGG into the GRU, and replaces the linear transformation layer with the adaptive graph convolution AGC to form the CAGRU, effectively modeling complex spatio-temporal dependencies. While processing the spatial and temporal dimensions, the output model of the current time period is the spatial state. As shown in the CAGRU in Figure 2 The adaptive graph convolution layer replacing the linear transformation layer contains three AGCs, which respectively calculate the reset gate, the update gate and the candidate spatio-temporal state. The specific calculation process of the CAGRU is as follows:

[0068]

[0069] Where, Θ r , Θ z , Θ h , b r , b z and b h are graph convolution parameters, ★G is the adaptive graph convolution defined in formula (8), r t is the reset gate, z t is the update gate, h t is the candidate spatio-temporal state, H t represents the spatio-temporal state of the tth time period.

[0070] As shown in Figure 2 , both the encoder and the decoder are composed of CAGRUs. The application uses the traffic data of P historical time periods to predict the traffic of the next Q time periods. The CAGRU in the encoder inputs the historical time period traffic data and external information data, and outputs the spatio-temporal state; the CAGRU in the decoder uses the spatio-temporal state output by the encoder for initialization, inputs the predicted traffic of the previous time period and the external information data of the current prediction time period, and outputs the bicycle traffic prediction result of the current time period.

[0071] Likewise, in the decoder, the CAGRU is initialized with the spatiotemporal state of the previous time period output by the encoder, in which the context-aware features are extracted from the input bicycle flow and external information by the CEL, and output to the AGG and AGC; the AGG couples the context-aware features and the spatiotemporal state of the previous time period, calculates the similarity between regions in a self-attention manner, embeds the spatiotemporal correlation into the dynamic graph, and outputs the dynamic graph to the AGC; the AGC uses the diffusion graph convolution method to perform message passing of regional features on the dynamic graph according to the input spatiotemporal state of the previous time period and the context-aware features, and further models the spatial correlation of the dynamic graph; finally, the spatiotemporal state of the current time period is generated in the GRU manner, and after the spatiotemporal state passes through a fully connected layer, the bicycle flow prediction result of the current time period is output, and input into the CAGRU of the next prediction time period of the decoder. As shown in FIG. 8, the bicycle flow input into the first prediction time period of the decoder is a 0 vector. Figure 2

[0072] Step 3, the bicycle flow prediction model CAGRN provided by the present application is trained, and the trained model is used to extract rules and spatiotemporal states from historical bicycle flow to predict future bicycle flow.

[0073] The embodiment of the present application uses two real data sets, namely the Citi-Bike bicycle data set of New York City and the New York weather data set (Meteorology) to train and test the CAGRN model. The detailed information is shown in Table 1. The present application sets t as a 30-minute time period to segment the data set, and obtains T=17518 samples. Then, the bicycle flow data of the first 10 months is selected as the training data, the November data is selected as the validation set, and the December data is selected as the test set.

[0074] (1) The Citi-Bike data set collects the travel data of the Citi-Bike system in New York from 2019 / 01 / 01 to 2019 / 12 / 31. The data includes: starting station, ending station (station ID, latitude and longitude), start time and stop time. Weather Meteorology data set. These data come from the National Environmental Information Center (NCEI) and are recorded by a monitoring station near Central Park (40.77898 degrees north latitude, -73.96925 degrees longitude), including air temperature, wind speed, precipitation and snowfall.

[0075] Table 1 Description of shared bicycle data set and weather data set

[0076]

[0077] (2) The present application uses PyTorch deep learning framework, and the entire experiment is carried out on a workstation equipped with a 24G memory Nvidia GeForce RTX3090 GPU. In the clustering stage, considering the trade-off role, λ = 0.7 is set. The silhouette coefficient is taken as the standard of the clustering algorithm, and when the silhouette coefficient is maximum, the region is clustered into N = 54 clusters at this time. In the data preprocessing stage, the focus is on the inflow and outflow at the regional level. The external conditions are composed of time factors and weather information, wherein the weather type is encoded as one-hot encoding, so c = 67. The input data is standardized by Z-score standardization before being input into the model. For CAGRN, considering efficiency and performance, the number of feature channels d = 64, and the propagation depth n = 2 in graph convolution. The historical 3-hour flow data (P = 6) is used to predict the next hour (Q = 2). During training, a planned sampling strategy is adopted to improve training stability. The batch size is set to 64, and the learning rate is set to 0.001. The Adam optimizer and the exponential decay learning rate strategy are used, and the model is trained on the training set for 200 cycles. Huber loss is selected as the loss function is represented as:

[0078]

[0079] wherein, represents the predicted flow value, and X represents the real flow value.

[0080] (3) The present application uses the root mean square error (RMSE), the mean absolute error (MAE) and the mean absolute percentage error (MAPE) method to evaluate the model performance, which is defined as follows:

[0081]

[0082] (4) For consistency, the present application deploys the same environment, loss function, flow data and external factors (i.e. time factors and weather information) for all models. The present application compares CAGRN with basic and advanced methods of traffic prediction, and the final average results are shown in Table 2.

[0083] Table 2 Quantitative results compared with other methods on the Citi-Bike dataset

[0084]

[0085] The present application evaluates the error of each time period respectively and classifies it according to the model category. The results show that the present application method (CAGRN model) is always superior to the baseline model. The traditional statistical learning-based ARIMA is susceptible to sequence volatility, thus showing poor performance. In the deep learning method, the poor performance of LSTM and GRU indicates the limitation of failing to consider spatial correlation. TGCN and STGCN model the spatio-temporal correlation, but only rely on fixed graph structure and ignore dynamic characteristics. Benefiting from adaptive adjacency matrix learning, GWNet and AGCRN also have competitive results. HGCN is similar to GWNet, which also utilizes adaptive adjacency matrix and introduces temporal attention mechanism in the time dimension. However, the adaptive graph is still static over time and cannot capture the time-varying spatio-temporal dependence. DGCRN adopts a predefined adjacency matrix for the message passing process of dynamic node states. Due to the incomplete connection in the data, the predefined graph itself may contain noise, hindering the generation of dynamic graphs. In addition, these models do not have a dedicated module to process external factors, and the embodiments of the present application only connect them with traffic data. Therefore, the external information is not fully utilized in these models. The prediction of the present application CAGRN on the December Citi-Bike dataset as shown in Figure 5 Figure 1 can effectively adapt to the nonlinear spatio-temporal dependence caused by variable external information.

[0086] (5) In order to verify the effectiveness of the key components of the present application CAGRN, the present application conducts an ablation experiment, which is described as follows:

[0087] A.w / o The dynamic graph is removed from CAGRN, and the Euclidean distance between regions is directly used as the graph structure.

[0088] B.AGG w / o H: Remove the hidden state of the previous time period from the adaptive graph generator.

[0089] C.AGG w / o X: Remove the output of the context embedding layer from the adaptive graph generator.

[0090] D.CEL w / o F: Remove external factors from the context embedding layer.

[0091] The performance of all variant models is shown in Table 3.

[0092] Table 3 Performance comparison of all variant models of CAGRN

[0093]

[0094] As can be seen from Table 3, the dynamic graph apparently plays a more prominent role. The introduction of the dynamic graph can significantly improve the performance, because it provides implicit correlations that cannot be extracted from static topological graphs. The present application visualizes the dynamic graph structure over time, as shown in Figure 6 The dynamic graph combines with the traffic data and external factors to directly model the complex temporal-spatial dependence varying over time into the dynamic graph, effectively capturing the temporal-spatial correlation of the bike-sharing system. For the adaptive graph generator, the hidden state of the previous time step is crucial to model the dynamic temporal-spatial correlation as a dynamic graph. In addition, the external factor dominates the performance of the model, otherwise the model cannot control the fluctuations caused by the factor. In summary, all components of the present application are carefully designed, which greatly affects the final performance.

[0095] In addition to the technical features described in the specification, they are known to those skilled in the art. The present application omits the description of known components and known technologies to avoid redundancy and unnecessary limitation of the present application. The embodiments described in the above embodiments do not represent all embodiments consistent with the present application. Various modifications or variations made by those skilled in the art without creative labor on the basis of the technical solutions of the present application are still within the protection scope of the present application.

Claims

1. A method for predicting bicycle traffic flow, characterized in that, The method includes: Step 1: Obtain bicycle order data and weather data from the shared bicycle system and weather station, respectively; use a pattern-constrained bicycle stop clustering method to cluster bicycle stops into groups, with stops in the same group considered as a region, and count the bicycle flow in each region; concatenate the inflow and outflow matrices of all bicycle stops in the region to form the bicycle flow tensor of the region; external information is composed of weather data and time factors; The pattern-constrained bicycle parking station clustering method described above first uses bicycle rental order data based on parking stations to statistically analyze the traffic distribution of each parking station. Each traffic distribution is a time series. A dynamic time adjustment algorithm is used to calculate the time series distance between different parking stations, and then the actual geographical distance between the parking stations is calculated based on their geographical locations. Then, the time series distance and the actual geographical distance are weighted and summed to obtain the dissimilarity between parking stations. Finally, a spectral clustering algorithm is used to cluster the parking stations into groups. Step 2: Construct a region-based bicycle traffic prediction model; The prediction model employs a Context-Aware Graph Recurrent Network (CAGRN), which includes an encoder and a decoder composed of Context-Aware Graph Recurrent Units (CAGRUs). Historical bicycle traffic and external information based on the region are divided into time periods and progressively input into the encoder according to these time periods. The encoder's CAGRUs output the spatiotemporal state corresponding to the time period. The decoder's CAGRUs are initialized using the spatiotemporal state output by the encoder, input the bicycle traffic of the previous time period and the external information of the current time period, output the spatiotemporal state of the current time period, and predict the bicycle traffic of the current time period. The CAGRU is formed by integrating the context embedding layer CEL and the adaptive graph generator AGG into the gated recursive unit GRU, and replacing the linear transformation layer in the GRU with the adaptive graph convolution AGC. In CAGRU, context-aware features are first extracted from the input bicycle traffic and external information using CEL, and then output to AGG and AGC. AGG couples the context-aware features with the spatiotemporal state of the previous time period, calculates the similarity between regions using self-attention, embeds the spatiotemporal correlation into the dynamic graph, and outputs the dynamic graph to AGC. AGC uses the spatiotemporal state of the previous time period and the context-aware features to perform message passing of region features on the dynamic graph using a spread graph convolution. Finally, the spatiotemporal state of the current time period is generated using GRU. Step 3: Train the established CAGRN model and deploy the trained model on the shared bicycle management system. Based on the historical traffic of each area, output the future bicycle traffic to assist the administrator in formulating real-time dynamic scheduling strategies for shared bicycles.

2. The method according to claim 1, characterized in that, In step 1, the bicycle traffic at the bicycle parking stations is statistically analyzed by weekdays and holidays, and by time period. The day is divided into T time periods, and the inflow and outflow of each bicycle parking station in each time period are statistically analyzed to form the traffic distribution of the bicycle parking stations. The inflow is the number of bicycles returned from the parking station, and the outflow is the number of bicycles rented from the parking station. For two different stops, the actual geographical distance and the time-series distance of traffic distribution in both cases are calculated. Then, the weighted sum of the actual geographical distance and the time-series distance is used to form the difference between the stops, as shown below: Set up stop s i Traffic distribution on weekdays and holidays is as follows: Stops j Traffic distribution on weekdays and holidays is as follows: The dynamic time adjustment algorithm is used to calculate the stopping station s. i and s j Time series distance for: Where ρ represents the proportion of weekday travel records to total travel records, and DTW represents the dynamic time adjustment algorithm; Stops i and s j Difference between Where λ∈[0,1] represents the weighting parameter, which is used to adjust the degree of influence of actual geographical distance and time series distance on the degree of difference; Indicates the stop s i and s j The Euclidean distance between them is the actual geographical distance.

3. The method according to claim 2, characterized in that, Set the weight parameter λ = 0.

7.

4. The method according to claim 1, characterized in that, In step 2, the context embedding layer CEL concatenates the bicycle traffic flow and external information for the input time period and inputs them into a fully connected layer to obtain input features. Then, the input features are processed using gated linear units to extract context-aware features.

5. The method according to claim 4, characterized in that, In step 2, the context embedding layer CEL extracts the context-aware feature E. t as follows: Where Θ1, Θ2, a, and b are learnable parameters, ⊙ represents element-wise multiplication, φ(·) represents the tanh activation function, and σ(·) represents the sigmoid function. The input features are derived from bicycle traffic in the t-th time period and external information.

6. The method according to claim 1, characterized in that, The adaptive graph generator (AGG) concatenates the spatiotemporal state of the previous time period and the input context-aware features along the feature dimension. After passing through a linear transformation layer, the input features are obtained. Then, the input features are processed using self-attention. The input features are passed through a fully connected layer to form transformed features Q and K. The similarity between regions is obtained by using the inner product of Q and K. The similarity is normalized using the softmax function, and the dynamic graph is output.

7. The method according to claim 1, characterized in that, In step 2, the adaptive graph convolutional (AGC) output for the t-th time interval is: as follows: Among them, W (k) b (k) These are model parameters, where n represents the graph convolution propagation depth; E t H represents the context-aware features for the t-th time period. t-1 This represents the spatiotemporal state of the (t-1)th time period; Represents a regularized weighted adjacency matrix; These are the intermediate output features of the convolution process. yes The initial value; N represents the number of regions, and d represents the number of feature channels in the AGG input. Represents a real number.

8. The method according to claim 7, characterized in that, In step 2, CAGRU calculates the spatiotemporal state H of the t-th time period. t The process is as follows: r t =σ(Θ r * G (E t ‖H t-1 )+b r ) z t =σ(Θ z * G (E t ‖H t-1 )+b z ) h t =φ(Θ h * G (E t ‖(r t ⊙H t-1 ))+b h ) H t =z t ⊙H t-1 +(1-z t )⊙h t Where, Θ r Θ z Θ h b r b z and b h These are the graph convolution parameters, where *G represents adaptive graph convolution, r t To reset the door, z t To update the gate, h t As a candidate spatiotemporal state, E t H represents the context-aware features for the t-th time period. t-1 H represents the spatiotemporal state of the (t-1)th time interval. t Let represent the spatiotemporal state of the t-th time interval; φ(·) represents the tanh activation function, σ(·) represents the sigmoid function, and ⊙ represents element-wise multiplication.

Citation Information

Patent Citations

  • Method and device for predicting shared bicycle flow based on AP-TI (Affinity Propagation-Trend Iteration) clustering

    CN108960476A

  • Shared bicycle traffic flow prediction method and system based on station behavior analysis

    CN110210656A