A trajectory similarity measurement method based on trajectory embedding

Through the trajectory embedding method, using neural network to train trajectory embedding vectors, the problem of poor robustness of trajectory similarity calculation at low sampling rate and low sampling accuracy is solved, and higher calculation accuracy and stability are achieved.

CN115062703BActive Publication Date: 2024-12-24BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210685534.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2021-06-18
Filing Date
2022-06-16
Publication Date
2024-12-24
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

The existing trajectory similarity calculation methods have problems such as poor robustness and difficult to determine thresholds in CDR data with low sampling rate and low sampling accuracy, resulting in poor abnormal point matching and effect stability.

Method used

Using a method based on trajectory embedding, the trajectory is divided into sub-graphs through the connected sub-graphs, and the trajectory embedding vector is used to train the trajectory embedding vector to represent the spatial and temporal similarity between trajectories, reducing the time complexity and improving the calculation accuracy.

Benefits of technology

In F-score and AP indicators, it is excellent than the existing trajectory similarity algorithm, significantly improving the trajectory similarity calculation effect of low sampling rate and low sampling accuracy data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115062703B_ABST
    Figure CN115062703B_ABST
Patent Text Reader

Abstract

The present invention discloses a trajectory similarity measurement method based on trajectory embedding, which relates to the field of trajectory data mining; specifically, the method comprises: first, preprocessing the base station trajectory points of the user call records, clustering the spatiotemporal trajectory points of the preprocessed trajectory data, then, constructing a relationship graph between users according to the user spatiotemporal trajectory clustering cluster information, and mining different user strongly connected subgraphs; then, calculating the trajectory priori similarity between user trajectories in each connected subgraph, based on which, constructing a training set using the user's trajectory sequence and the co-occurrence relationship between the trajectories between users, training the trajectory2vec model in different connected subgraphs in combination with the trajectory priori similarity between users, and obtaining the user's trajectory embedding vector; finally, calculating the cosine similarity between the user's trajectory embedding vectors to represent the user's trajectory spatiotemporal similarity. The present invention reduces the time complexity and improves the sampling rate and sampling accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of trajectory data mining, and in particular to a trajectory similarity measurement method based on trajectory embedding. Background Art

[0002] Trajectory similarity is the basis of trajectory data processing technologies such as trajectory neighbor query, outlier detection and trajectory clustering, and is also widely used in the analysis of crowd movement patterns. Trajectory similarity analysis can be used in multiple application areas, such as: 1. In student trajectories, it can be determined which students follow similar paths between home and school, thus serving as a reference in setting school bus routes; 2. In taxi trajectories, it can be determined whether the trajectory between two scenic spots or landmarks (such as airports and city centers) is significantly different from other trajectories, thereby determining whether the driver takes a detour; 3. In animal trajectories, species can be determined by similar trajectories in a database of known species.

[0003] The actual trajectory data will introduce some errors during the collection process, especially for the low-precision CDR user call record trajectory data. Since the coordinate accuracy is determined by the coverage range of the base station, the error range is between 500m-1500m. There will also be missing, drifting and duplication, resulting in low spatial accuracy. At the same time, since the user records on the base station are updated every half an hour or when the user makes a call or sends a text message, the temporal sampling rate of CDR data is also low. In trajectory similarity analysis, this low sampling rate and low precision will cause the similarity method based on trajectory point pairing to match abnormal points, and at the same time, the previous spatiotemporal similarity method based on point distance error threshold judgment has poor robustness, the threshold is difficult to determine, and the effect stability is poor.

[0004] The existing method is to regard the trajectory as a sequence and express the trajectory similarity by the similarity of the sequence. This method is usually evolved from the similarity measurement of text. Among them, the typical method is LCSS (Longest Common Subsequence). The core idea is to match when the distance between two points is less than a given threshold. The longer the common subsequence matched between two trajectories, the more similar they are. However, it only focuses on the matching part of the two trajectories and ignores the different parts between the trajectories.

[0005] Based on the idea of ​​LCSS, the academic community later proposed the Edit Distance on Realsequences (EDP) method to calculate the distance of time series. This method calculates the distance between two point sequences by aligning the sequences. When there are mismatched points, the distance between the trajectories is penalized according to the distance of the mismatched points. This method is usually used as the most classic edit distance measurement method for calculating the distance between trajectories. However, this method requires a one-to-one matching of each point in the trajectory. If two similar trajectories have different numbers of points, there will be a relatively large edit distance between them, which will affect the discrimination result.

