Online ride-hailing order demand prediction method based on spatiotemporal contextual attention network

Through the prediction method based on the space-time context attention network, the problem of inaccurate forecasting of online car-hailing orders is solved, the prediction accuracy and operational efficiency are improved, and the air driving rate of online car-hailing is reduced.

CN112150207BActive Publication Date: 2025-01-14WUHAN UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011061820.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2025-01-14
Estimated Expiration
2040-09-30

AI Technical Summary

Technical Problem

The existing technology cannot accurately predict the demand for online car-hailing orders, resulting in inefficient operation problems such as long waiting times for passengers and many no-load operations.

Method used

Using the prediction method based on the spatiotemporal context attention network, the prediction model of spatiotemporal context attention network is constructed by obtaining historical travel demand data of online ride-hailing in urban areas, dividing grid areas of equal scales, and using TRELLIS-GRU and GAT layers to integrate spatiotemporal features. and spatial dependencies, train the model to predict new order data.

Benefits of technology

It improves the prediction accuracy of online car-hailing order demand, helps to reasonably allocate resources, reduces empty driving rates, and improves operational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112150207B_ABST
    Figure CN112150207B_ABST
Patent Text Reader

Abstract

In order to more reasonably allocate online car-hailing resources, reduce the idle rate of online car-hailing, and improve the operating efficiency of online car-hailing, the present invention provides an online car-hailing order demand prediction method based on spatiotemporal contextual attention network, in which the network model constructed includes stacked spatiotemporal blocks and an output block, each spatiotemporal block includes TRELLIS-GRU and GAT, TRELLIS-GRU is a gated recurrent grid network, GAT is a graph attention network, TRELLIS-GRU layer is used to fuse spatiotemporal features, and GAT layer is used to mine spatial dependencies in different time segments. The present invention fully considers the impact of the spatial position of the urban area itself, the relationship between different areas, and the time dependency of historical orders in multiple time periods on the demand for online car-hailing orders, thereby improving the accuracy of the demand for online car-hailing orders in urban areas.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the interdisciplinary field of urban transportation planning and deep learning, and in particular to a method for predicting demand for online car-hailing orders based on a spatiotemporal contextual attention network. Background Art

[0002] With the rapid economic development and the rise of new modes of travel such as Didi Chuxing and Dongfeng Chuxing, online ride-hailing has become an important mode of public transportation. As of 2019, the proportion of online ride-hailing passenger volume in the total taxi passenger volume has reached 36.3%. The current online ride-hailing service still has some inefficient operation problems, such as long waiting time for passengers and a high number of empty vehicle operations. Summary of the invention

[0003] The present invention proposes a method for predicting online car-hailing order demand based on a spatiotemporal contextual attention network, which is used to solve or at least partially solve the technical problem that the existing methods cannot accurately predict the demand for online car-hailing orders.

[0004] In order to solve the above technical problems, the present invention provides a method for predicting online car-hailing order demand based on spatiotemporal contextual attention network, comprising:

[0005] S1: Obtain historical travel demand data of online ride-hailing services in urban areas;

[0006] S2: Divide the urban area into grid areas of equal scale according to the preset division rules;

[0007] S3: Construct a spatiotemporal contextual attention network prediction model and use the training data to train the constructed prediction model, where the spatiotemporal contextual attention network prediction model includes stacked spatiotemporal blocks and an output block. Each spatiotemporal block includes TRELLIS-GRU and GAT. TRELLIS-GRU is a gated recurrent grid network and GAT is a graph attention network. The TRELLIS-GRU layer is used to fuse spatiotemporal features, and the GAT layer is used to mine spatial dependencies in different time segments. The training data is obtained based on the historical travel demand data and the divided grid areas, which are the ride demand data corresponding to each grid area.

[0008] S4: Use the trained spatiotemporal contextual attention network prediction model to predict new order data.

[0009] In one embodiment, after step S1, the method further includes:

[0010] Perform abnormal data clearing or repair operations on the acquired historical travel demand data.

