A Taxi Demand Prediction Method Based on Trajectory Semantics and Graph Convolutional Networks
By constructing demand relationship graphs and similarity graphs based on trajectory semanticization and graph convolutional networks, and combining graph convolutional networks with the improved DTW algorithm, the problems of spatiotemporal correlation and inter-regional similarity in taxi demand forecasting are solved, and more accurate demand forecasting is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2022-11-07
- Publication Date
- 2026-05-26
AI Technical Summary
Existing technologies struggle to effectively capture the spatiotemporal correlations and interregional demand pattern similarities in taxi demand data, making it impossible to accurately predict taxi demand.
This paper adopts a method based on trajectory semanticization and graph convolutional networks. By constructing a demand relationship graph and a demand similarity graph, and combining them with a graph convolutional neural network, the spatiotemporal features between regions are extracted. An improved DTW algorithm is used to calculate the demand pattern similarity and predict the demand for taxis.
It improves the accuracy of taxi demand forecasting, better captures spatiotemporal correlations and inter-regional demand pattern similarities, and enhances the precision of forecast results.
Smart Images

Figure CN115689224B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent transportation and relates to the analysis of taxi demand characteristics, and in particular to a taxi demand prediction method based on trajectory semanticization and graph convolutional networks. Background Technology
[0002] Transportation, as the pulse of a city, impacts everyone's daily life. Within the macro-framework of urban computing, Intelligent Transportation Systems (ITS) is a crucial component. Currently, research in the field of ITS primarily focuses on traffic flow prediction, route planning, and ride demand forecasting. In recent years, with the increasing popularity of ride-hailing services, massive amounts of demand data can be collected on an unprecedented scale. Therefore, ride demand forecasting has attracted growing attention and research from scholars both domestically and internationally. Essentially, all this research aims to achieve the rational allocation of transportation resources.
[0003] In the field of intelligent transportation, scholars have conducted research on taxi resource allocation, focusing on travel distribution characteristics, passenger hotspot mining, and taxi travel demand prediction, achieving substantial research results. In taxi demand prediction research, the complexity of demand prediction is mainly considered and modeled from both temporal and spatial dimensions. For temporal feature extraction, Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) are widely used methods, while for spatial feature processing, Convolutional Neural Networks (CNN) and Graph Convolutional Neural Networks (GCN) are primarily employed. Furthermore, in addition to considering temporal and spatial influencing factors, some studies have also considered external influencing factors, such as weather and geographical factors.
[0004] Applying natural language processing principles to taxi demand forecasting still faces the following challenges:
[0005] 1. The problem of semantic representation of start and end locations. Similar to the semantic contextual relevance of text, vehicle trajectory data between different regions exhibit complex demand correlations. How to semantically represent trajectory data to capture the demand relationships between regions remains a challenge.
[0006] 2. The problem of synchronously capturing spatiotemporal correlations. Taxi demand forecasting is affected by complex spatiotemporal correlations, but existing methods typically use separate components to capture spatial and temporal correlations separately, failing to capture this information that is simultaneously transmitted in both time and space dimensions. How to achieve synchronous capture of spatiotemporal correlations is a key issue.
[0007] 3. The issue of frequency-based analysis of similar demand patterns. Two regions with similar functions may be geographically distant, but their demand patterns are similar. How to analogize this to keyword extraction in text, converting trajectory data into demand frequencies across different regions at different times, and then extracting the similarities in demand between regions remains a challenge. Summary of the Invention
[0008] To address the above problems, this application proposes a taxi demand prediction method based on trajectory semanticization and graph convolutional networks, specifically including the following steps:
[0009] Obtain taxi order data from publicly available taxi datasets;
[0010] The demand for each area is summarized from the acquired taxi order data and map data, and the demand pattern is calculated.
[0011] Based on the similarity of traffic volume and demand patterns, construct a demand relationship graph and a demand similarity graph;
[0012] A spatiotemporal feature extraction module is constructed based on a graph convolutional neural network, which takes the demand relationship graph as input and extracts the spatiotemporal features between regions.
[0013] The demand for taxis is predicted by combining the spatiotemporal characteristics and demand similarity maps between regions with the input fully connected layer.
[0014] Furthermore, the demand pattern for a region is the average daily taxi demand in that region over a week.
[0015] Furthermore, the process of obtaining the demand relationship diagram includes the following steps:
[0016] Obtain the origin and destination from the order data of each taxi, and use the origin and destination from the order data as trajectory nodes;
[0017] All trajectory nodes are classified according to region, and the order volume with region i and region j as trajectory nodes is counted. This order volume is used as the demand relationship between region i and region j.
[0018] The existence of demand relationships between regions within a time step is represented using an adjacency matrix, and the adjacency matrices of three adjacent time steps are concatenated together to form a demand relationship graph.
[0019] Furthermore, extracting the spatiotemporal features between regions includes the following steps:
[0020] A local spatiotemporal module consisting of multiple graph convolutions is constructed. The demand relationship graph is used as the input of the local spatiotemporal module, and the results of each graph convolution are aggregated together as local spatiotemporal features.
[0021] Construct a global spatiotemporal module, which includes K-2 local spatiotemporal modules. Divide the input requirement relationship graph into K-2 subgraphs, and each of the K-2 local spatiotemporal modules processes one subgraph.
[0022] The outputs of K-2 local spatiotemporal modules are concatenated together to form a global spatiotemporal feature.
[0023] Furthermore, the output of the l-th graph convolution is represented as:
[0024] GCN(h (l-1) ) = h (l) =(A'h (l-1) W1+b1)⊙σ(A'h (l-1) W2+b2)
[0025] Among them, h (l) h represents the output of the l-th graph convolution. 0 It is the adjacency matrix of the demand relationship graph; σ represents the activation function; A'∈R 3N×3N This represents a demand relationship diagram, where N represents the number of regions; W1∈R C×C' W2∈R C×C' b1∈R C' b2∈R C' These are learnable parameters, C is the number of input features, and C' is the number of output features; ⊙ represents the Hadamard product.
[0026] Furthermore, when obtaining the demand similarity graph, the similarity of demand patterns between any two regions is calculated as the weight of the edges in the demand similarity graph, expressed as:
[0027]
[0028] Where sim(X,Y) represents the similarity of demand patterns between region X and region Y, α is the distance decay parameter, and DTW(X,Y) represents the dynamic time warping distance between the demand patterns of region X and region Y.
[0029] Furthermore, when using the DTW algorithm to calculate the dynamic time warping distance DTW(X,Y) between the demand patterns of region X and region Y, the search length T and search space of the DTW algorithm are constrained, as follows:
[0030] ω k = (i,j),|ij|≤T;
[0031] Where, ω k Let |ij|≤T represent the search space when calculating the distance between the demand pattern sequences X and Y, and let |ij|≤T mean that only the difference between the i-th data in sequence X and the data in sequence Y from the iT-th to the i+T-th range is calculated each time.
[0032] This invention focuses on extracting demand correlations between regions. It semantically represents trajectory data and mines the contextual relationships between trajectory nodes, i.e., demand correlations between regions. Then, based on graph convolutional networks, LSTGCM and GSTGCM modules are designed to capture the spatiotemporal features of trajectory nodes. Finally, by frequencyifying demand terms, the demand is converted into a time series for calculating the demand pattern similarity between any two regions, further improving prediction accuracy. Attached Figure Description
[0033] Figure 1 This is a flowchart of an embodiment of the present invention;
[0034] Figure 2 This is a schematic diagram illustrating the semantic association between the start and end positions of the NC-Matrix in this invention.
[0035] Figure 3 Extraction of requirements for this invention;
[0036] Figure 4 This is a schematic diagram of the spatiotemporal feature extraction based on graph convolutional neural networks according to the present invention;
[0037] Figure 5 This is a schematic diagram of the demand pattern word frequencyization of the present invention;
[0038] Figure 6 This is a schematic diagram of the fast-DTW search space of the present invention. Detailed Implementation
[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] This application proposes a taxi demand prediction method based on trajectory semanticization and graph convolutional networks, specifically including the following steps:
[0041] Obtain taxi order data from publicly available taxi datasets;
[0042] The demand for each area is summarized from the acquired taxi order data and map data, and the demand pattern is calculated.
[0043] Based on the similarity of traffic volume and demand patterns, construct a demand relationship graph and a demand similarity graph;
[0044] A spatiotemporal feature extraction module is constructed based on a graph convolutional neural network, which takes the demand relationship graph as input and extracts the spatiotemporal features between regions.
[0045] The demand for taxis is predicted by combining the spatiotemporal characteristics and demand similarity maps between regions with the input fully connected layer.
[0046] like Figure 1 The diagram illustrates the overall process of this invention, showing that the inputs are historical taxi order data and city map data, and the output after processing by the prediction model is the taxi ridership demand for all areas in the next time period. This invention includes the following three steps:
[0047] S1: Data Acquisition. Data will be acquired from publicly available data websites. Specifically, we need to obtain map data and taxi order data. The map data will be used to divide the city into different areas and number them. The taxi order data we need includes the order number, start time, drop-off time, pick-up location, and drop-off location.
[0048] S2: Extract relevant attributes. Based on the acquired order data and map data, summarize the demand for each region and calculate the demand pattern for each region.
[0049] S3: Model Building. First, the NC-Matrix method was designed to find nodes with contextual relationships. Then, based on graph convolutional neural networks, a Local Spatiotemporal Module (LSTGCM) and a Global Spatiotemporal Module (GSTGCM) were designed to capture spatiotemporal features. Finally, by calculating the demand pattern similarity between any two regions, a demand similarity graph was constructed to find regions with similar demands.
[0050] In this embodiment, after obtaining the data source, the obtained data undergoes simple cleaning, specifically including the following steps:
[0051] S11: Obtain raw data. Raw data can be obtained through the data query API provided by the enterprise or by directly downloading existing data sources.
[0052] S12: Simple Data Cleaning. Raw data is often unstructured and cannot be directly used for data analysis. Simple data cleaning can structure most unstructured data. For example, removing duplicate data and cleaning up invalid information.
[0053] In taxi demand forecasting, regional demand is influenced by multiple factors. On one hand, taxi demand is spatially mobile; on the other hand, it is periodically cyclical. Furthermore, regions with similar functions may have similar demands. Therefore, it is necessary to divide the city into regions, extract the taxi demand for each region, and calculate the demand patterns for each region. In this embodiment, the process of extracting relevant attributes includes the following steps:
[0054] S21: Urban Road Network G
[0055] Let a city be defined as an undirected, unweighted graph G = (V, E, A), where V represents the set of regions, and the regions in the city are the vertices in the graph. Assuming the city is divided into N regions, the set of regions can be defined as V = {v1, v2, ..., v...} N}, v N Let A represent the Nth region, E represent the connectivity between regions, and the geographic adjacency matrix between regions is represented as A∈R. N×N .
[0056] S22: Demand
[0057] Demand is defined as the number of taxi requests at a given location within a given time period. Where |·| is the zero norm representing the cardinality of the set, and all taxi requests are aggregated every five minutes. t This represents the index of time t, where t represents the t-th unit of time. i The index of location i is represented by , o represents the taxi request, ot represents the timestamp, os represents the pick-up location, oe represents the drop-off location, and ou represents the user identification number.
[0058] S23: Demand Pattern
[0059] Regions with similar functions also have similar demand patterns. To identify regions with similar functions, it is necessary to calculate the demand pattern similarity between any two regions. First, calculate the average daily taxi demand for each region; then, use the weekly average demand sequence as the demand pattern.
[0060] In this embodiment, the model is built in three stages: The first stage involves mining potential demand relationships between nodes. Based on historical taxi order data, the NC-Matrix method is designed to find nodes with contextual associations and construct a demand relationship graph. The second stage involves capturing the spatiotemporal features of nodes in the demand relationship graph. Based on graph convolutional neural networks, a Local Spatiotemporal Module (LSTGCM) and a Global Spatiotemporal Module (GSTGCM) are designed to capture these features. The third stage involves finding regions with similar demands. By calculating the demand pattern similarity between any two regions, a demand similarity graph is constructed. Specifically, the following steps are included:
[0061] S31: Semanticization of start and end position associations
[0062] Since both vehicle trajectories and natural language are logically ordered sequences, they share some similarities. In natural language, words constituting the same sentence are often related; similarly, if we analogize trajectory nodes to words and trajectories to sentences, then trajectories also possess this characteristic. To address the complex demand relationships between trajectory nodes, the NC-Matrix method is proposed to capture inter-regional demand correlations. If there is taxi demand between any two road network nodes, then these two road network nodes are related.
[0063] First, each taxi trajectory data (order data) is broken down into start and end points, and sentence elements and their relationships are analyzed. Each time a trajectory node is selected, the corresponding start point when it is used as the end point is found, and then the corresponding end point when it is used as the start point is found. The selected trajectory node can be considered as the predicate in a sentence, while the associated start and end points are considered as the subject and object, respectively. This node, along with any of the subject and object nodes, can form a sentence; therefore, the trajectory node is related to all these nodes. Figure 2 As shown.
[0064] Secondly, all trajectory nodes are classified according to region, and the regions that are related to each region are counted, which can be represented as:
[0065] c i ={l1:d i1 ,l2:d i2 ,…,l n :d in} (4)
[0066] Among them, c i Indicates the demand relationship in region i, l j Represents the regions j and d associated with i. ij This represents the order volume with regions i and j as endpoints (start or end points). This embodiment filters out regions with low relevance by setting a minimum threshold. If d ij Below this threshold, the demand correlation between region i and region j is considered to be low. For each region, the regions with which it has a correlation are statistically analyzed, resulting in demand relationships represented as an adjacency matrix. The adjacency matrices of three adjacent time steps are then concatenated to directly capture the influence of each node on its current time and its neighboring nodes in adjacent time steps, ultimately constructing a demand relationship graph, represented by matrix A. rel The process is as follows: Figure 3 As shown. A rel It is a 3N×3N matrix. This represents the demand relationship across three consecutive time steps. This means connecting each node in time step t1 to itself in time step t2.
[0067] S32: Spatiotemporal Feature Extraction
[0068] Taxi demand forecasting is influenced by complex spatial and temporal correlations. On the one hand, taxi demand is spatially mobile. On the other hand, taxi demand is also periodic in time. To more accurately predict taxi occupancy demand, it is necessary to analyze the spatiotemporal correlations between regions.
[0069] To capture local spatiotemporal features, a Local Spatiotemporal Module (LSTGCM) was constructed. LSTGCM consists of a set of graph convolution operations. Within the same order, the demand in the starting and ending regions is correlated. To capture the spatiotemporal features of demand-related regions, the adjacency matrix of the demand relationship graph is used as input to the graph convolution operation, which aggregates the features of each region with its related regions. In the graph convolution operation, the regions divided by the city map are treated as nodes in the graph. Each node aggregates its own features and those of its neighbors at adjacent time steps. In this embodiment, the chosen aggregation function is a linear combination, with weights equal to the weights of the edges between the node and its neighbors. A fully connected layer with an activation function is deployed to transform the node features into a new space. The graph convolution operation of the l-th layer can be described as follows:
[0070] GCN(h (l-1) ) = h (l) =(A'h (l-1) W1+b1)⊙σ(A'h (l-1) W2+b2) (5)
[0071] Where σ represents the activation function, A'∈R 3N×3N h represents the adjacency matrix of the demand relationship graph. (l-1) ∈R 3N×C It is the input of the l-th graph convolutional layer, W1∈R C×C' W2∈R C×C' b1∈R C' b2∈R C' These are learnable parameters, C is the number of input features, and C′ is the number of output features.
[0072] Graph convolution operations are defined as spatial graph convolutions and can be applied to both directed and undirected graphs. Due to the dependencies in time series, the demand in one region will affect the demand in the next time period. Therefore, a self-loop is added to each node, allowing the graph convolution operation to consider the node's own features when aggregating features. Furthermore, multiple graph convolution operations are stacked to expand the receptive field.
[0073] The demand relationship graph is used as input, and graph convolution operations are performed. The final aggregation layer is used to aggregate the outputs of each graph convolution operation, such as... Figure 4 As shown.
[0074] This embodiment also considers the periodicity of changes in taxi demand, constructing a Global Spatiotemporal Module (GSTGCM) to capture the global spatiotemporal features of nodes. A sliding window is used to segment different time periods of the demand relationship graph sequence. Considering the heterogeneity of spatiotemporal data, multiple LSTGCMs are used to model different time periods. Multiple LSTGCMs allow each module to focus on modeling local spatiotemporal correlations in the graph, and a set of LSTGCMs is deployed as a Global Spatiotemporal Module (GSTGCM) to extract global spatiotemporal features.
[0075] The input matrix of GSTGCM is represented as X∈R K×N×C Spatiotemporal embedding is added to each GSTGCM; the sliding window in the GSTGCM slices the input demand relationship graph sequence into K-2 graphs, each demand relationship graph can be represented as X'∈R 3×N×C The GSTGCM deploys K-2 LSTGCMs on K-2 demand relationship graphs to capture the local spatiotemporal correlations in these K-2 demand relationship graph sequences. The outputs of these K-2 LSTGCMs are concatenated into a matrix as the output of the GSTGCM. This can be expressed as:
[0076]
[0077] in, C represents the output of the i-th LSTGCM. out This indicates the number of convolution kernels.
[0078] S33: Frequency-based approach to demand patterns
[0079] Regions with similar functions also exhibit similar demand patterns. To identify regions with similar functions, it is necessary to calculate the demand pattern similarity between any two regions. This includes calculating the average daily taxi demand for each region and using the weekly average demand sequence as the demand pattern. Figure 5 As shown.
[0080] Inspired by text feature extraction, we can analogize demand patterns to articles and use the average daily demand as the word frequency. Articles with similar keyword frequencies tend to describe similar topics, meaning that areas with similar demand patterns have similar functions.
[0081] To calculate the demand pattern similarity between any two regions, and considering the high time complexity of the traditional DTW algorithm, such as Figure 6As shown in the darker area, this embodiment limits the search length T of the algorithm, restricting the search space to:
[0082] ω k =(i,j),|ij|≤T (7)
[0083] Where, ω k Let |ij|≤T represent the search space when calculating the distance between demand pattern sequences X and Y, where |ij|≤T means that only the difference between the i-th data in sequence X and the data in sequence Y from the iT-th to the i+T-th data is calculated each time. By limiting the search length, the time complexity of the algorithm in this embodiment is reduced from O(ni). 2 The value decreases to O(Tn). The improved DTW algorithm (fast-DTW) is used to calculate the demand pattern similarity between any two regions:
[0084]
[0085] Where α is a parameter controlling the distance decay rate, DTW(X,Y) is the dynamic time-warped distance between the demand patterns of two locations, and similarity is used as the demand similarity graph A. sim The weight of the middle edge.
[0086] Because A sim Since it is an undirected complete graph, a large number of nodes can affect model efficiency. Therefore, a graph embedding method is used to embed A... sim Each node is encoded as a low-dimensional vector while preserving its structural information.
[0087] In this embodiment, a spatiotemporal feature extraction module is finally constructed based on a graph convolutional neural network. The demand relationship graph is used as input to extract spatiotemporal features between regions. These spatiotemporal features are combined with the demand similarity graph and input to a fully connected layer to predict taxi demand. Specifically, in this embodiment, the spatiotemporal features between regions are a four-dimensional vector, and the demand similarity graph is a two-dimensional matrix. To concatenate the spatiotemporal features between regions with the demand similarity graph, the demand similarity graph is first converted into a vector. After linear layer and reshape operations, it becomes a vector with the same dimensions as the spatiotemporal features. Then, the spatiotemporal features and the demand similarity graph are concatenated as the input to the final prediction layer (fully connected layer). The output of the fully connected layer is a three-dimensional vector, with the three dimensions representing: the number of predicted time steps, the number of locations, and the number of predicted time periods (in units of predicted time steps), used to represent the demand in all regions at each time step.
[0088] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A taxi demand prediction method based on trajectory semanticization and graph convolution network, characterized in that, Includes the following steps: Taxi order data is obtained from publicly available taxi datasets. Each taxi trajectory data is split into a start point and an end point. Each time a trajectory node is selected, the start point corresponding to it as the end point is found, and then the end point corresponding to it as the start point is found. The selected trajectory node can be regarded as the predicate in a statement, and the start point and end point associated with it can be regarded as the subject and object, respectively. This node and any subject node and object node can form a statement. The demand for each area is summarized from the acquired taxi order data and map data, and the demand pattern is calculated. Based on the similarity of traffic volume and demand patterns, a demand relationship graph and a demand similarity graph are constructed, specifically including: Each taxi trajectory data is split into a start point and an end point. Each time a trajectory node is selected, the start point corresponding to it as the end point is found, and then the end point corresponding to it as the start point is found. Classifying all trajectory nodes by region and counting the regions that are related to each region can be represented as: ; wherein, representing regions of demand relationships, representing regions associated with , representing order volumes with regions and as end points, respectively; Each region is statistically analyzed to identify the regions that are related to it, which is the demand relationship. This is represented as an adjacency matrix. The adjacency matrices of three adjacent time steps are connected to directly capture the influence of each node on its current time and neighboring nodes in adjacent time steps, thus forming a demand relationship graph. A spatiotemporal feature extraction module is constructed based on a graph convolutional neural network. Taking a demand relationship graph as input, it extracts spatiotemporal features between regions. The extraction of spatiotemporal features between regions includes the following steps: A local spatiotemporal module consisting of multiple graph convolutions is constructed. The demand relationship graph is used as the input of the local spatiotemporal module, and the results of each graph convolution are aggregated together as local spatiotemporal features. Construct a global spatiotemporal module, which includes K-2 local spatiotemporal modules. Divide the input requirement relationship graph into K-2 subgraphs, and each of the K-2 local spatiotemporal modules processes one subgraph. The outputs of K-2 local spatiotemporal modules are concatenated together to form the global spatiotemporal feature, i.e., the spatiotemporal feature between regions; The spatiotemporal characteristics and demand similarity maps between regions are fused and input into a fully connected layer to predict taxi demand.
2. The taxi demand prediction method based on trajectory semanticization and graph convolutional networks according to claim 1, characterized in that, The demand pattern of a region is the average daily taxi demand in that region over a week.
3. The taxi demand prediction method based on trajectory semanticization and graph convolutional networks according to claim 1, characterized in that, The output of the l-th graph convolution is represented as: ; in, h represents the output of the l-th graph convolution. 0 It is the adjacency matrix of the demand relationship graph; Indicates the activation function; This represents a demand relationship diagram, where N represents the number of regions. , , , These are learnable parameters. It is the number of input features. It is the number of output features; It represents the Hadamardi (or Hadama) stack.
4. The taxi demand prediction method based on trajectory semanticization and graph convolutional networks according to claim 1, characterized in that, When obtaining the demand similarity graph, the similarity of demand patterns between any two regions is calculated as the weight of the edges in the demand similarity graph, expressed as: ; in, This indicates the similarity of demand patterns between region X and region Y. For distance attenuation parameters, This represents the dynamic time-warped distance between the demand patterns of region X and region Y.
5. The taxi demand prediction method based on trajectory semanticization and graph convolutional networks according to claim 4, characterized in that, The DTW algorithm is used to calculate the dynamic time warping distance between the demand patterns of region X and region Y. When the search length T and search space of the DTW algorithm are limited, they are expressed as: ; in, Let X represent the search space for calculating the distance between demand pattern sequences X and Y. This means that only the first element in sequence X is calculated each time. From the data and sequence Y, from the first data point... arrive The difference between the data within the range.