[0006] Another method is to match the corresponding points of the trajectory in time and space, such as the typical DTW (Dynamic TimeWarping) method, which mainly finds the most matching points between two trajectories through dynamic time warping and creates a matrix to store the cumulative error distance between the two trajectories. This method calculates the similarity between two time series by extending and shortening the time series, matching all points on the two trajectories, and each point will match the closest point on the other trajectory, and the same point can be matched by multiple points on the other trajectory. DTW uses the sum of the distances between all these similar points, called the warp path distance, to measure the similarity between two time series. The effect of this method is greatly affected by outliers. Even if there are a small number of outliers in two similar trajectories, these small number of outliers will sharply increase the cumulative error distance between the trajectories.

[0007] Regarding trajectory similarity technology, existing document 1: CN 110610182 A proposes a method for judging user trajectory similarity. First, the paths with time sequence of two users and the common subpaths of the two users are determined, and the common subpath with the longest spatial path is determined as the longest common subpath; the trajectory similarity of the users is finally determined according to the time overlap of each corresponding adjacent space in the longest common subpath, the number of spatial positions contained in the longest common subpath, and / or the number of the longest common subpaths.

[0008] Document 2: CN 112434084 A, discloses a trajectory similarity matching method and device based on geohash and LCSS, specifically comprising: first, according to the target identifier to be analyzed and the target time period or the target trajectory sequence, a plurality of spatiotemporal association identifiers are obtained; the hit input trajectory sequence of each spatiotemporal association identifier and the target trajectory sequence is obtained, and the geohash proportion, time distribution rate and space distribution rate thereof are calculated; the complete trajectory sequence of each spatiotemporal association identifier is obtained and the LCSS similarity thereof is calculated; the geohash proportion, time distribution rate and space distribution rate and the LCSS similarity are weighted and summed respectively, the trajectory similarity is calculated and arranged in ascending order, and the complete trajectory sequence of each spatiotemporal association identifier is output.

[0009] However, the current trajectory similarity methods are mainly aimed at GPS data, which has a higher sampling rate and accuracy. For sparse user call record CDR trajectory data with a lower sampling rate and lower sampling accuracy, the current similarity methods have certain defects.

[0010] At present, when the similarity method based on trajectory point pairing calculates the similarity of sparse trajectories, due to the low sampling accuracy of data points, this method will match some abnormal points. At the same time, since the sampling accuracy varies in different places, it is difficult to determine the threshold when judging the trajectory point matching.

[0011] At present, when the spatiotemporal similarity method based on point distance error threshold judgment is applied to sparse data, due to the low data sampling accuracy and the different sampling accuracy in different regions, the calculated trajectory distance errors are difficult to compare and have the problem of poor robustness. Summary of the invention

[0012] In order to solve the problems of low sampling rate and low sampling accuracy in existing methods when calculating trajectory data similarity, this paper proposes a trajectory similarity measurement method based on trajectory embedding. All trajectories are divided into different subgraphs using connected subgraphs, and they are trained separately to reduce time complexity. Neural network training is performed through co-occurrence record points between trajectories, and the temporal and spatial similarity between trajectories is represented by the similarity of trajectory embedding vectors.

[0013] The trajectory similarity measurement method based on trajectory embedding has the following specific steps:

[0014] Step 1: For a certain user, obtain the call records of the user within a period of time, and use the corresponding base stations as trajectory points for pre-processing.

[0015] Step 2: Based on the trajectory point data obtained by preprocessing, clustering is performed using a clustering algorithm to divide the spatially adjacent base station locations into the same cluster to obtain a cluster of the user's spatiotemporal trajectory.

[0016] Step 3: Similarly, obtain the call record trajectory point data of several users in the same time period, and perform clustering to obtain the clustering clusters of each user's spatiotemporal trajectory;

[0017] Step 4: Construct a relationship graph between users based on the spatiotemporal trajectory clusters of all users, and use the connected subgraph mining algorithm to mine different user strongly connected subgraphs.

[0018] The specific process is:

[0019] First, each user is regarded as a node in the relationship graph, and the edge between the nodes represents the number of clusters C where the trajectory points between two users appear simultaneously num , and satisfies C num ≥C min ;

[0020] C min The minimum number of clusters that co-occur with users in a co-occurrence relationship.