[0011] In one embodiment, the acquired online car-hailing historical travel demand data includes but is not limited to the longitude of the boarding point, the latitude of the boarding point, the boarding timestamp, the longitude of the boarding point, the latitude of the boarding point, the boarding timestamp, and the order fee. The acquired historical travel demand data is cleared or repaired for abnormal data, including:

[0012] When there is a blank value in the order information, the order is cleared, and the order is the historical travel demand data of the online car-hailing service obtained;

[0013] When the offset between the longitude and latitude of the pickup point or the longitude and latitude of the drop-off point in the order and the city area is greater than the offset threshold, or the difference between the pickup timestamp and the drop-off timestamp is greater than the time threshold, or the order fee is higher than the fee threshold, the order information is determined to be abnormal and the order is cleared;

[0014] Use Baidu Map path length calculation API to estimate order journey and order cost, calculate the cost per kilometer, judge abnormal orders by setting the normal value threshold range, and clear or fit and repair abnormal orders.

[0015] In one embodiment, S2 includes:

[0016] S2.1: Divide the urban area into H×W grid areas L{H,W} of equal scale according to the preset division rules, then L[h,w] represents the grid area of ​​the hth row and the wth column;

[0017] S2.2: Define a grid area as a node v, define the relationship between two grid areas as an edge e, and use the graph G = (V, E)' to represent the inter-regional traffic connection matrix, where V represents a node, E represents an edge, and G∈R N′×N′ , R represents the real number domain, N′=H×W, N′ represents the number of grids;

[0018] S2.3: Divide a day into several time periods according to preset time intervals, and count the ride demand in each area and time period based on the historical travel demand data of online ride-hailing services. and arrival volume And construct the inter-regional transportation connection matrix G based on the departure and destination;

[0019] S2.4: Use the zero-score method to normalize ride demand and arrivals: X represents the demand or arrival volume of rides, μ = E(X) represents the mean value of X, represents the variance of X, X * Represents the standardized ride demand and arrival volume.

[0020] In one embodiment, during the training process in S3, the loss function selects the mean square error function Among them, Wθ are model parameters, X is the original value, is the predicted value.

[0021] In one embodiment, the specific processing method of the spatiotemporal contextual attention network prediction model in S3 includes:

[0022] S3.1: Use the position attention mechanism to extract the position relevance of the external input in each period and strengthen the characteristics of the input information. The calculation formula is as follows:

[0023] B = reshape(Conv2d(A,W1))

[0024] C = reshape(Conv2d(A,W2))

[0025]

[0026] D = reshape(Conv2d(A,W3))

[0027] X=reshape(S·D)+A

[0028] Among them, A∈R T×N×2 represents the input feature graph, T represents the length of the time series, N represents the number of regional nodes, {B,C,D}∈R M×2 Represents the intermediate layer feature map, M = T × N ′, S ∈ R M×M Represents the spatial attention map, X∈R T×N×2 Represents the feature map after being enhanced by the position attention mechanism. W1, W2, and W3 indicate that the convolution kernel weight parameters need to be learned. The reshape function can convert the size of the A dimension into the size of the B dimension. exp represents the exponential function.

[0029] S3.2: Use the TRELLIS-GRU layer to fuse spatiotemporal features. The TRELLIS-GRU layer consists of a Trellis grid network and a GRU gating mechanism. The calculation formula of the TRELLIS-GRU layer is as follows:

[0030]

[0031] Among them, x t ∈R N×2 represents the passenger demand and arrival volume of each regional node in time period t, Represents the hidden layer value of the jth layer of the Trellis network in time period t, represents the convolution kernel weight parameter that needs to be learned, σ represents the sigmoid activation function, represents the intermediate output vector;

[0032] S3.3: GAT uses the attention mechanism to determine the importance of each adjacent region to the central node, thereby learning the spatial features between nodes. The calculation formula of the GAT layer is as follows:

[0033]

[0034]

