Bicycle flow prediction method and device, storage medium and computer equipment
Through long-term and short-term feature extraction, domain division and graph convolutional neural network processing of bicycle station traffic data, combined with alternating feedback attention mechanism and domain awareness, the problem of insufficient expression ability of bicycle traffic prediction features in the existing technology is solved, and a better Accurate traffic forecasting.
Patent Information
- Application Number
- CN202410608421.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-05-16
AI Technical Summary
Existing bicycle traffic prediction methods have deficiencies in feature expression capabilities and prediction effects, making it difficult to make full use of multi-dimensional data information, resulting in poor prediction results.
By obtaining the traffic input and output data of the bicycle station, we perform long- and short-term feature extraction, divide the domain, determine the domain spatial information and information identification matrix, combine the graph convolutional neural network for feature extraction and prediction, and use the alternating feedback attention mechanism and domain awareness. Methods capture spatiotemporal correlations.
It improves the prediction accuracy of bicycle traffic, can better handle complex spatio-temporal associated data, and captures the relationships in different spatial domains and the semantic relationships of data dimensions.
Smart Images

Figure CN118734030A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of spatiotemporal data mining, and in particular to a bicycle flow prediction method and device, a storage medium, and a computer device. Background Art
[0002] With the acceleration of urbanization and the continuous expansion of bicycle networks, accurate prediction of bicycle flow has become one of the important issues in the fields of urban planning, bicycle management and smart bicycle systems.
[0003] Existing bicycle flow prediction methods often consider the overall perspective and the interactive information between stations, and learn the global and local characteristics of spatiotemporal data based on flow data modeling. However, bicycle flow data not only has complex fluctuations at the micro level, such as being affected by temporary factors such as vehicle driving status, bicycle signal lights, and accidents, showing high uncertainty and nonlinearity; it also shows differences between different spatial domains at the macro level, such as being affected by factors such as road network structure and geographical environment, resulting in different bicycle flow distributions in different areas containing several stations. This makes it difficult for existing bicycle flow prediction methods that do not take into account information interaction and data association in different dimensions to fully utilize multi-dimensional data information, and the feature expression ability is limited during the prediction process, thus failing to achieve the expected prediction effect. Summary of the invention
[0004] In view of this, the present invention provides a bicycle flow prediction method and device, a storage medium, and a computer device, the main purpose of which is to solve the problems of weak feature expression ability and poor prediction effect in the existing bicycle flow prediction process.
[0005] According to one aspect of the present invention, a method for predicting bicycle flow is provided, comprising:
[0006] Obtaining flow input data and flow output data of each bicycle station, and performing long-term and short-term feature extraction based on the flow input data and the flow output data to obtain an aggregated feature matrix of multiple bicycle stations;
[0007] Acquire the station inflow feature and the station outflow feature obtained in the long-term and short-term feature extraction process, and divide the plurality of bicycle stations into a plurality of domains based on the station inflow feature and the station outflow feature;
[0008] Determine a domain space information matrix and a domain information identification matrix of each domain, and embed the domain space information matrix and the domain information identification matrix into the aggregate feature matrix to obtain an enhanced site feature matrix with domain information;
[0009] Feature extraction processing is performed based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix, and the extracted features are transformed linearly by the predictor to obtain the final bicycle flow prediction result.
[0010] Furthermore, the extracting long-term and short-term features based on the flow input data and the flow output data to obtain an aggregated feature matrix of multiple sites includes:
[0011] Performing statistical processing on the flow input data and the flow output data in short-term and long-term terms respectively to obtain a short-term inflow matrix, a long-term inflow matrix, a short-term outflow matrix and a long-term outflow matrix;
[0012] The flow information of the short-term inflow matrix and the short-term outflow matrix in different time periods is fused to obtain a short-term inflow embedding tensor and a short-term outflow embedding tensor; and the flow information of the long-term inflow matrix and the long-term outflow matrix on different dates is fused to obtain a long-term inflow embedding tensor and a long-term outflow embedding tensor;
[0013] An alternating feedback attention mechanism is used to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor to obtain the aggregated feature matrix.
[0014] Furthermore, the fusing of the flow information of the short-term inflow matrix and the short-term outflow matrix in different time periods to obtain a short-term inflow embedding tensor and a short-term outflow embedding tensor includes:
[0015] Performing data connection processing on the flow input data and flow output data in the short-term inflow matrix and the short-term outflow matrix containing multiple time periods respectively according to the time dimension to obtain the short-term inflow data connection volume and the short-term outflow data connection volume;
[0016] Performing feature extraction processing on the short-term inflow data connection amount and the short-term outflow data connection amount respectively to obtain the short-term inflow embedding tensor and the short-term outflow embedding tensor;
[0017] The fusing the flow information of the long-term inflow matrix and the long-term outflow matrix on different dates to obtain a long-term inflow embedding tensor and a long-term outflow embedding tensor includes:
[0018] Performing data connection processing on the flow input data and flow output data in the long-term inflow matrix and the long-term outflow matrix containing multiple dates respectively according to the time dimension to obtain the long-term inflow data connection volume and the long-term outflow data connection volume;
[0019] Feature extraction processing is performed on the long-term inflow data connection quantity and the long-term outflow data connection quantity respectively to obtain the long-term inflow embedding tensor and the long-term outflow embedding tensor.
[0020] Furthermore, the alternating feedback attention mechanism is used to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor to obtain the aggregated feature matrix, including:
[0021] Using four learnable linear mapping tensors to perform linear mapping processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor respectively, to obtain four dimensionally aligned feature matrices, including a short-term inflow mapping matrix, a short-term outflow mapping matrix, a long-term inflow mapping matrix and a long-term outflow mapping matrix;
[0022] Performing a long-term and short-term dependency fusion process based on the short-term inflow mapping matrix, the short-term outflow mapping matrix, the long-term inflow mapping matrix, and the long-term outflow mapping matrix to obtain a site inflow feature and a site outflow feature;
[0023] Performing cross-attention coding processing on the site inflow feature and the site outflow feature to obtain two attention coding features;
[0024] The attention encoding features are fused to obtain the aggregated feature matrix.
[0025] Furthermore, the determining of the domain space information matrix of each domain includes:
[0026] Acquire the longitude and latitude coordinates of the bicycle stations contained in each domain, and calculate the spherical distance between two bicycle stations based on the longitude and latitude coordinates to obtain a road information matrix containing the spherical distance;
[0027] Combine the stations in the domain in pairs, and determine the longitude and latitude coordinates of the two bicycle stations in the station combination as the longitude and latitude coordinates of the starting point and the longitude and latitude coordinates of the end point respectively;
[0028] The latitude and longitude coordinates of the starting point and the latitude and longitude coordinates of the end point are used as inputs of a multi-layer perceptron, and a spatial position information matrix is obtained after being processed by the multi-layer perceptron;
[0029] The road information matrix and the spatial position information matrix are fused to obtain the domain spatial information matrix of each domain.
[0030] Further, the determining of the domain information identification matrix of each domain includes:
[0031] Configure a domain identification value for each divided domain, and construct an initial domain information identification matrix of the same size as the aggregate feature matrix;
[0032] Scanning the bicycle stations contained in each domain, and determining the target element position corresponding to the element feature representing the interaction between bicycle stations in the same domain in the aggregate feature matrix;
[0033] The element value at the target element position in the domain information identification initial matrix is determined as the corresponding domain identification value; and the element value at the non-target element position in the domain information identification initial matrix is determined as 0, so as to obtain the domain information identification matrix.
[0034] Furthermore, the feature extraction process based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix includes:
[0035] A first graph convolutional neural network is used to extract spatiotemporal joint features between each bicycle station from the aggregate feature matrix;
[0036] Using a domain-aware layer in a second graph convolutional neural network to extract distinguishing information of each domain from the enhanced site feature matrix, and obtaining a weight matrix representing the importance of each domain;
[0037] The spatiotemporal joint feature is multiplied by the weight matrix to obtain a final feature representation.
[0038] According to another aspect of the present invention, a bicycle flow prediction device is provided, comprising:
[0039] A feature extraction module, used to obtain flow input data and flow output data of each bicycle station, and perform long-term and short-term feature extraction based on the flow input data and the flow output data to obtain an aggregate feature matrix of multiple bicycle stations;
[0040] A domain division module, used for obtaining the site inflow feature and the site outflow feature obtained in the long-term and short-term feature extraction process, and dividing the plurality of bicycle sites into a plurality of domains based on the site inflow feature and the site outflow feature;
[0041] A domain information embedding module, used to determine a domain space information matrix and a domain information identification matrix of each domain, and embed the domain space information matrix and the domain information identification matrix into the aggregated feature matrix to obtain an enhanced site feature matrix with domain information;
[0042] The perception and prediction module is used to perform feature extraction processing based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix, and obtain the final bicycle flow prediction result by linear transformation of the extracted features by the predictor.
[0043] Furthermore, the feature extraction module includes a statistical unit, a data fusion unit and a feature aggregation unit;
[0044] The statistical unit is used to perform statistical processing on the flow input data and the flow output data in short-term and long-term terms respectively, to obtain a short-term inflow matrix, a long-term inflow matrix, a short-term outflow matrix and a long-term outflow matrix;
[0045] The data fusion unit is used to fuse the flow information of the short-term inflow matrix and the short-term outflow matrix in different time periods to obtain a short-term inflow embedding tensor and a short-term outflow embedding tensor; and to fuse the flow information of the long-term inflow matrix and the long-term outflow matrix on different dates to obtain a long-term inflow embedding tensor and a long-term outflow embedding tensor;
[0046] The feature aggregation unit is used to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor by adopting an alternating feedback attention mechanism to obtain the aggregated feature matrix.
[0047] Furthermore, the data fusion unit is also used for:
[0048] Performing data connection processing on the flow input data and flow output data in the short-term inflow matrix and the short-term outflow matrix containing multiple time periods respectively according to the time dimension to obtain the short-term inflow data connection volume and the short-term outflow data connection volume;
[0049] Performing feature extraction processing on the short-term inflow data connection amount and the short-term outflow data connection amount respectively to obtain the short-term inflow embedding tensor and the short-term outflow embedding tensor;
[0050] Performing data connection processing on the flow input data and flow output data in the long-term inflow matrix and the long-term outflow matrix containing multiple dates respectively according to the time dimension to obtain the long-term inflow data connection volume and the long-term outflow data connection volume;
[0051] Feature extraction processing is performed on the long-term inflow data connection quantity and the long-term outflow data connection quantity respectively to obtain the long-term inflow embedding tensor and the long-term outflow embedding tensor.
[0052] Furthermore, the feature aggregation unit is also used for:
[0053] Using four learnable linear mapping tensors to perform linear mapping processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor respectively, to obtain four dimensionally aligned feature matrices, including a short-term inflow mapping matrix, a short-term outflow mapping matrix, a long-term inflow mapping matrix and a long-term outflow mapping matrix;
[0054] Performing a long-term and short-term dependency fusion process based on the short-term inflow mapping matrix, the short-term outflow mapping matrix, the long-term inflow mapping matrix, and the long-term outflow mapping matrix to obtain a site inflow feature and a site outflow feature;
[0055] Performing cross-attention coding processing on the site inflow feature and the site outflow feature to obtain two attention coding features;
[0056] The attention encoding features are fused to obtain the aggregated feature matrix.
[0057] Further, the domain information embedding module includes a domain space information extraction unit and a domain information identification unit;
[0058] The domain space information extraction unit is used for:
[0059] Acquire the longitude and latitude coordinates of the bicycle stations contained in each domain, and calculate the spherical distance between two bicycle stations based on the longitude and latitude coordinates to obtain a road information matrix containing the spherical distance;
[0060] Combine the stations in the domain in pairs, and determine the longitude and latitude coordinates of the two bicycle stations in the station combination as the longitude and latitude coordinates of the starting point and the longitude and latitude coordinates of the end point respectively;
[0061] The latitude and longitude coordinates of the starting point and the latitude and longitude coordinates of the end point are used as inputs of a multi-layer perceptron, and a spatial position information matrix is obtained after being processed by the multi-layer perceptron;
[0062] The road information matrix and the spatial position information matrix are fused to obtain the domain spatial information matrix of each domain.
[0063] The domain information identification unit is used for:
[0064] Configure a domain identification value for each divided domain, and construct an initial domain information identification matrix of the same size as the aggregate feature matrix;
[0065] Scanning the bicycle stations contained in each domain, and determining the target element position corresponding to the element feature representing the interaction between bicycle stations in the same domain in the aggregate feature matrix;
[0066] The element value at the target element position in the domain information identification initial matrix is determined as the corresponding domain identification value; and the element value at the non-target element position in the domain information identification initial matrix is determined as 0, so as to obtain the domain information identification matrix.
[0067] Furthermore, the perception and prediction module is also used for:
[0068] A first graph convolutional neural network is used to extract spatiotemporal joint features between each bicycle station from the aggregate feature matrix;
[0069] Using a domain-aware layer in a second graph convolutional neural network to extract distinguishing information of each domain from the enhanced site feature matrix, and obtaining a weight matrix representing the importance of each domain;
[0070] The spatiotemporal joint feature is multiplied by the weight matrix to obtain a final feature representation.
[0071] According to another aspect of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, wherein the executable instruction enables a processor to execute operations corresponding to the above-mentioned bicycle flow prediction method.
[0072] According to another aspect of the present invention, there is provided a computer device, comprising a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0073] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned bicycle flow prediction method.
[0074] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0075] The present invention provides a method and device for predicting bicycle flow, a storage medium, and a computer device. Compared with the prior art, the present invention obtains flow input data and flow output data of each bicycle station, and extracts long-term and short-term features based on the flow input data and the flow output data to obtain an aggregate feature matrix of multiple bicycle stations; obtains station inflow features and station outflow features obtained in the long-term and short-term feature extraction process, and divides multiple bicycle stations into multiple domains based on the station inflow features and the station outflow features; determines the domain space information matrix and the domain information identification matrix of each domain, and embeds the domain space information matrix and the domain information identification matrix into the aggregate feature matrix to obtain an enhanced station feature matrix with domain information; performs feature extraction processing based on a graph convolutional neural network, the aggregate feature matrix, and the enhanced station feature matrix, and obtains the final bicycle flow prediction result through the linear transformation of the extracted features by a predictor, thereby realizing accurate prediction of bicycle flow. The present invention combines the graph neural network and spatiotemporal data processing technology, and can better process complex data related to bicycle flow with spatiotemporal association. The present invention utilizes the characteristics of graph neural networks to learn the spatiotemporal correlation between bicycle flow data, and analyzes the importance of different stations in the overall spatiotemporal relationship in spatiotemporal data with different spatial domains. Based on the feature extraction method of alternating feedback attention and the domain-aware learning method, it better captures the bicycle flow relations in different spatial domains and the complex semantic relations under the representation of different data dimensions, thereby improving the prediction accuracy of bicycle flow spatiotemporal data.
[0076] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0078] Figure 1 A schematic diagram showing a flow chart of a bicycle flow prediction method provided by an embodiment of the present invention;
[0079] Figure 2 A schematic diagram showing a flow chart of another bicycle flow prediction method provided by an embodiment of the present invention;
[0080] Figure 3A schematic diagram of another bicycle flow prediction method provided by an embodiment of the present invention is shown;
[0081] Figure 4 A schematic diagram of another bicycle flow prediction method provided by an embodiment of the present invention is shown;
[0082] Figure 5 A schematic diagram of another bicycle flow prediction method provided by an embodiment of the present invention is shown;
[0083] Figure 6 A schematic diagram showing the structure of a bicycle flow prediction device provided by an embodiment of the present invention is shown;
[0084] Figure 7 A schematic structural diagram of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0085] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0086] The embodiment of the present invention provides a method for predicting bicycle flow, such as Figure 1 As shown, the method includes:
[0087] 101. Obtain flow input data and flow output data of each bicycle station, and extract long-term and short-term features based on the flow input data and the flow output data to obtain an aggregated feature matrix of multiple bicycle stations;
[0088] In an embodiment of the present invention, the current execution end obtains the flow input data and flow output data of each bicycle station. The flow input data is the bicycle flow value entering the bicycle station, and the flow output data is the bicycle flow value emitted from the station. After obtaining the flow input data and flow output data of each bicycle station, the current execution end performs long-term and short-term feature extraction based on the above flow input data and flow output data to obtain an aggregated feature matrix of multiple bicycle stations. The long-term and short-term feature extraction includes extracting the short-term dependency of inflow and outflow between stations and the long-term dependency of inflow and outflow between stations, and can extract data fluctuations between different dimensions from a microscopic level. The aggregated feature matrix of multiple bicycle stations can effectively characterize the dependency relationship between bicycle stations and between different channel representations with different semantics.
[0089] 102. Acquire the site inflow feature and the site outflow feature obtained in the long-term and short-term feature extraction process, and divide the plurality of bicycle sites into a plurality of domains based on the site inflow feature and the site outflow feature;
[0090] In an embodiment of the present invention, the current execution end obtains the site inflow feature and site outflow feature obtained in the process of long-term and short-term feature extraction. Among them, the site inflow feature representation and the site outflow feature represent two features obtained by long-term and short-term dependency fusion according to the inflow / outflow grouping. After obtaining the two features of the above-mentioned bicycle station, the current execution end classifies the multiple bicycle stations that need to be analyzed based on the above-mentioned site inflow feature and site outflow feature, that is, divides the multiple bicycle stations into several domains. For example, if the number of bicycle stations that need to be analyzed is 50, after obtaining the site inflow feature and site outflow feature of these 50 bicycle stations, a clustering algorithm is used based on the above-mentioned features for classification processing, and the 50 stations are divided into 8 domains, etc., which are not specifically limited in the embodiment of the present invention.
[0091] It should be noted that the current execution end uses a clustering algorithm to divide multiple bicycle stations. The process includes: first, the station inflow features and station outflow features are fused in a splicing manner to obtain the feature representation of each bicycle station; then, N bicycle stations are selected to initialize the cluster center, and the cosine similarity between the cluster center and the remaining bicycle stations is calculated based on the feature representation of the bicycle station; then, the classification of the remaining bicycle stations is determined based on the cosine similarity (that is, the cluster center with the greatest similarity is selected and classified into the same category as the cluster center). After finding the classification of all bicycle stations, the new cluster center is found by taking the mean value, and then the above steps are repeated to iteratively update the cluster center until the algorithm converges or the number of iterations reaches the preset upper limit to obtain the final N domains, each of which contains at least one bicycle station.
[0092] 103. Determine a domain space information matrix and a domain information identification matrix of each domain, and embed the domain space information matrix and the domain information identification matrix into the aggregated feature matrix to obtain an enhanced site feature matrix with domain information;
[0093] In an embodiment of the present invention, in order to embed domain information into the feature vector space, the current execution end extracts features from each domain obtained by division, and obtains a domain space information matrix and a domain information representation matrix of each domain. Among them, the domain space information matrix contains the spatial distance information and spatial position information of the domain; the spatial distance information of the domain is the feature information obtained by extracting the information related to the road distance between each bicycle station in a single domain; the spatial position information of the domain is the feature information obtained by extracting the information related to the longitude and latitude coordinates of the two ends of the road between each bicycle station in a single domain. Among them, the domain information identification matrix can be used to reflect the interaction between bicycle stations. The current execution end embeds the domain space information matrix and the domain information identification matrix obtained above into the aggregate feature matrix to obtain an enhanced site feature matrix with domain information. In an embodiment of the present invention, the current execution end can better capture the domain correlation between sites by directly embedding the domain information into the site interaction matrix, thereby improving the expression ability of the graph representation.
[0094] 104. Perform feature extraction based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix, and obtain the final bicycle flow prediction result by linear transformation of the extracted features by the predictor.
[0095] In an embodiment of the present invention, the current execution end performs feature extraction processing based on the graph convolutional neural network, the aggregate feature matrix obtained in step 101, and the enhanced site feature matrix obtained in step 103 to obtain the features ultimately used for bicycle station traffic prediction. Since the above-mentioned aggregate feature matrix can effectively characterize the dependency relationship between bicycle stations and between different channel representations with different semantics, and since the above-mentioned enhanced site feature matrix embeds domain-related information, the features ultimately used for bicycle station traffic prediction can not only reflect the dependency relationship between bicycle stations and between different channel representations with different semantics, but also reflect the domain correlation between bicycle stations. After obtaining the features ultimately used for bicycle station traffic prediction, the current execution end uses the linear transformation of the predictor to obtain the prediction result of the final bicycle traffic. In an embodiment of the present invention, the predictor can be completed using a fully linked layer.
[0096] Further, as a refinement and extension of the above-mentioned specific implementation methods, in order to effectively capture the dependencies between sites and between different channel representations with different semantics, another bicycle flow prediction method is provided, such as Figure 2 As shown, the steps of extracting long-term and short-term features based on the flow input data and the flow output data to obtain an aggregated feature matrix of multiple sites include:
[0097] 201. Performing statistical processing on the flow input data and the flow output data in short-term and long-term terms respectively to obtain a short-term inflow matrix, a long-term inflow matrix, a short-term outflow matrix and a long-term outflow matrix;
[0098] In the embodiment of the present invention, the current execution end performs short-term and long-term statistical processing on the flow input data and flow output data of each bicycle station. In the short-term statistical processing, the inflow and outflow of each bicycle station in the past (same day) k time periods can be counted to obtain a short-term inflow matrix and a short-term outflow matrix, and {I t -k ,...,I t-i ,...,I t-2 ,I t-1} and {O t-k ,...,O t-i ,...,O t-2 ,O t-1}, where I t-i represents the flow input value of each bicycle station in the past i-th time period. If there are n bicycle stations, it contains n flow input values; t-i represents the flow output value of each bicycle station in the past i-th time period. If there are n bicycle stations, it contains n flow input values. In the long-term statistical processing, the inflow and outflow of each bicycle station in the same time period in the past d days can be counted to obtain the long-term inflow matrix and the long-term outflow matrix, and {I t-d×day ,...,I t -i×day ,...,I t-1×day} and {O t-d×day ,...,O t-i×day ,...,O t-1×day} to represent, where I t-i×day represents the flow input value of each bicycle station in the tth time period of the i-th day; t-i×day It represents the flow output value of each bicycle station in the t-th time period of the i-th day, which is not specifically limited in the embodiment of the present invention.
[0099] 202. Fusing the flow information of the short-term inflow matrix and the short-term outflow matrix in different time periods to obtain a short-term inflow embedding tensor and a short-term outflow embedding tensor; and fusing the flow information of the long-term inflow matrix and the long-term outflow matrix on different dates to obtain a long-term inflow embedding tensor and a long-term outflow embedding tensor;
[0100] In the embodiment of the present invention, the current execution end fuses the flow information of the short-term inflow matrix in different time periods to obtain the short-term inflow embedding tensor, including firstly performing data connection processing on the flow input data in the short-term inflow matrix containing multiple time periods according to the time dimension to obtain the short-term inflow data connection amount, such as {I t-k ,...,I t-i ,...,I t-2 ,I t-1 The flow input data in} are connected along the time dimension, and the obtained short-term inflow data connection volume is recorded as I S ∈R k×n×n , where n is the total number of bicycle stations and k is the total number of time periods. Then, the short-term inflow data connection volume is subjected to feature extraction processing to obtain the short-term inflow embedding tensor. For example, a 1×1 convolution kernel is used to fuse the flow information of different time periods to obtain the short-term inflow embedding tensor, which is recorded as I S ∈R n×n Similarly, the current execution end fuses the flow information of the short-term outflow matrix in different time periods to obtain the short-term outflow embedding tensor, including firstly connecting the flow output data in the short-term outflow matrix containing multiple time periods according to the time dimension to obtain the short-term outflow data connection amount, such as {O t-k ,...,O t-i ,...,O t -2 ,O t-1 The flow output values in} are connected along the time dimension, and the obtained short-term outflow data connection volume is recorded as O S ∈R k×n×n Then, feature extraction is performed on the short-term outflow data connection volume to obtain the short-term outflow embedding tensor. For example, a 1×1 convolution kernel is used to fuse the flow information of different time periods to obtain the short-term outflow embedding tensor, which is recorded as O S ∈R n×n .
[0101] In addition, the current execution end also fuses the flow information of the long-term inflow matrix on different dates to obtain a long-term inflow embedding tensor, including first performing data connection processing on the flow input data in the long-term inflow matrix containing multiple dates according to the time dimension to obtain the long-term inflow data connection amount, such as {I t-d×day ,...,I t-i×day ,...,I t-1×day The flow input values in} are connected along the time dimension, and the long-term inflow data connection volume is recorded as I L ∈R d×n×n Then, feature extraction is performed on the long-term inflow data connection volume to obtain the long-term inflow embedding tensor. For example, a 1×1 convolution kernel is used to fuse the flow information of different time periods to obtain the long-term inflow embedding tensor, which is recorded as IL ∈R n×n Similarly, the current execution end fuses the flow information of the long-term outflow matrix on different dates to obtain a long-term outflow embedding tensor, including first performing data connection processing on the flow output data in the long-term outflow matrix containing multiple dates according to the time dimension to obtain the long-term outflow data connection amount, such as {O t-d×day ,...,O t-i×day ,...,O t-1×day The flow output values in} are connected along the time dimension, and the long-term outflow data connection volume is recorded as O L ∈R d×n×n Then, feature extraction is performed on the long-term outflow data connection volume to obtain the long-term outflow embedding tensor. For example, a 1×1 convolution kernel is used to fuse the flow information of different time periods to obtain the long-term outflow embedding tensor, which is recorded as O L ∈R n×n , the embodiments of the present invention are not specifically limited.
[0102] 203. Perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor using an alternating feedback attention mechanism to obtain the aggregated feature matrix.
[0103] In the embodiment of the present invention, the current execution end uses an alternating feedback attention mechanism to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor, and the long-term outflow embedding tensor to obtain an aggregate feature matrix containing information related to multiple bicycle stations. For example, when the total number of bicycle stations in step 202 is n, the obtained aggregate feature matrix can represent the relevant information of the n bicycle stations, etc., which is not specifically limited in the embodiment of the present invention.
[0104] Furthermore, as a refinement and extension of the above-mentioned specific implementation methods, in order to integrate the feature representations of different channels so as to comprehensively consider multiple aspects of information, thereby improving the model's understanding and expression capabilities of the site, another bicycle flow prediction method is provided, such as Figure 3 As shown, the step adopts an alternating feedback attention mechanism to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor to obtain the aggregated feature matrix, including:
[0105] 301. Use four learnable linear mapping tensors to perform linear mapping processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor, and the long-term outflow embedding tensor respectively, to obtain four dimensionally aligned feature matrices, including a short-term inflow mapping matrix, a short-term outflow mapping matrix, a long-term inflow mapping matrix, and a long-term outflow mapping matrix;
[0106] In the embodiment of the present invention, the current execution end sets 4 learnable linear mapping tensors, such as W InS ∈R 1×k , W InL ∈R 1×d , W OutS ∈R 1×k , W OutL ∈R 1×d Then, the above four learnable linear mapping tensors are used to embed the short-term inflow tensor I obtained in step 203 S ∈R n×n , short-term outflow embedding tensor O S ∈R n×n , long-term inflow embedding tensor I L ∈R n×n and the long-term outflow embedding tensor O L ∈R n×n Perform linear mapping processing respectively to obtain four dimensionally aligned feature matrices, recorded as They represent the short-term inflow mapping matrix, the long-term inflow mapping matrix, the short-term outflow mapping matrix, and the long-term outflow mapping matrix respectively.
[0107] 302. Performing a long-term and short-term dependency fusion process based on the short-term inflow mapping matrix, the short-term outflow mapping matrix, the long-term inflow mapping matrix, and the long-term outflow mapping matrix to obtain a site inflow feature and a site outflow feature;
[0108] In the embodiment of the present invention, the current execution end performs long-term and short-term dependency fusion processing based on the short-term inflow mapping matrix, the short-term outflow mapping matrix, the long-term inflow mapping matrix, and the long-term outflow mapping matrix. The specific formula of the fusion processing is as follows:
[0109]
[0110]
[0111] in, Follow the following calculation formula:
[0112]
[0113]
[0114] in, Similarly, where W∈R n×n It is a learnable parameter matrix, and its value will be randomly initialized. Each W is different, and the gradients they transmit during the specific neural network training process are also different, and the value change process is also different.
[0115] After the current execution end completes this step, the fused site inflow features are obtained. And site outflow characteristics
[0116] 303. Perform cross attention coding processing on the site inflow feature and the site outflow feature to obtain two attention coding features;
[0117] In the embodiment of the present invention, the current execution end performs the site inflow feature obtained in step 302. and site outflow characteristics Perform cross-attention encoding processing. Specifically, in the encoding process, they can be alternately used as query matrix Q and key value matrix K and V for two cross-attention encodings. The specific calculation formula is as follows:
[0118]
[0119] in, It means that the site inflow features are used as the query matrix Q, and the site outflow features are used as the key-value matrices K and V, and vice versa. The dimensions of the Q, K, and V matrices are all n, where n is also the number of sites.
[0120] 304. Perform fusion processing on the attention encoding features to obtain the aggregated feature matrix.
[0121] In the embodiment of the present invention, the current execution end performs a fusion process on the two attention encoding features obtained in step 303 to obtain an aggregated feature matrix of n bicycle stations, which is recorded as F.
[0122] Furthermore, as a refinement and extension of the above-mentioned specific implementation methods, in order to embed domain information into the feature vector space to improve the representation of features, so that the model can more easily learn features with single domain characteristics and improve the performance of the model, another bicycle flow prediction method is provided, such as Figure 4 As shown, the steps to determine the domain space information matrix of each domain include:
[0123] 401. Acquire the longitude and latitude coordinates of the bicycle stations contained in each domain, and calculate the spherical distance between two bicycle stations based on the longitude and latitude coordinates to obtain a road information matrix containing the spherical distance;
[0124] In the embodiment of the present invention, the current execution end obtains the longitude and latitude coordinates of the bicycle stations contained in each domain, and the longitude and latitude coordinates can locate the specific position of the bicycle station in space. The current execution end calculates the spherical distance between two bicycle stations based on the longitude and latitude coordinates to approximate the road length, such as using the Haversine spherical distance calculation formula for calculation, and the specific formula is as follows:
[0125]
[0126]
[0127] d=R·c.
[0128] in, is the latitude difference between the two bike stations, Δλ is the longitude difference between the two bike stations, are the latitudes of the two bicycle stations, R is the average radius of the earth, and d is the final spherical distance. For each station, the spherical distance is calculated with all other stations to approximate the road distance between different stations, and the road information matrix can be obtained.
[0129] 402. Combine the stations in the domain in pairs, and determine the longitude and latitude coordinates of two bicycle stations in the station combination as the longitude and latitude coordinates of the starting point and the longitude and latitude coordinates of the end point respectively;
[0130] In an embodiment of the present invention, the current execution end defines the combination of each station and any other station as a road, so the stations in the current domain are combined in pairs, and the longitude and latitude coordinates of the two bicycle stations in the station combination are respectively determined as the starting longitude and latitude coordinates and the end longitude and latitude coordinates.
[0131] 403. Using the latitude and longitude coordinates of the starting point and the latitude and longitude coordinates of the end point as inputs of a multi-layer perceptron, and obtaining a spatial position information matrix after processing by the multi-layer perceptron;
[0132] 404. The road information matrix and the spatial position information matrix are integrated to obtain the domain spatial information matrix of each domain.
[0133] In an embodiment of the present invention, the current execution end intends to use multi-layer perceptron (MLP) technology to learn and represent the data features of spatial coordinates. The latitude and longitude coordinates of the starting point and the latitude and longitude coordinates of the end point of each road are used as the input of the multi-layer perceptron (MLP), and the spatial position information matrix of the current domain is obtained after being processed by the multi-layer perceptron. After obtaining the above road information matrix and spatial position information matrix, the current execution end fuses the above two matrices to obtain the domain spatial information matrix of each domain.
[0134] Furthermore, as a refinement and extension of the above-mentioned specific implementation methods, in order to directly integrate the domain information into the site interaction matrix to enhance the representation of the graph structure, another bicycle flow prediction method is provided, such as Figure 5 As shown, the steps of determining the domain information identification matrix of each domain include:
[0135] 501. Configure a domain identification value for each divided domain, and construct an initial domain information identification matrix of the same size as the aggregated feature matrix;
[0136] In an embodiment of the present invention, the current execution end configures a domain identification value for each divided domain, and the domain identification value can be used to distinguish the divided domains. For example, after multiple bicycle stations are divided into 8 domains, the identification values configured for these 8 domains are 1, 2, 3, ..., 8, etc., which are not specifically limited in the embodiment of the present invention.
[0137] In addition, in order to combine domain information with site interaction, the current execution end also constructs a domain information identification initial matrix of the same size as the aggregated feature matrix in step 101; if the aggregated feature matrix is an n*n matrix, where n is the number of sites. Then the constructed domain information identification initial matrix is also an n*n matrix, which is not specifically limited in the embodiment of the present invention.
[0138] 502. Scan the bicycle stations included in each domain, and determine the target element position corresponding to the element feature representing the interaction between bicycle stations in the same domain in the aggregate feature matrix;
[0139] In an embodiment of the present invention, the current execution end scans the bicycle stations contained in each domain, and determines the target element position corresponding to the element feature characterizing the interaction between bicycle stations in the same domain in the aggregated feature matrix; for example, station 1 and station 2 are divided into the same domain, then the target element position is determined in the aggregated feature matrix as (1, 2) and (2, 1); station 3 and station 8 are divided into the same domain, then the target element position is determined in the aggregated feature matrix as (3, 8) and (8, 3), etc., which is not specifically limited in the embodiment of the present invention.
[0140] 503. Determine the element value at the target element position in the domain information identification initial matrix as the corresponding domain identification value; and determine the element value at the non-target element position in the domain information identification initial matrix as 0, to obtain the domain information identification matrix.
[0141] In an embodiment of the present invention, the current execution end determines the element value at the target element position in the domain information identification initial matrix as the corresponding domain identification value. For example, if site 1 and site 2 are divided into domain 1 in step 502, the element values at the corresponding target element positions (1, 2) and (2, 1) are both determined to be 1; if site 3 and site 8 are divided into domain 2, the element values at the corresponding target element positions (3, 8) and (8, 3) are both determined to be 2, etc., and the embodiment of the present invention does not make specific limitations. In addition, the current execution end determines the element values at the non-target element positions in the domain information identification initial matrix to be 0, which means that they do not belong to the same domain. After the element values at all element positions in the domain information identification initial matrix are determined, the domain information identification matrix is obtained.
[0142] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to embed domain information directly into the site interaction matrix, the domain correlation between sites can be better captured, thereby improving the expression ability of graph representation, another bicycle flow prediction method is provided, the steps of performing feature extraction processing based on a graph convolutional neural network, the aggregated feature matrix and the enhanced site feature matrix, including:
[0143] A first graph convolutional neural network is used to extract spatiotemporal joint features between each bicycle station from the aggregate feature matrix;
[0144] Using a domain-aware layer in a second graph convolutional neural network to extract distinguishing information of each domain from the enhanced site feature matrix, and obtaining a weight matrix representing the importance of each domain;
[0145] The spatiotemporal joint feature is multiplied by the weight matrix to obtain a final feature representation.
[0146] In an embodiment of the present invention, the current execution end intends to use two graph neural networks (a first graph convolutional neural network and a second graph convolutional neural network) to capture spatiotemporal joint dependencies. The specific steps are: using the first graph convolutional neural network to extract the spatiotemporal joint features between each bicycle station from the aggregate feature matrix obtained in step 101, that is, capturing the traffic dependency between the stations. The domain perception layer in the second graph convolutional neural network is used to extract the distinguishing information of each domain from the enhanced station feature matrix obtained in step 103, and obtain a weight matrix that characterizes the importance of each domain; the weight parameters learned in the above domain perception layer can be used to represent the importance of different domains. These weights can reflect the contribution of the patterns learned from different domains, or be used to adjust the fusion method between the station aggregation features and the domain information. It is intended to use the above two parts of the graph neural network to obtain the original aggregation features embedded with traffic dependency and the weight matrix obtained based on the enhanced station features embedded with the spatial information and domain identification information in the domain, and the two matrices are multiplied to obtain the final feature representation.
[0147] The embodiment of the present invention provides a method for predicting bicycle flow. Compared with the prior art, the present invention obtains the flow input data and flow output data of each bicycle station, and extracts long-term and short-term features based on the flow input data and the flow output data to obtain an aggregate feature matrix of multiple bicycle stations; obtains the station inflow features and station outflow features obtained in the long-term and short-term feature extraction process, and divides the multiple bicycle stations into multiple domains based on the station inflow features and the station outflow features; determines the domain space information matrix and the domain information identification matrix of each domain, and embeds the domain space information matrix and the domain information identification matrix into the aggregate feature matrix to obtain an enhanced station feature matrix with domain information; performs feature extraction processing based on a graph convolutional neural network, the aggregate feature matrix and the enhanced station feature matrix, and obtains the final bicycle flow prediction result through the linear transformation of the extracted features by the predictor, thereby realizing accurate prediction of bicycle flow. The present invention combines the graph neural network and spatiotemporal data processing technology, and can better process complex data related to bicycle flow with spatiotemporal association. The present invention utilizes the characteristics of graph neural networks to learn the spatiotemporal correlation between bicycle flow data, and analyzes the importance of different stations in the overall spatiotemporal relationship in spatiotemporal data with different spatial domains. Based on the feature extraction method of alternating feedback attention and the domain-aware learning method, it better captures the bicycle flow relations in different spatial domains and the complex semantic relations under the representation of different data dimensions, thereby improving the prediction accuracy of bicycle flow spatiotemporal data.
[0148] As the above Figure 1 The embodiment of the present invention provides a bicycle flow prediction device, such as Figure 6 As shown, the device comprises:
[0149] A feature extraction module 61 is used to obtain flow input data and flow output data of each bicycle station, and perform long-term and short-term feature extraction based on the flow input data and the flow output data to obtain an aggregate feature matrix of multiple bicycle stations;
[0150] A domain division module 62, configured to obtain the site inflow feature and the site outflow feature obtained in the long-term and short-term feature extraction process, and divide the plurality of bicycle sites into a plurality of domains based on the site inflow feature and the site outflow feature;
[0151] A domain information embedding module 63 is used to determine a domain space information matrix and a domain information identification matrix of each domain, and embed the domain space information matrix and the domain information identification matrix into the aggregated feature matrix to obtain an enhanced site feature matrix with domain information;
[0152] The perception and prediction module 64 is used to perform feature extraction processing based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix, and obtain the final bicycle flow prediction result by linear transformation of the extracted features by the predictor.
[0153] Further, the feature extraction module 61 includes a statistical unit, a data fusion unit and a feature aggregation unit;
[0154] The statistical unit is used to perform statistical processing on the flow input data and the flow output data in short-term and long-term terms respectively, to obtain a short-term inflow matrix, a long-term inflow matrix, a short-term outflow matrix and a long-term outflow matrix;
[0155] The data fusion unit is used to fuse the flow information of the short-term inflow matrix and the short-term outflow matrix in different time periods to obtain a short-term inflow embedding tensor and a short-term outflow embedding tensor; and to fuse the flow information of the long-term inflow matrix and the long-term outflow matrix on different dates to obtain a long-term inflow embedding tensor and a long-term outflow embedding tensor;
[0156] The feature aggregation unit is used to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor by adopting an alternating feedback attention mechanism to obtain the aggregated feature matrix.
[0157] Furthermore, the data fusion unit is also used for:
[0158] Performing data connection processing on the flow input data and flow output data in the short-term inflow matrix and the short-term outflow matrix containing multiple time periods respectively according to the time dimension to obtain the short-term inflow data connection volume and the short-term outflow data connection volume;
[0159] Performing feature extraction processing on the short-term inflow data connection amount and the short-term outflow data connection amount respectively to obtain the short-term inflow embedding tensor and the short-term outflow embedding tensor;
[0160] Performing data connection processing on the flow input data and flow output data in the long-term inflow matrix and the long-term outflow matrix containing multiple dates respectively according to the time dimension to obtain the long-term inflow data connection volume and the long-term outflow data connection volume;
[0161] Feature extraction processing is performed on the long-term inflow data connection quantity and the long-term outflow data connection quantity respectively to obtain the long-term inflow embedding tensor and the long-term outflow embedding tensor.
[0162] Furthermore, the feature aggregation unit is also used for:
[0163] Using four learnable linear mapping tensors to perform linear mapping processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor respectively, to obtain four dimensionally aligned feature matrices, including a short-term inflow mapping matrix, a short-term outflow mapping matrix, a long-term inflow mapping matrix and a long-term outflow mapping matrix;
[0164] Performing a long-term and short-term dependency fusion process based on the short-term inflow mapping matrix, the short-term outflow mapping matrix, the long-term inflow mapping matrix, and the long-term outflow mapping matrix to obtain a site inflow feature and a site outflow feature;
[0165] Performing cross-attention coding processing on the site inflow feature and the site outflow feature to obtain two attention coding features;
[0166] The attention encoding features are fused to obtain the aggregated feature matrix.
[0167] Further, the domain information embedding module 63 includes a domain space information extraction unit and a domain information identification unit;
[0168] The domain space information extraction unit is used for:
[0169] Acquire the longitude and latitude coordinates of the bicycle stations contained in each domain, and calculate the spherical distance between two bicycle stations based on the longitude and latitude coordinates to obtain a road information matrix containing the spherical distance;
[0170] Combine the stations in the domain in pairs, and determine the longitude and latitude coordinates of the two bicycle stations in the station combination as the longitude and latitude coordinates of the starting point and the longitude and latitude coordinates of the end point respectively;
[0171] The latitude and longitude coordinates of the starting point and the latitude and longitude coordinates of the end point are used as inputs of a multi-layer perceptron, and a spatial position information matrix is obtained after being processed by the multi-layer perceptron;
[0172] The road information matrix and the spatial position information matrix are fused to obtain the domain spatial information matrix of each domain.
[0173] The domain information identification unit is used for:
[0174] Configure a domain identification value for each divided domain, and construct an initial domain information identification matrix of the same size as the aggregate feature matrix;
[0175] Scanning the bicycle stations contained in each domain, and determining the target element position corresponding to the element feature representing the interaction between bicycle stations in the same domain in the aggregate feature matrix;
[0176] The element value at the target element position in the domain information identification initial matrix is determined as the corresponding domain identification value; and the element value at the non-target element position in the domain information identification initial matrix is determined as 0, so as to obtain the domain information identification matrix.
[0177] Furthermore, the perception and prediction module 64 is also used for:
[0178] A first graph convolutional neural network is used to extract spatiotemporal joint features between each bicycle station from the aggregate feature matrix;
[0179] Using a domain-aware layer in a second graph convolutional neural network to extract distinguishing information of each domain from the enhanced site feature matrix, and obtaining a weight matrix representing the importance of each domain;
[0180] The spatiotemporal joint feature is multiplied by the weight matrix to obtain a final feature representation.
[0181] The embodiment of the present invention provides a prediction device for bicycle flow. Compared with the prior art, the present invention obtains flow input data and flow output data of each bicycle station, and extracts long-term and short-term features based on the flow input data and the flow output data to obtain an aggregate feature matrix of multiple bicycle stations; obtains station inflow features and station outflow features obtained in the long-term and short-term feature extraction process, and divides multiple bicycle stations into multiple domains based on the station inflow features and the station outflow features; determines the domain space information matrix and the domain information identification matrix of each domain, and embeds the domain space information matrix and the domain information identification matrix into the aggregate feature matrix to obtain an enhanced station feature matrix with domain information; performs feature extraction processing based on a graph convolutional neural network, the aggregate feature matrix and the enhanced station feature matrix, and obtains the final bicycle flow prediction result through the linear transformation of the extracted features by the predictor, thereby realizing accurate prediction of bicycle flow. The present invention combines the graph neural network and spatiotemporal data processing technology, and can better process complex data related to bicycle flow with spatiotemporal association. The present invention utilizes the characteristics of graph neural networks to learn the spatiotemporal correlation between bicycle flow data, and analyzes the importance of different stations in the overall spatiotemporal relationship in spatiotemporal data with different spatial domains. Based on the feature extraction method of alternating feedback attention and the domain-aware learning method, it better captures the bicycle flow relations in different spatial domains and the complex semantic relations under the representation of different data dimensions, thereby improving the prediction accuracy of bicycle flow spatiotemporal data.
[0182] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the bicycle flow prediction method in any of the above method embodiments.
[0183] Figure 7 A schematic diagram of the structure of a computer device provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computer device.
[0184] like Figure 7 As shown, the computer device may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .
[0185] The processor 702 , the communication interface 704 , and the memory 706 communicate with each other via a communication bus 708 .
[0186] The communication interface 704 is used to communicate with other devices such as clients or other servers.
[0187] The processor 702 is used to execute the program 710, and specifically can execute the relevant steps of the above-mentioned bicycle flow prediction method.
[0188] Specifically, the program 710 may include program codes, which include computer operation instructions.
[0189] The processor 702 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0190] The memory 706 is used to store the program 710. The memory 706 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0191] The program 710 may be specifically configured to enable the processor 702 to perform the following operations:
[0192] Obtaining flow input data and flow output data of each bicycle station, and performing long-term and short-term feature extraction based on the flow input data and the flow output data to obtain an aggregated feature matrix of multiple bicycle stations;
[0193] Acquire the station inflow feature and the station outflow feature obtained in the long-term and short-term feature extraction process, and divide the plurality of bicycle stations into a plurality of domains based on the station inflow feature and the station outflow feature;
[0194] Determine a domain space information matrix and a domain information identification matrix of each domain, and embed the domain space information matrix and the domain information identification matrix into the aggregate feature matrix to obtain an enhanced site feature matrix with domain information;
[0195] Feature extraction processing is performed based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix, and the extracted features are transformed linearly by the predictor to obtain the final bicycle flow prediction result.
[0196] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0197] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for predicting bicycle flow, characterized in that: include: Obtaining flow input data and flow output data of each bicycle station, and performing long-term and short-term feature extraction based on the flow input data and the flow output data to obtain an aggregated feature matrix of the plurality of bicycle stations; Acquire the station inflow feature and the station outflow feature obtained in the long-term and short-term feature extraction process, and divide the plurality of bicycle stations into a plurality of domains based on the station inflow feature and the station outflow feature; Determine a domain space information matrix and a domain information identification matrix of each domain, and embed the domain space information matrix and the domain information identification matrix into the aggregate feature matrix to obtain an enhanced site feature matrix with domain information; Feature extraction processing is performed based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix, and the extracted features are transformed linearly by the predictor to obtain the prediction result of bicycle flow.
2. The method according to claim 1, characterized in that The extracting of long-term and short-term features based on the flow input data and the flow output data to obtain an aggregated feature matrix of the plurality of bicycle stations includes: Performing statistical processing on the flow input data and the flow output data in short-term and long-term terms respectively to obtain a short-term inflow matrix, a long-term inflow matrix, a short-term outflow matrix and a long-term outflow matrix; The flow information of the short-term inflow matrix and the short-term outflow matrix in different time periods is fused to obtain a short-term inflow embedding tensor and a short-term outflow embedding tensor; and the flow information of the long-term inflow matrix and the long-term outflow matrix on different dates is fused to obtain a long-term inflow embedding tensor and a long-term outflow embedding tensor; An alternating feedback attention mechanism is used to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor to obtain the aggregated feature matrix.
3. The method according to claim 2, characterized in that The fusing the flow information of the short-term inflow matrix and the short-term outflow matrix in different time periods to obtain a short-term inflow embedding tensor and a short-term outflow embedding tensor includes: Performing data connection processing on the flow input data and flow output data in the short-term inflow matrix and the short-term outflow matrix containing multiple time periods respectively according to the time dimension to obtain the short-term inflow data connection volume and the short-term outflow data connection volume; Performing feature extraction processing on the short-term inflow data connection amount and the short-term outflow data connection amount respectively to obtain the short-term inflow embedding tensor and the short-term outflow embedding tensor; The fusing the flow information of the long-term inflow matrix and the long-term outflow matrix on different dates to obtain a long-term inflow embedding tensor and a long-term outflow embedding tensor includes: Performing data connection processing on the flow input data and flow output data in the long-term inflow matrix and the long-term outflow matrix containing multiple dates respectively according to the time dimension to obtain the long-term inflow data connection volume and the long-term outflow data connection volume; Feature extraction processing is performed on the long-term inflow data connection quantity and the long-term outflow data connection quantity respectively to obtain the long-term inflow embedding tensor and the long-term outflow embedding tensor.
4. The method according to claim 2, characterized in that The adopting of the alternating feedback attention mechanism to perform feature fusion processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor to obtain the aggregated feature matrix includes: Using four learnable linear mapping tensors to perform linear mapping processing on the short-term inflow embedding tensor, the short-term outflow embedding tensor, the long-term inflow embedding tensor and the long-term outflow embedding tensor respectively, to obtain four dimensionally aligned feature matrices, including a short-term inflow mapping matrix, a short-term outflow mapping matrix, a long-term inflow mapping matrix and a long-term outflow mapping matrix; Performing a long-term and short-term dependency fusion process based on the short-term inflow mapping matrix, the short-term outflow mapping matrix, the long-term inflow mapping matrix, and the long-term outflow mapping matrix to obtain a site inflow feature and a site outflow feature; Performing cross-attention coding processing on the site inflow feature and the site outflow feature to obtain two attention coding features; The attention encoding features are fused to obtain the aggregated feature matrix.
5. The method according to claim 1, characterized in that The determining of the domain space information matrix of each domain includes: Acquire the longitude and latitude coordinates of the bicycle stations contained in each domain, and calculate the spherical distance between two bicycle stations based on the longitude and latitude coordinates to obtain a road information matrix containing the spherical distance; Combine the stations in the domain in pairs, and determine the longitude and latitude coordinates of the two bicycle stations in the station combination as the longitude and latitude coordinates of the starting point and the longitude and latitude coordinates of the end point respectively; The latitude and longitude coordinates of the starting point and the latitude and longitude coordinates of the end point are used as inputs of a multi-layer perceptron, and a spatial position information matrix is obtained after being processed by the multi-layer perceptron; The road information matrix and the spatial position information matrix are fused to obtain the domain spatial information matrix of each domain.
6. The method according to claim 1, characterized in that The determining of the domain information identification matrix of each domain includes: Configuring a domain identification value for each divided domain, and constructing an initial matrix of domain information identification having the same size as the aggregated feature matrix; Scanning the bicycle stations contained in each domain, and determining the target element position corresponding to the element feature representing the interaction between bicycle stations in the same domain in the aggregate feature matrix; The element value at the target element position in the domain information identification initial matrix is determined as the corresponding domain identification value; and the element value at the non-target element position in the domain information identification initial matrix is determined as 0, so as to obtain the domain information identification matrix.
7. The method according to any one of claims 1 to 6, characterized in that: The feature extraction process based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix includes: A first graph convolutional neural network is used to extract spatiotemporal joint features between each bicycle station from the aggregate feature matrix; Using a domain-aware layer in a second graph convolutional neural network to extract distinguishing information of each domain from the enhanced site feature matrix, and obtaining a weight matrix representing the importance of each domain; The spatiotemporal joint feature is multiplied by the weight matrix to obtain a feature representation.
8. A bicycle flow prediction device, characterized in that: include: A feature extraction module, used to obtain flow input data and flow output data of each bicycle station, and perform long-term and short-term feature extraction based on the flow input data and the flow output data to obtain an aggregate feature matrix of the plurality of bicycle stations; A domain division module, used for obtaining the site inflow feature and the site outflow feature obtained in the long-term and short-term feature extraction process, and dividing the plurality of bicycle sites into a plurality of domains based on the site inflow feature and the site outflow feature; A domain information embedding module, used to determine a domain space information matrix and a domain information identification matrix of each domain, and embed the domain space information matrix and the domain information identification matrix into the aggregated feature matrix to obtain an enhanced site feature matrix with domain information; The perception and prediction module is used to perform feature extraction processing based on the graph convolutional neural network, the aggregate feature matrix and the enhanced site feature matrix, and obtain the prediction result of bicycle flow by linear transformation of the extracted features by the predictor.
9. A storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction executes an operation corresponding to the bicycle flow prediction method according to any one of claims 1 to 7.
10. A computer device, comprising a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the bicycle flow prediction method according to any one of claims 1-7.
Citation Information
Patent Citations
Urban area flow prediction system and method for vehicle track big data
CN113724504A
Method and apparatus for spatial aggregation for location-based services
US20240087448A1
Cited By
Urban people flow prediction method based on urban interest point spatio-temporal data set
CN120821893A
A city passenger flow prediction method based on city interest point spatio-temporal data set
CN120821893B