[0021] Then, the connected subgraph algorithm is used to mine the connected subgraphs in the graph.

[0022] Step 5: For each strongly connected subgraph, use the spatiotemporal trajectory clustering to calculate the trajectory prior similarity between every two user trajectories.

[0023] For user trajectory A and user trajectory B, the trajectory prior similarity calculation formula is:

[0024] R A,B =CommonC A,B / C A

[0025] R B,A =CommonC B,A / C B

[0026] Common C A,B is the number of clusters shared by user trajectories A and B, C A represents the number of clusters containing user trajectory A, C B Indicates the number of clusters containing user trajectory B.

[0027] Step 6: Based on the trajectory prior similarity, train the trajectory2vec model in different connected subgraphs to obtain the user's trajectory embedding vector.

[0028] The trajectory2vec model adds the prior similarity R of the trajectory, and the updated objective function is:

[0029]

[0030] Among them, neg is the number of negative samples, is the logistic regression function, is the vector of the user trajectory to be trained The corresponding auxiliary vector, y i is the label of the i-th sample; p(z|w) represents the probability of all negative samples;

[0031] The user's trajectory embedding vector is represented as {v1,v2,...,v i ,...,v N},v i represents the trajectory embedding vector of the i-th user, there are N users in total;

[0032] Step 7: Calculate the cosine similarity between the user's trajectory embedding vectors to represent the spatiotemporal similarity of the user's trajectory.

[0033] Then the trajectory similarity between the i-th user and the j-th user is expressed as:

[0034] simi(v i ,v j )=cos(v i ,v j )

[0035] The advantages of the present invention are:

[0036] The present invention provides a trajectory similarity measurement method based on trajectory embedding. The effect of the trajectory similarity measurement of the present invention is verified by using 780 pairs of annotated CDR dataset trajectories. It can be seen that the present invention is superior to the existing trajectory similarity algorithm in terms of F-score and AP indicators. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A flow chart of a trajectory similarity measurement method based on trajectory embedding of the present invention;

[0038] Figure 2 This is a schematic diagram of the skip-gram network model used in the present invention;

[0039] Figure 3 The figure is a schematic diagram for comparing the F-score and AP indicators of the present invention and the existing algorithms. DETAILED DESCRIPTION

[0040] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0041] The present invention proposes a trajectory similarity measurement method (trajectory2vec) based on trajectory embedding. Similar to the prior art, the method of using word2vec to train word vectors for text, the core idea of ​​the trajectory2vec method is to train a neural network through co-occurrence record points between trajectories, and use the similarity of the trajectory embedding vector to represent the spatiotemporal similarity between trajectories. The co-occurrence relationship of different trajectories is learned through a shallow neural network to update the network node weights, and similar trajectories are used to influence model training to alleviate the error caused by trajectory sparsity. For the embedding vectors of the trajectories obtained by model training, the embedding vectors of the trajectories with more co-occurrence relationships have greater similarity. In order to solve the interference of the co-occurrence relationship in trajectories that do not have similarity on model training, it is necessary to constrain the weight update during the co-occurrence relationship training. The prior similarity between the trajectories is obtained according to the spatiotemporal relationship, and the prior similarity is used as the coefficient of the regular term of the objective function, so as to constrain the weight update, which can achieve the effect that the co-occurrence relationship between the more dissimilar trajectories has less influence on the model weight update.

[0042] The specific steps are as follows:

[0043] Step 1: For a certain user, obtain the call record CDR trajectory data of the user over a period of time, use the corresponding base stations as trajectory points, and pre-process them through the data pre-processing module.

[0044] The preprocessing process is as follows: first, delete invalid data, including missing field data, duplicate data, and incorrect data.

[0045] Incorrect data refers to the oscillation and drift phenomena in the base station data. The DECRE algorithm is used to deal with the oscillation phenomenon, and the RECAR algorithm, which is a fusion of the clustering method and the rule method, is used to deal with the drift data.

[0046] Step 2: Based on the trajectory data obtained by preprocessing, the DBSCAN clustering algorithm is used to cluster the spatiotemporal trajectory points to obtain the user's spatiotemporal trajectory point clusters.

[0047] Specifically, first, all the trajectory points of the user are sliced ​​according to the time length T to form continuous snapshots. The snapshot set S generated by all trajectory points is {s1, s2, ..., s i ,...,s I}.