[0035] in, represents the correlation coefficient between node i and node j, represents the correlation coefficient between node i and node k, represents the hidden value of node i in layer h at time period t, N i represents the nodes adjacent to node i in time period t, parameter W increases the dimension of vertex features, [·||·] represents the concatenation of the features of node i and node j after dimension increase, and a(·) maps the concatenated features to a real number. represents the normalized attention coefficient, z h represents the output features of the jth TRELLIS-GRU hidden layer, Represents the output features of the information of the neighboring nodes of node i in time period t after the GAT network is integrated;

[0036] S3.4: Use the self-attention mechanism to select the hidden variables of all spatiotemporal layers to improve the model's mining of long-term dependencies, and concatenate the hidden variables of each spatiotemporal layer to obtain the feature map E = Cat (Z1, Z2, ..., Z d ),E∈R T ×N×C , where Z i represents the hidden variable output of the i-th spatiotemporal layer, d represents the number of spatiotemporal layers, T represents the length of the time series, N represents the number of regional nodes, and C represents the number of channels of the concatenated feature map; the linear function E is used to generate and Where R represents the real number domain, d k ,d v represents the number of channels, Q, K, and V represent query vector, key vector, and value vector respectively, and QKT represents the association relationship; the feature map is obtained using the self-attention mechanism

[0037] S3.5: Input the feature map Attention (Q, K, V) to the output layer to obtain the final prediction result. The output layer consists of two fully connected layers, and its calculation formula is as follows:

[0038]

[0039] Among them, fci represents the i-th fully connected layer, σ represents the LeakyRelu activation function, Represents the predicted value of the ride demand for N regional nodes in the next L time periods.

[0040] In one embodiment, S4 includes:

[0041] S4.1: Input the order data to be predicted into the trained spatiotemporal contextual attention network prediction model to obtain the output result

[0042] S4.2: Output results Denormalization is performed to obtain the final prediction result of ride demand. Where σ and μ are the variance and mean obtained by statistical standardization.

[0043] The above one or more technical solutions in the embodiments of the present application have at least one or more of the following technical effects:

[0044] The present invention provides a method for predicting online car-hailing order demand based on a spatiotemporal contextual attention network. The method first obtains historical travel demand data of online car-hailing in an urban area; divides the urban area into grid areas of equal scale according to a preset division rule; obtains training data based on the acquired historical travel demand data and the divided grid areas, that is, the ride demand data corresponding to each grid area; then constructs a spatiotemporal contextual attention network prediction model, and uses the training data to train the constructed prediction model, and finally uses the trained spatiotemporal contextual attention network prediction model to predict new order data.

[0045] The prediction model STCA consists of stacked spatiotemporal blocks and an output block, and adopts an attention mechanism to improve the efficiency of spatiotemporal feature mining. The spatiotemporal block consists of TRELLIS-GRU and GAT, where the TRELLIS-GRU layer is mainly responsible for fusing spatiotemporal features, and the GAT layer is mainly responsible for mining spatial dependencies in different time segments. The TRELLIS-GRU layer can take advantage of the Trellis network bridge convolution and recurrent architecture to fuse spatiotemporal features, and the introduction of the GRU gating mechanism can help enhance the efficiency of temporal feature selection. The GAT model uses the attention mechanism to determine the importance of each adjacent neighboring area to the central node, so that the spatial features between nodes can be well learned. Finally, the new order data is predicted by the trained spatiotemporal context attention network prediction model, which can improve the accuracy of the prediction, help to more reasonably allocate online car-hailing resources, reduce the empty driving rate of online car-hailing, and improve the operation efficiency of online car-hailing. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 A flowchart of a method for predicting online car-hailing order demand based on a spatiotemporal contextual attention network provided in an embodiment of the present invention;

[0048] Figure 2 This is a flow chart of abnormal data clearing based on Baidu Map in a specific embodiment;

[0049] Figure 3 It is a directed graph of traffic in each area based on the transformation of the adjacency matrix in the embodiment;

[0050] Figure 4 This is a diagram of the spatiotemporal contextual attention network structure in an embodiment. DETAILED DESCRIPTION

[0051] An embodiment of the present invention provides a method for predicting online car-hailing order demand based on a spatiotemporal contextual attention network, which is used to improve the technical problem of being unable to accurately predict online car-hailing order demand.

[0052] The main inventive concepts of the present invention are as follows:

[0053] Based on the knowledge in deep learning and transportation planning, and considering the spatial relationship between urban ride areas and the time dependency of historical orders, a method for predicting online ride-hailing order demand based on spatiotemporal contextual attention network is proposed. This method fully considers the impact of the spatial location of the urban area itself, the relationship between different areas, and the time dependency of historical orders in multiple time periods on the demand for online ride-hailing orders, thereby improving the accuracy of online ride-hailing order demand in urban areas.

[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] See also Figure 1 to Figure 4 The embodiment of the present invention provides a method for predicting online car-hailing order demand based on a spatiotemporal contextual attention network, comprising:

[0056] S1: Obtain historical travel demand data of online ride-hailing services in urban areas;

[0057] S2: Divide the urban area into grid areas of equal scale according to the preset division rules;

[0058] S3: Construct a spatiotemporal contextual attention network prediction model and use the training data to train the constructed prediction model, where the spatiotemporal contextual attention network prediction model includes stacked spatiotemporal blocks and an output block. Each spatiotemporal block includes TRELLIS-GRU and GAT. TRELLIS-GRU is a gated recurrent grid network and GAT is a graph attention network. The TRELLIS-GRU layer is used to fuse spatiotemporal features, and the GAT layer is used to mine spatial dependencies in different time segments. The training data is obtained based on the historical travel demand data and the divided grid areas, which are the ride demand data corresponding to each grid area.

[0059] S4: Use the trained spatiotemporal contextual attention network prediction model to predict new order data.

[0060] Specifically, the preset division rule may adopt an existing division rule, such as the Geohash algorithm. Based on the historical travel demand data, the ride demand and ride arrival volume in each area and each time period are obtained as the ride demand data corresponding to the grid area, that is, training data.

[0061] TRELLIS-GRU is a grid network with gated loops, GAT is a graph attention network, and Graph Attention Network (GAT) proposes to use the attention mechanism to weighted sum the features of neighboring nodes. In S2, after dividing the grid area, the demand for rides and the number of rides arriving in each area and time period are obtained based on historical travel demand data, and the traffic connection matrix between areas is constructed.

[0062] Figure 1 This is the overall implementation process of the online car-hailing order demand prediction method based on the spatiotemporal context attention network of the present invention. The division of urban online car-hailing ride areas corresponds to step S2, and the acquisition of urban online car-hailing travel data corresponds to step S1. The ride demand in each area and time period is obtained, that is, the training data is obtained.

[0063] In one embodiment, after step S1, the method further includes:

[0064] Perform abnormal data clearing or repair operations on the acquired historical travel demand data.

[0065] In one embodiment, the acquired online car-hailing historical travel demand data includes but is not limited to the longitude of the boarding point, the latitude of the boarding point, the boarding timestamp, the longitude of the boarding point, the latitude of the boarding point, the boarding timestamp, and the order fee. The acquired historical travel demand data is cleared or repaired for abnormal data, including:

[0066] When there is a blank value in the order information, the order is cleared, and the order is the historical travel demand data of the online car-hailing service obtained;

[0067] When the offset between the longitude and latitude of the pickup point or the longitude and latitude of the drop-off point in the order and the city area is greater than the offset threshold, or the difference between the pickup timestamp and the drop-off timestamp is greater than the time threshold, or the order fee is higher than the fee threshold, the order information is determined to be abnormal and the order is cleared;

[0068] Use Baidu Map path length calculation API to estimate order journey and order cost, calculate the cost per kilometer, judge abnormal orders by setting the normal value threshold range, and clear or fit and repair abnormal orders.