[0048] s i is the i-th trajectory snapshot generated; for example, when T=30 min, snapshot s1 includes all trajectory points in the time slice from 12:00 to 12:30.

[0049] Then, after obtaining all the trajectory points in each time slice, they are clustered based on density clustering DBSCAN to divide the spatially adjacent base station locations into the same cluster.

[0050] Step 3: Similarly, obtain the call record trajectory data of several users within a period of time, and cluster them to obtain clusters of the spatiotemporal trajectory of each user;

[0051] Step 4: Construct a relationship graph between users based on the spatiotemporal trajectory sequences and clustering clusters of several users, and use a connected subgraph mining algorithm to mine different strongly connected subgraphs of users.

[0052] The specific process is:

[0053] First, a relationship graph between users, namely, a trajectory connectivity graph, is constructed;

[0054] Each user is regarded as a node in the relationship graph. When the number of clusters where the trajectory points between two user nodes appear at the same time meets C num ≥C min , then there is an edge connecting these two users;

[0055] C min The minimum number of clusters that co-occur with users in a co-occurrence relationship.

[0056] Then, the strongly connected subgraph mining algorithm is used to calculate the strongly connected subgraphs in the graph.

[0057] Only the trajectory similarity between users within each connected subgraph is calculated. The correlation between user trajectories in different subgraphs is weak or even non-existent. Users in different connected subgraphs may represent user trajectories in different cities, user trajectories in different life modes, or user trajectories that appear in different time periods.

[0058] Step 5: For each strongly connected subgraph, use the spatiotemporal trajectory clustering to calculate the trajectory prior similarity between every two user trajectories.

[0059] According to the DBSCAN clustering results, the number of common clusters and the number of individual clusters of each pair of trajectory points in each connected subgraph will be obtained. The co-occurrence ratio of clusters is used to calculate the trajectory prior similarity between trajectory points;

[0060] For user trajectory A and user trajectory B, the trajectory prior similarity calculation formula is:

[0061] R A,B =CommonC A,B / C A

[0062] R B,A =CommonCB,A / C B

[0063] Common C A,B is the number of clusters shared by user trajectories A and B, C A represents the number of clusters containing user trajectory A, C B Indicates the number of clusters containing user trajectory B.

[0064] Step 6: Use the user's spatiotemporal trajectory clustering clusters and the co-occurrence relationship between user trajectories to build a training set, combine the trajectory prior similarity, train the trajectory2vec model in different connected subgraphs, and obtain the user's trajectory embedding vector.

[0065] The main idea of ​​the trajectory2vec model is similar to the word2vec model in natural language processing. It uses the co-occurrence relationship between different user trajectories to train the neural network and obtain the embedding vector of the user trajectory. The neural network is mainly trained using the skip-gram network structure and negative sampling. At the same time, the user's prior similarity is used to constrain the weight update to improve the model effect.

[0066] The main idea of ​​the word2vec model in natural language processing is that the context words of similar words are also similar, and the embedding vector of each word is trained based on this idea. For example, the context words of the word "I" in Article1 are "love" and "learning", and the context words of the word "Xiao Ming" in Article2 are also "love" and "learning", and the words "I" and "Xiao Ming" in Article1 and Article2 also have the same context words "do" and "homework", so the words "I" and "Xiao Ming" are likely to be synonyms, and the two words are closer in the embedding vector space.

[0067] The recording points of the four base stations in the four time windows are represented by dots, and each dot is a user trajectory recording point at a certain time point on the base station. It constitutes the trajectory of user A. The trajectory points This constitutes the trajectory of user B. The trajectory points The trajectory of user C is formed. Users A, B, and C co-occur in base stations cell1, cell2, cell3, and cell4 in time windows t1, t2, t3, and t4, respectively. Similar to word2vec, Trajectory2vec mainly uses the co-occurrence relationship of users A, B, and C in different time windows of different base stations to train the neural network, making their vectors closer in the space vector, so as to achieve a state where the accompanying user trajectories are closer in the vector space.

[0068] First, construct the skip-gram neural network model, such as Figure 2 As shown, the skip-gram neural network model is trained using negative sampling;

[0069] The specific idea is to know the vector x of the central user. k , predict the vector y of the context user 1j ,y 2j ,...,y 3j The central user refers to the time window T on the base station thres The context user refers to the other users Context(w) of the base station in the time window.

[0070] The skip-gram neural network model is trained using negative sampling, and the objective function is:

[0071]

[0072] in is the vector of the center user trajectory to be trained, neg is the number of negative samples, is the logistic regression function, yes The corresponding auxiliary vector, y i is the label of the i-th sample; p(z|w) represents the probability of all negative samples;

[0073] The main idea of ​​sampling negative samples is to have a high sampling probability for users with a high frequency of trajectory points and a low sampling probability for users with a low frequency. At the same time, in order to reduce the difference in sampling probability between high-frequency users and low-frequency users, the frequency is exponentially weighted and the power is set to 3 / 4.

[0074] The overall probability of sampling w is:

[0075] P(w)=[counter(w)] 3 / 4 / Π u∈D [counter(u)] 3 / 4

[0076] counter(w) is the number of samples w, and the number ratio is used for sampling;

[0077] Then, the prior similarity of the trajectory is used to constrain the amplitude of the node weight update, and the objective function with regularization is:

[0078]

[0079] R is the trajectory prior similarity;

[0080] Step 7: Calculate the cosine similarity between the user's trajectory embedding vectors to represent the spatiotemporal similarity of the user's trajectory.

[0081] The user's trajectory embedding vector is represented as {v1,v2,...,v i ,...,v N},v i represents the trajectory embedding vector of the i-th user. There are N users in total. Then the trajectory similarity between the i-th user and the j-th user is expressed as:

[0082] simi(v i ,v j )=cos(v i ,v j )

[0083] This method is suitable for similarity calculation of spatiotemporal trajectory data with low sampling rate and low sampling accuracy.

[0084] like Figure 3 As shown, the present invention uses 780 pairs of labeled CDR data sets to verify the effect of the trajectory similarity algorithm. It can be seen that the proposed method is superior to the existing trajectory similarity algorithm in terms of F-score and AP indicators.

Claims

1. A trajectory similarity measurement method based on trajectory embedding, characterized in that: The specific steps are as follows: First, for each user to be tested, the call records of each user in a fixed time period are obtained, and each base station in the record is used as a trajectory point for preprocessing; based on the trajectory point data obtained by preprocessing, clustering is performed using a clustering algorithm to divide the spatially adjacent base station locations into the same cluster, and obtain the clustering cluster of each user's spatiotemporal trajectory; Then, the relationship graph between users is constructed based on the spatiotemporal trajectory clusters of all users, and the connected subgraph mining algorithm is used to mine different strongly connected subgraphs of users; For each strongly connected subgraph, the spatiotemporal trajectory clustering is used to calculate the trajectory prior similarity between every two user trajectories. Based on the trajectory prior similarity, the trajectory2vec model in different connected subgraphs is trained to obtain the user's trajectory embedding vector. The trajectory2vec model adds the prior similarity R of the trajectory, and the updated objective function is: Among them, neg is the number of negative samples, is the logistic regression function, is the vector of the user trajectory to be trained The corresponding auxiliary vector, y i is the label of the i-th sample; The user's trajectory embedding vector is represented as {v1,v2,...,v i ,...,v N },v i represents the trajectory embedding vector of the i-th user, there are N users in total; Finally, the cosine similarity between the user's trajectory embedding vectors is calculated to represent the spatiotemporal similarity of the user's trajectory.

2. According to the trajectory embedding-based trajectory similarity measurement method of claim 1, it is characterized in that: The specific process of constructing the relationship graph between users is as follows: Each user is regarded as a node in the relationship graph, and the edges between the nodes represent the number of clusters C where the trajectory points between two users appear simultaneously. num , and satisfies C num ≥C min ; C min is the minimum number of clusters in which users with co-occurrence relationships appear at the same time.

3. The trajectory similarity measurement method based on trajectory embedding according to claim 1, characterized in that: The calculation formula for calculating the trajectory prior similarity between two user trajectories is: R A,B =CommonC A,B / C A R B,A =CommonC B,A / C B Common C A,B is the number of clusters shared by user trajectories A and B, C A represents the number of clusters containing user trajectory A, C B Indicates the number of clusters containing user trajectory B.

4. The trajectory similarity measurement method based on trajectory embedding according to claim 1, characterized in that: The cosine similarity between the trajectory embedding vectors of the users represents the spatiotemporal similarity of the trajectories of the users, specifically: simi(v i ,v j )=cos(v i ,v j ) v i ,v j They represent the trajectory embedding vectors of the i-th user and the j-th user respectively.