[0069] See also Figure 2 , which is a flow chart for removing abnormal data based on Baidu Maps.

[0070] In one implementation, step S2 specifically includes:

[0071] S2.1: Divide the urban area into H×W grid areas L{H,W} of equal scale according to the preset division rules, then L[h,w] represents the grid area of ​​the hth row and the wth column;

[0072] S2.2: Define a grid area as a node v, define the relationship between two grid areas as an edge e, and use the graph G = (V, E)' to represent the inter-regional traffic connection matrix, where V represents a node, E represents an edge, and G∈R N′×N′ , R represents the real number domain, N′=H×W, N′ represents the number of grids;

[0073] S2.3: Divide a day into several time periods according to preset time intervals, and count the ride demand in each area and time period based on the historical travel demand data of online ride-hailing services. and arrival volume And construct the inter-regional transportation connection matrix G based on the departure and destination;

[0074] S2.4: Use the zero-score method to normalize ride demand and arrivals: X represents the demand or arrival volume of rides, μ = E(X) represents the mean value of X, represents the variance of X, X * Represents the standardized ride demand and arrival volume.

[0075] Specifically, the estimated time interval can be set according to the situation. The passenger demand in each area and time period is calculated. and arrival volume The corresponding demand data for this area. Figure 4 , which is the traffic directed graph of each area based on the transformation of the adjacency matrix.

[0076] In one embodiment, during the training process in S3, the loss function selects the mean square error function Among them, W θ are model parameters, X is the original value, is the predicted value.

[0077] Specifically, the present invention defines the prediction task as: given a graph G and S historical time periods, the ride demand in each region and arrival volume Learn function f so that it can predict the demand for rides in each area in the next T time periods Right now in The representative concatenates the ride demand and arrival volume and uses them as the characteristics of each regional node.

[0078] The constructed spatiotemporal contextual attention network prediction model STCA, the main module of STCA consists of stacked spatiotemporal blocks and an output block, and adopts the attention mechanism to improve the efficiency of spatiotemporal feature mining. The spatiotemporal block consists of TRELLIS-GRU and GAT, where the TRELLIS-GRU layer is mainly responsible for fusing spatiotemporal features, and the GAT layer is mainly responsible for mining spatial dependencies in different time segments.

[0079] In one embodiment, the specific processing method of the spatiotemporal contextual attention network prediction model in S3 includes:

[0080] S3.1: Use the position attention mechanism to extract the position relevance of the external input in each period and strengthen the characteristics of the input information. The calculation formula is as follows:

[0081] B = reshape(Conv2d(A,W1))

[0082] C = reshape(Conv2d(A,W2))

[0083]

[0084] D = reshape(Conv2d(A,W3))

[0085] X=reshape(S·D)+A

[0086] Among them, A∈RT×N×2 represents the input feature graph, T represents the length of the time series, N represents the number of regional nodes, {B,C,D}∈R M×2 Represents the intermediate layer feature map, M = T × N ′, S ∈ RM × M Represents the spatial attention map, X∈R T×N×2 represents the feature map after being enhanced by the position attention mechanism, W1, W2, and W3 represent the weight parameters that need to be learned, the reshape function can convert the size of the A dimension into the size of the B dimension, and exp represents the exponential function;

[0087] S3.2: Use the TRELLIS-GRU layer to fuse spatiotemporal features. The TRELLIS-GRU layer consists of a Trellis grid network and a GRU gating mechanism. The calculation formula of the TRELLIS-GRU layer is as follows:

[0088]

[0089]

[0090] Among them, x t ∈R N×2 represents the passenger demand and arrival volume of each regional node in time period t, Represents the hidden layer value of the jth layer of the Trellis network in time period t, W′1, W′2, W′3, W4 represent the weight parameters to be learned, and σ represents the sigmoid activation function;

[0091] S3.3: GAT uses the attention mechanism to determine the importance of each adjacent region to the central node, thereby learning the spatial features between nodes. The calculation formula of the GAT layer is as follows:

[0092]

[0093]

[0094] in, represents the correlation coefficient between node i and node j, represents the correlation coefficient between node i and node k, represents the hidden value of node i in layer h at time period t, N i represents the nodes adjacent to node i in time period t, parameter W increases the dimension of vertex features, [·||·] represents the concatenation of the features of node i and node j after dimension increase, and a(·) maps the concatenated features to a real number. represents the normalized attention coefficient, z h represents the output features of the jth TRELLIS-GRU hidden layer, Represents the output features of the information of the neighboring nodes of node i in time period t after the GAT network is integrated;

[0095] S3.4: Use the self-attention mechanism to select the hidden variables of all spatiotemporal layers to improve the model's mining of long-term dependencies, and concatenate the hidden variables of each spatiotemporal layer to obtain the feature map E = Cat (Z1, Z2, ..., Z d ),E∈R T ×N×C , where Z i represents the hidden variable output of the i-th spatiotemporal layer, d represents the number of spatiotemporal layers, T represents the length of the time series, N represents the number of regional nodes, and C represents the number of channels of the concatenated feature map; the linear function E is used to generate and Where R represents the real number domain, d k ,d v represents the number of channels, Q, K, and V represent query vector, key vector, and value vector respectively, and QKT represents the association relationship; the feature map is obtained using the self-attention mechanism

[0096] S3.5: Input the feature map Attention (Q, K, V) to the output layer to obtain the final prediction result. The output layer consists of two fully connected layers, and its calculation formula is as follows:

[0097]

[0098] Among them, fc i represents the i-th fully connected layer, σ represents the LeakyRelu activation function, Represents the predicted value of the ride demand for N regional nodes in the next L time periods.

[0099] Specifically, the external input in S3.1 can be training data, test data, or order data to be predicted. Conv2d represents a two-dimensional convolution operation, and W1, W2, and W3 represent the convolution kernel weight parameters acting on the input feature map.

[0100] In S3.2, the TRELLIS-GRU layer is used to fuse spatiotemporal features. TRELLIS-GRU can fuse spatiotemporal features by taking advantage of the Trellis network bridge convolution and recurrent architecture. At the same time, the introduction of the GRU gating mechanism can help enhance the efficiency of temporal feature selection. In S3.2, the brackets represent vector concatenation operations, for example, Then it means vector x t-1 With vector The splicing, represents the intermediate output vector, express The replication result is Copy a copy. W1, W2, W3, W4 represent the convolution kernel weight parameters that need to be learned, among which W′1 represents the weights acting on The convolution kernel weight parameter, W′2 represents the effect on The convolution kernel weight parameters, W′3 and W4 are similar.

[0101] Since converting the spatial grid into a one-dimensional node form destroys the original spatial structure, CNN cannot decouple spatial correlation well. Therefore, a GAT layer is added after each TRELLIS-GRU hidden layer. The GAT model uses the attention mechanism to determine the importance of each adjacent region to the central node, so that the spatial features between nodes can be well learned. After the spatiotemporal layer processing, the self-attention mechanism ( Figure 4 Temp-ATT in CNN selects hidden variables of all spatiotemporal layer outputs to improve the model’s mining of long-term dependencies.

[0102] See also Figure 4 , which is a schematic diagram of the structure of the spatiotemporal contextual attention network (spatial-temporal contextual attention network prediction model). The position attention mechanism (Position Att) is used to adaptively extract the position relevance of the external input of each period and strengthen the characteristics of the input information. BatchNorm represents the batch normalization operation. CONCAT represents the concatenation of the hidden variables of each spatiotemporal layer to obtain the feature map.

[0103] In one embodiment, S4 includes:

[0104] S4.1: Input the order data to be predicted into the trained spatiotemporal contextual attention network prediction model to obtain the output result

[0105] S4.2: Output results Denormalization is performed to obtain the final prediction result of ride demand. Where σ and μ are the variance and mean obtained by statistical standardization.

[0106] This paper is mainly based on the relevant knowledge in the field of deep learning and transportation planning, and considers the spatial relationship between urban ride areas and the time dependency of historical orders, and proposes a method for predicting online ride-hailing order demand based on spatiotemporal contextual attention network. This method fully considers the impact of the spatial position of the urban area itself, the relationship between different areas, and the time dependency of historical orders in multiple time periods on the demand for online ride-hailing orders, thereby improving the accuracy of the demand for online ride-hailing orders in urban areas.

[0107] The specific implementation examples described in the present invention are merely illustrative of the methods and steps of the present invention. Those skilled in the art of the present invention may make corresponding modifications, supplements or deformations (i.e., adopt similar alternatives) to the specific implementation steps described, but will not deviate from the principles and essence of the present invention or exceed the scope defined by the attached claims. The scope of the present invention is limited only by the attached claims.

Claims

1. A method for predicting online car-hailing order demand based on spatiotemporal contextual attention network, characterized in that: include: S1: Obtain historical travel demand data of online ride-hailing services in urban areas; S2: Divide the urban area into grid areas of equal scale according to the preset division rules; S3: Construct a spatiotemporal contextual attention network prediction model and use the training data to train the constructed prediction model, where the spatiotemporal contextual attention network prediction model includes stacked spatiotemporal blocks and an output block. Each spatiotemporal block includes TRELLIS-GRU and GAT. TRELLIS-GRU is a gated recurrent grid network and GAT is a graph attention network. The TRELLIS-GRU layer is used to fuse spatiotemporal features, and the GAT layer is used to mine spatial dependencies in different time segments. The training data is obtained based on the historical travel demand data and the divided grid areas, which are the ride demand data corresponding to each grid area. S4: Use the trained spatiotemporal contextual attention network prediction model to predict new order data; Among them, S2 specifically includes: S2.1: Divide the urban area into H×W grid areas L[H,W] of equal scale according to the preset division rules, where L[H,W] represents the grid area of ​​the Hth row and the Wth column; S2.2: Define a grid area as a node V, define the relationship between two grid areas as an edge E, and use the graph G = (V, E)' to represent the inter-regional traffic connection matrix, where V represents a node, E represents an edge, and G∈R N′×N′ , R represents the real number domain, N′=H×W, N′ represents the number of grids; S2.3: Divide a day into several time periods according to preset time intervals, and calculate the ride demand in each area and time period based on the historical travel demand data of online ride-hailing services. and arrival volume And construct the inter-regional transportation connection matrix G based on the departure and destination; S2.4: Use the zero-score method to normalize ride demand and arrivals: X represents the demand or arrival volume of rides, μ = E(X) represents the mean value of X, represents the variance of X, X * Represents the normalized ride demand or arrival volume; During the training process in S3, the loss function selects the mean square error function Among them, W θ are model parameters, X′ is the original value, is the predicted value; The specific processing methods of the spatiotemporal contextual attention network prediction model in S3 include: S3.1: Use the position attention mechanism to extract the position relevance of the external input in each period and strengthen the characteristics of the input information. The calculation formula is as follows: B = reshape(Conv2d(A,W1)) C = reshape(Conv2d(A,W2)) D = reshape(Conv2d(A,W3)) X=reshape(S·D)+A Among them, A∈R T×N×2 represents the input feature graph, T represents the time series length, N represents the number of regional nodes, {B,C,D}∈R M×2 Represents the intermediate layer feature map, M = T × N ′, S ∈ R M×M Represents the spatial attention map, X∈R T×N×2 Represents the feature map after being enhanced by the position attention mechanism. W1, W2, and W3 indicate the convolution kernel weight parameters that need to be learned. The reshape function can convert the size of the A' dimension into the size of the B' dimension. exp represents the exponential function. S3.2: Use the TRELLIS-GRU layer to fuse spatiotemporal features. The TRELLIS-GRU layer consists of a Trellis network and a GRU gating mechanism. The calculation formula of the TRELLIS-GRU layer is as follows: Among them, x t ∈R N×2 represents the passenger demand and arrival volume of each regional node in time period t, Represents the hidden layer value of the jth layer of the Trellis network in time period t, W′1, W′2, W′3, W4 represent the convolution kernel weight parameters that need to be learned, σ represents the sigmoid activation function, represents the intermediate output vector; S3.3: GAT uses the attention mechanism to determine the importance of each adjacent region to the central node, thereby learning the spatial features between nodes. The calculation formula of the GAT layer is as follows: in, represents the correlation coefficient between node p and node q, represents the correlation coefficient between node p and node k, represents the hidden value of node p in layer h at time period t, N p represents the nodes adjacent to node p in time period t, parameter W increases the dimension of vertex features, [·||·] represents the concatenation of the features of node p and node q after dimension increase, and a(·) maps the concatenated features to a real number. represents the normalized attention coefficient, Represents the output features of the information of the neighboring nodes of node p in time period t after the GAT network is integrated; S3.4: Use the self-attention mechanism to select the hidden variables of all spatiotemporal layers to improve the model's mining of long-term dependencies, and concatenate the hidden variables of each spatiotemporal layer to obtain the feature map E = Cat (Z1, Z2, ..., Z i …Z d ),E∈R T ×N×C , where Z i Represents the hidden variable of the output of the i-th spatiotemporal layer, d represents the number of spatiotemporal layers, T represents the length of the time series, and C represents the number of channels of the concatenated feature map; the linear function E is used to generate and Where R represents the real number domain, d k ,d v represents the number of channels, Q, K, and V represent the query vector, key vector, and value vector, respectively. T Represents the association relationship; uses the self-attention mechanism to obtain the feature map S3.5: Input the feature map Attention (Q, K, V) to the output layer to obtain the final prediction result. The output layer consists of two fully connected layers, and its calculation formula is as follows: Among them, fc i′ represents the i′th fully connected layer, σ represents the LeakyRelu activation function, Represents the predicted value of the ride demand of N regional nodes in the next L time periods; S4 includes: S4.1: Input the order data to be predicted into the trained spatiotemporal contextual attention network prediction model to obtain the output result S4.2: Output results Denormalization is performed to obtain the final prediction result of ride demand. Among them, σ′ and μ are the variance and mean obtained by statistics during data standardization.

2. The method for predicting online car-hailing order demand based on spatiotemporal contextual attention network according to claim 1, characterized in that: After step S1, the method further comprises: Perform abnormal data clearing or repair operations on the acquired historical travel demand data.

3. The method for predicting online car-hailing order demand based on spatiotemporal contextual attention network as claimed in claim 2, characterized in that: The historical travel demand data of online ride-hailing services obtained include the longitude and latitude of the boarding point, the boarding timestamp, the longitude and latitude of the boarding point, the boarding timestamp, and the order fee. The abnormal data clearing or repairing operations are performed on the historical travel demand data obtained, including: When there is a vacancy in the order information, the order is cleared, and the order is the historical travel demand data of the online car-hailing service obtained; When the offset between the longitude and latitude of the pickup point or the longitude and latitude of the drop-off point in the order and the city area is greater than the offset threshold, or the difference between the pickup timestamp and the drop-off timestamp is greater than the time threshold, or the order fee is higher than the fee threshold, the order information is determined to be abnormal and the order is cleared; Use Baidu Map path length calculation API to estimate order journey and order cost, calculate the cost per kilometer, judge abnormal orders by setting the normal value threshold range, and clear or fit and repair abnormal orders.

Citation Information

Patent Citations

  • Online car-hailing service demand prediction method based on deep neural network

    CN108985475A

  • Traffic flow prediction method and system, and terminal device

    CN110969854A

  • Fine-grained taxi taking demand prediction method based on attention mechanism

    CN111340543A