A user trajectory reconstruction method based on a graph neural network and a space-time attention mechanism
By using graph neural networks and spatiotemporal attention mechanisms, the problems of capturing cold-start user behavior patterns and spatiotemporal correlation between points in trajectory reconstruction are solved, achieving more accurate and reliable sparse trajectory reconstruction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2023-11-21
- Publication Date
- 2026-06-12
Smart Images

Figure CN117573787B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a user trajectory reconstruction method based on graph neural networks and spatiotemporal attention mechanisms, belonging to the fields of deep learning and trajectory data mining. Background Technology
[0002] Human mobility behavior is becoming increasingly digitized with the development of information technology, which is crucial for understanding and predicting human mobility and improving the quality of users' daily lives. Location-based services generate a vast amount of user mobility data, which has wide-ranging applications, from personalized location recommendations to urban transportation planning. However, mobility data often suffers from quality issues, such as missing, inaccurate, or sparse location information. This affects the effectiveness of downstream applications and increases the difficulty of individual mobility prediction and big data-based urban transportation planning.
[0003] User trajectory reconstruction refers to using known location information to estimate the missing locations of a user in other time periods, thereby constructing the user's complete movement trajectory. This is a core problem in the field of trajectory data mining and the foundation for many downstream tasks. Currently, mainstream trajectory reconstruction methods can be divided into the following categories: ① Interpolation-based methods. These methods treat a single trajectory as a two-dimensional time series for each timestamp, using techniques such as smoothing filters or LSTM to interpolate missing locations. These methods perform well when the proportion of missing locations is low, but in highly sparse scenarios, their performance drops sharply because they cannot effectively capture human movement patterns. ② Action prediction-based methods. These methods use techniques such as Markov chains or Hidden Markov Models to predict the user's next action, thereby generating missing locations. These methods consider the user's historical behavior but ignore the user's future behavior, and their accuracy is also affected when there are long periods of missing locations. ③ Model-based methods. These methods use deep learning models, such as attention mechanisms and recurrent neural networks, to learn the user's movement patterns and model the spatiotemporal dependencies between different locations, thereby generating missing locations. These methods can effectively uncover complex human movement patterns, but they also require substantial training data and computational resources. While the aforementioned model-based methods have made some progress in trajectory reconstruction, the following challenges remain:
[0004] First, the check-in sequences in commonly used trajectory reconstruction datasets are records of users voluntarily checking in, which may be very sparse. Environmental factors can also cause periodic changes in user movement. For most cold-start users with few check-in points, relying solely on their own trajectory data is insufficient to capture complete behavioral patterns and complete trajectory reconstruction. Furthermore, while graph representation learning can integrate information between various points, neglecting the diverse spatiotemporal semantic relationships between points during node feature updates will result in a loss of understanding of complex topological relationships between nodes. Finally, human mobility exhibits complex location transition patterns. Methods that only model movement patterns between consecutive locations ignore the information correlation between discontinuous points within the trajectory, while directly introducing temporal attention mechanisms lacks consideration of spatiotemporal factors. In conclusion, existing user trajectory reconstruction methods in the field of trajectory data mining still require further in-depth research. Summary of the Invention
[0005] In the context of user sparse trajectory reconstruction, this invention addresses the problems of existing methods failing to capture cold-start user behavior patterns, not fully utilizing the spatiotemporal correlation between points, and struggling to support sparse trajectory reconstruction. The technical problems to be solved are: 1. How to utilize the common characteristics of user groups in trajectory data to supplement the behavior patterns of cold-start users; 2. How to mine the complex topological relationships between points and utilize the collaborative correlation between points to generate more robust point representations; 3. How to consider the periodic dependencies between trajectory points and design an attention mechanism that introduces non-continuous and non-adjacent points to provide spatiotemporal feature support for supplementing missing points.
[0006] The problem this invention aims to solve is: to construct global positional relationships using graph neural networks and mine common behaviors of user groups; to encode the collaborative relationships between positions into feature vectors, a graph attention module based on point-position correlation is proposed in the position representation stage to enhance the collaboration between position vectors; to capture the spatiotemporal semantic information of missing points and their preceding and following positions, the periodic dependence of different missing positions on their preceding and following spatiotemporal information is strengthened in the point-position spatiotemporal feature aggregation stage within the trajectory; and in the trajectory recovery module based on the global trajectory flow graph, the reconstruction of missing user positions is achieved by combining the common transfer patterns of the group.
[0007] The technical solution adopted in this invention is a user trajectory reconstruction method based on graph neural networks and spatiotemporal attention mechanisms. First, by utilizing graph neural networks and point-to-point collaborative association probability matrices, the correlation strength between different points is learned, enhancing the collaboration between point vectors. Second, by utilizing multi-head attention mechanisms and explicit spatiotemporal factors, the spatiotemporal features before and after the missing point are fused, strengthening the spatiotemporal semantic information of the missing point. Finally, based on the common transfer patterns of the group, strong correlations between points are mined to ensure the accuracy of the missing point prediction results and improve the reconstruction effect on sparse trajectories.
[0008] The user trajectory reconstruction method based on graph neural networks and spatiotemporal attention mechanism consists of three parts: a graph attention module based on point correlation, a point spatiotemporal feature aggregation module, and a trajectory recovery module based on global trajectory flow graph.
[0009] Step 1: Graph Attention Module Based on Point-to-Point Relationships
[0010] To address the issue that treating user trajectory reconstruction as a simple sequence prediction task neglects the complex topological structure between points, this method designs a graph attention module based on point correlation and adopts a point embedding method based on graph attention network and point collaboration matrix. The aim is to leverage the collaborative correlation between points to generate a more robust point representation and construct a global trajectory flow graph.
[0011] User check-in data typically includes fields such as record number, user identity information, location latitude and longitude, check-in location category, and record generation time. To initialize the point representation vector, this module uses the latitude and longitude values and the point category label as the first three elements of the representation vector, and employs a trigonometric function-based positional encoding method to generate subsequent elements. Based on this initial point representation, a graph attention network is used to further capture the complex topological relationships between points, completing point feature updates with acceptable computational complexity and better modeling the similarity dependencies between location representations.
[0012] This method first ensures that the graph attention network can project the features of each point into a higher representation space. Then, based on check-in data from diverse users, it mines the number and frequency of visits to different points along the same trajectory, constructing a point collaboration matrix. When the graph attention module updates point representations, it redesigns the attention scoring mechanism between each pair of neighboring nodes. This scoring considers both point feature similarity and the probability of point collaboration, representing the correlation strength between different points. Finally, it uses the attention score based on point collaboration to perform a weighted summation of the features of neighboring nodes, obtaining a new point feature representation. This enhances the graph attention network's ability to capture inter-location correlations, achieving embedded point representation.
[0013] Step 2: Location Spatiotemporal Feature Aggregation Module
[0014] Sparse trajectory reconstruction is a challenging problem due to the limited spatiotemporal information available. To fill in missing points across different time periods, it is necessary to integrate the spatiotemporal features of the user trajectory. The spatiotemporal feature aggregation module of this method maps the sequence of points within the trajectory into a sequence of spatiotemporal representations. Then, based on the location of the missing point, it adjusts the aggregation of its contextual spatiotemporal information to fully describe the spatiotemporal situation before and after the missing point.
[0015] To map the input sparse trajectory to be supplemented into a spatiotemporal representation sequence of points, this module first extracts point embedding representations from the global trajectory flow graph. This vector representation reflects the common transfer tendencies of the user group, rather than relying on the user's specific transfer patterns. Then, to enhance the correlation between user trajectory reconstruction and individual user tendencies, this module encodes user identity information into a low-dimensional vector. Subsequently, to capture the temporal information in user behavior patterns, this module uses a temporal embedding representation layer to perform time-segment mapping and embedding representation of the timestamps of each check-in point. Finally, by fusing the point embedding representation and the temporal embedding representation, and concatenating the spatiotemporal point representation with the user identity vector, a user point embedding representation sequence is formed.
[0016] Human movement exhibits complex transition patterns. Modeling movement patterns only between continuous locations ignores the information correlation between discontinuous points within the trajectory. Points before and after a missing point may not exist, and user behavior periodicity often manifests between various discontinuous and non-adjacent points. To address this issue, the point spatiotemporal feature aggregation module first introduces a multi-head attention mechanism to capture the spatiotemporal correlation between discontinuous points, modeling the spatiotemporal information of the positions before and after the missing point as feature vectors. Utilizing the multi-head attention mechanism allows the model to focus on information from multiple representation subspaces at different locations, capturing richer spatiotemporal feature information. Considering that the spatiotemporal intervals between different points can reflect different users' individual behavioral tendencies, an explicit spatiotemporal factor is additionally fused during the feature aggregation process in this module, quantifying the impact of the spatiotemporal interval. This yields the feature aggregation of the missing point and its preceding and following spatiotemporal information, achieving spatiotemporal representation estimation of the missing point.
[0017] Step 3: Trajectory Recovery Module Based on Global Trajectory Flow Graph
[0018] In commonly used trajectory reconstruction datasets, user check-in sequences are records of voluntary attendance, which presents several challenges. For example, some sequences may have few checkpoints, or some users may have very sparse check-in points overall. Furthermore, various environmental factors can cause frequent and periodic changes in user movement patterns, posing a challenge to sparse trajectory reconstruction. For most cold-start users with few check-in points, relying solely on their individual trajectory data is insufficient to capture complete behavioral patterns and complete trajectory reconstruction. Therefore, this method considers incorporating common group transfer patterns to predict the high-probability locations corresponding to missing points. This overcomes the difficulty in reconstructing cold-start user trajectories while also improving the accuracy and robustness of overall missing point prediction.
[0019] The core of the above method is a trajectory recovery module. Taking global point relevance information and the spatiotemporal features before and after the missing point as input, it first generates corresponding time-segment embeddings for missing points across diverse time periods, providing temporal information for point queries and probability calculations. A graph attention module based on point correlation provides the embeddings of points and constructs a global trajectory flow graph. The attention mechanism score generated during this process considers both point feature similarity and the probability of point co-occurrence, representing the correlation strength between different points. The trajectory recovery module uses the inner product between spatiotemporal feature representations and the correlation strength in the global trajectory flow graph to calculate the probability of a user visiting a specific point. First, it calculates the Top-1 predicted points with high similarity to the spatiotemporal features of the point to be searched based on the inner product. Then, considering that points strongly correlated with the Top-1 points also have a high probability, it further expands the searchable range by leveraging the commonalities of the group. Finally, it forms a list of possible distributions of missing points, with the point with the highest score being the supplementary result.
[0020] Compared with the prior art, the present invention has the following beneficial technical effects:
[0021] (1) This invention proposes a graph attention module based on point-location correlation, which uses a graph attention network to capture the complex topological relationships between points, and can better model the similarity dependency between location representations. This method utilizes point-location collaborative correlation and redesigns the attention scoring mechanism in the graph attention module, which enhances the graph attention network's capture of correlations between points and realizes the embedded representation of points.
[0022] (2) This invention proposes a point spatiotemporal feature aggregation module, which models the complex position transformation pattern of user movement, fully considers the information correlation between discontinuous points within the trajectory, and explicitly considers the spatiotemporal influencing factors between different points while introducing a temporal attention mechanism, and finally captures richer spatiotemporal features to achieve the aggregation of spatiotemporal information before and after missing points.
[0023] (3) This invention proposes a trajectory recovery method that is more suitable for sparse trajectory reconstruction. It uses the inner product between spatiotemporal feature representations and the correlation strength in the global trajectory flow graph to calculate the probability of a user accessing a certain point. While ensuring the accuracy of missing point reconstruction, it expands the queryable range, leverages the common advantages of the group, and increases the reliability and flexibility of the reconstruction results. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating the specific process framework of the present invention. Detailed Implementation
[0025] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0026] The user trajectory reconstruction method based on graph neural networks and spatiotemporal attention mechanism proposed in this invention mainly includes three parts: a graph attention module based on point-location correlation, a point-location spatiotemporal feature aggregation module, and a trajectory recovery module based on a global trajectory flow graph. The specific process framework and implementation steps are as follows: Figure 1 The specific implementation method is as follows:
[0027] Step 1: Graph Attention Module Based on Point-to-Point Relationships
[0028] The graph attention module based on point-to-point correlation designed in this invention adopts a point-to-point embedding method based on graph attention network and point-to-point collaboration matrix.
[0029] First, a location collaborative association matrix is constructed based on the user's historical check-in dataset. Where n represents the size of the point set L, x ij This represents the number of times points i and j appear simultaneously on a user trajectory. Since point collaboration mainly occurs between different points, setting the diagonal elements of the matrix to 0 generates a collaboration probability matrix. The formula is as follows:
[0030]
[0031] Where, p ij This represents the relative frequency at which points i and j are visited together within the same trajectory. During the point representation vector initialization phase, the latitude and longitude values from the check-in records and the point category label are used as the first three elements of the representation vector. A trigonometric function-based positional encoding method is then used to generate the subsequent elements of the representation vector, resulting in the initialized point representation vector. Where d is the dimension of the point representation vector.
[0032] The graph attention network used in this method takes the above-mentioned initial representation of points as input. When updating the point representation, it considers both the similarity of point features and the probability of point co-occurrence. A learnable parameter matrix is used to project the features and co-occurrence information of each point into a higher representation space. The attention score based on point co-occurrence is used to perform a weighted summation of the features of neighboring nodes to update the representation vector of each point. The formula is described as follows:
[0033] e ij =LeakyReLU(W1hi +W2h j +W3p ij ),
[0034]
[0035]
[0036] Among them, h i and h j Let p be the representation vector of points i and j. ij Let W1, W2, and W3 represent the probability that points i and j are visited together, and let e represent the learnable parameter matrices. ij This indicates the importance of point j to point i; N(i) represents the set of neighboring nodes of point i, α ij This introduces attention scores that reflect the collaborative relationships between points, enhancing the graph attention network's ability to capture these relationships. The graph attention network used in this module is configured with T... GAT Different attention points, then and W t The weighted result of the nodes learned by each head and the mapping parameter matrix, || denote vector concatenation, are obtained by T GAT By concatenating the outputs of the individual points, a more robust point representation h' can be generated. i This ultimately forms the global trajectory flow graph G. co-visit .
[0037] Step 2: Location Spatiotemporal Feature Aggregation Module
[0038] The point spatiotemporal feature aggregation module constructed in this invention can map a sequence of points within a trajectory into a sequence of point spatiotemporal representations. Then, based on the location of missing points, it adjusts the aggregation of their contextual spatiotemporal information to estimate the spatiotemporal features of the missing points. In the stage of constructing the point spatiotemporal representation sequence, this module first starts from the global trajectory flow graph G... co-visit Extracting point embedding representations that do not depend on user-specific transition patterns At the same time, user identity information is encoded into a low-dimensional vector. To capture time information from user behavior, a time embedding representation layer is used to map each check-in timestamp to 24 time periods in hours, and each time period is embedded as follows:
[0039]
[0040] Where i represents the temporal embedding representation vector The i-th dimension. Using the following point representation fusion method, a spatiotemporal representation of user u's location during time period t is formed:
[0041]
[0042] in, These represent the user identity embedding, the location embedding, and the time embedding for time period t, respectively. [;] indicates vector concatenation. W u and b u These are the learnable parameters that characterize the fusion process.
[0043] The spatiotemporal feature aggregation module, based on the Transformer encoder, generates a spatiotemporal feature aggregation vector for the missing point i by fusing explicit spatiotemporal factors to quantify the impact of spatiotemporal intervals between discontinuous points during the stage of generating the user's spatiotemporal representation sequence based on the input from the point spatiotemporal representation sequence generation module. The steps are shown in the following formula:
[0044]
[0045] W(ΔT it ,ΔD it )=ω T (ΔT it )×ω D (ΔD it ),
[0046] ω T (ΔT it )=exp(-αΔT it )×{asin(2πΔT it )+b cos(2πΔT it )},
[0047] ω D (ΔD it )=exp(-βΔD it )
[0048] Where T represents the total number of time periods involved in the current trajectory, W(ΔT) it ,ΔD it This represents the spatiotemporal influence factor of points in other time periods on missing points. This factor is composed of the time influence factor ω. T (ΔT it ) and spatial influence factor ω D (ΔD it Combining ΔT it and ΔD it ω represents the time interval and spatial distance between the missing point i and the point t, respectively. T (ΔT it The time periodicity is fitted using Fourier series, ω D (ΔD itThis study primarily focuses on the impact of spatial distance between points, where a, b, α, and β represent hyperparameters. User behavior patterns exhibit both periodicity and a strong correlation with recent spatiotemporal states. Points with longer time intervals from missing points provide less information about temporal periodicity. Users also consider distance factors when moving. In summary, the larger the spatiotemporal interval between points, the weaker the impact. To model this change, an exponentially decreasing function exp() is designed, which represents the elements in the spatiotemporal representation sequence of user points. Weighted concatenation is performed to obtain a feature aggregation vector based on spatiotemporal semantics. Provides input for matrix operations in multi-head attention mechanisms.
[0049] This module is set to T Trans Using different attention heads, while capturing the spatiotemporal correlation between discontinuous points, the model focuses on information from multiple representation subspaces, thereby capturing richer spatiotemporal features. The specific implementation is shown in the following equation:
[0050]
[0051]
[0052] Among them, the learnable parameter matrix is used Based on Constructed The attention matrix Att is calculated by mapping the query, key, and value of each attention head to the query, key, and value respectively. t By combining multiple outputs and using a learnable parameter matrix W... re The mapping forms a multi-head attention mechanism output guided by explicit spatiotemporal factors. Further combining the forward propagation layer and the pooling method that inserts the first placeholder vector, a spatiotemporal feature prediction result for the missing point i of user u is generated.
[0053] Step 3: Trajectory Recovery Module Based on Global Trajectory Flow Graph
[0054] To overcome the difficulty of reconstructing user trajectories during cold starts while improving the accuracy and robustness of overall missing point prediction, this invention proposes a trajectory recovery module based on a global trajectory flow graph. This module uses the global trajectory flow graph G... co-visit And the spatiotemporal feature prediction results of the missing points to be supplemented For input.
[0055] This module first measures the probability that user u might visit each location during the missing time period t based on the inner product. The formula is as follows:
[0056]
[0057]
[0058] Among them, e j It is from G co-visit The embedding representation of other points j incorporates the time period information e corresponding to the missing points. t After retrieving the Top-1 predicted points with the highest probability, further analysis is conducted to determine whether points strongly correlated with the Top-1 points (l1) can be used to expand the prediction result list. The specific implementation is shown in the following formula:
[0059]
[0060] in, It is to construct the global trajectory flow graph G co-visit The score of the attention mechanism used represents the correlation strength between different points, and σ represents the softmax activation function. This is equivalent to a final prediction score, used to form a list of possible outcomes for missing points. The point with the highest score is the most likely replacement, and other top-ranked prediction points can also contribute to sparse trajectory reconstruction, improving the coverage and reliability of the prediction results. This invention optimizes the entire trajectory reconstruction model using a cross-entropy loss function, described by the following formula:
[0061]
[0062] Where U is the set of users who need trajectory reconstruction, each user corresponds to the set of trajectories Tj to be reconstructed, and for each trajectory, there is a set M of missing points. It is a one-hot encoding generated based on the actual access point m of user u. This represents the probability distribution of the predicted results.
[0063] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A user trajectory reconstruction method based on a graph neural network and a spatio-temporal attention mechanism, characterized in that, The method includes the following steps: Step 1: Construct a graph attention module based on point-location correlation. This graph attention module uses a graph attention network to generate point-location embedding representations and adopts a graph attention scoring mechanism based on point-location correlation. It considers both point feature similarity and the probability of point co-occurrence, effectively capturing complex topological relationships between points while enriching the semantic information of point-location embedding representations. Step 2: Construct a point spatiotemporal feature aggregation module. This module is used to map the trajectory point sequence into a spatiotemporal representation sequence. Then, a multi-head attention mechanism that integrates spatiotemporal influence factors is used to aggregate spatiotemporal information based on the position of the missing point in the sequence, thereby estimating the spatiotemporal representation of the missing point. Step 3: Construct a trajectory recovery module based on a global trajectory flow graph. This module uses the inner product between spatiotemporal features and the correlation strength in the global trajectory flow graph to predict the probability of a user visiting a certain point. By combining the group movement pattern, the accuracy and robustness of sparse trajectory reconstruction are improved. In step one, firstly, a location collaborative association matrix is constructed based on the user's historical check-in dataset. ,in Represents the set of points Size, Representative points and The number of times a point appears on the same user trajectory is determined by setting the diagonal elements of the matrix to 0, since point-to-point collaboration is reflected between different points. This generates a collaboration probability matrix. The formula is as follows: in, Representative points and The relative frequency of common visits within the same trajectory; in the point representation vector initialization stage, the latitude and longitude values and point category labels in the check-in records are used as the first three elements of the representation vector, and a position encoding method based on trigonometric functions is used to generate the subsequent elements of the representation vector, thus obtaining the point initialization representation vector. ,in The dimension of the vector is represented by the point position; Using the above initial representation of points as input, when updating the point representation, both the similarity of point features and the probability of point collaboration are considered. A learnable parameter matrix is used to project the features and collaboration information of each point into a higher representation space. The features of neighboring nodes are weighted and summed using attention scores based on point collaboration to update the representation vector of each point. The formula is described as follows: in, and For point and The representation vector, Representative points and The probability of being accessed by multiple people. , and This represents the learnable parameter matrix. This indicates the location. For the location The importance of; Indicates point The set of neighboring nodes, This introduces attention scores to reflect the collaborative relationships between points, enhancing the graph attention network's ability to capture these relationships. The graph attention network used in this module is configured with... Different attention points, then and The weighted results of the nodes learned by each head and the mapping parameter matrix, This represents vector concatenation, achieved by... By concatenating the outputs of individual points, a more robust point representation can be generated. This ultimately forms a global trajectory flow graph. .
2. The method according to claim 1, characterized in that, In step two, during the stage of constructing the spatiotemporal representation sequence of points, the global trajectory flow graph is first used. Extracting point embedding representations that do not depend on user-specific transition patterns Encode user identity information into a low-dimensional vector. ; To capture time information from user behavior, a time embedding representation layer is used to map each check-in timestamp to 24 time periods in hours, and each time period is embedded as follows: in, Represents the temporal embedding vector The Dimensions are formed by using the following point representation fusion method to create user representations. exist Spatiotemporal representation of points in time period: in, These are, respectively, the embedded representation of user identity, and Point embedding representation and time embedding representation corresponding to time periods This indicates the concatenation of vectors. and These are the learnable parameters that characterize the fusion process; The spatiotemporal feature aggregation module for geographic locations uses a Transformer encoder as its backbone. During the stage where the module generates the spatiotemporal representation sequence based on user geographic location data, it integrates explicit spatiotemporal factors to quantify the impact of spatiotemporal intervals between discontinuous geographic locations, specifically targeting missing points. Generate spatiotemporal feature aggregation vector The steps are shown in the following formula: in, This represents the number of time periods involved in the current trajectory. This represents the spatiotemporal influence factor of points at other time periods on missing points. This factor is composed of the time influence factor. Spatial Influence Factor Combination and These represent missing points. with point The time interval and spatial distance, The time periodicity is fitted using Fourier series. The main focus is on the impact of spatial distance between locations, among which , as well as , Representing hyperparameters, user behavior patterns exhibit both periodicity and a strong correlation with recent spatiotemporal states. Points with longer time intervals from missing points provide less information about temporal periodicity. Users also consider distance factors when moving. Therefore, the larger the spatiotemporal interval between points, the weaker the influence. To model this change, an exponentially decreasing function was designed. Elements in the sequence are represented by user location in time and space. Weighted concatenation is performed to obtain a feature aggregation vector based on spatiotemporal semantics. This provides input for matrix operations in the multi-head attention mechanism; This module is configured. Using different attention heads, while capturing the spatiotemporal correlation between discontinuous points, the model focuses on information from multiple representation subspaces, thereby capturing richer spatiotemporal features. The specific implementation is shown in the following equation: Among them, the learnable parameter matrix is used Based on Constructed The attention matrix is calculated by mapping the query, key, and value of each attention head respectively. Through the splicing and combination of multiple outputs, and the learnable parameter matrix The mapping forms an output of a multi-head attention mechanism guided by explicit spatiotemporal factors. Furthermore, by combining the forward propagation layer and the pooling method that inserts the first and second placeholder vectors, a user-defined algorithm is formed. missing points Spatiotemporal feature prediction results .
3. The method according to claim 2, characterized in that, In step three, the user is first measured based on the inner product. During the missing point period Probability of visiting each location The formula is as follows: in, It comes from the global trajectory flow graph. Other locations The embedded representation combines the time period information corresponding to the missing points. After retrieving the Top-1 predicted point with the highest probability, further analysis is performed on the Top-1 point. Can strongly correlated points be used to expand the prediction result list? The specific implementation is shown in the following formula: in, It is to construct a global trajectory flow graph. The score of the attention mechanism used represents the correlation strength between different points. This represents the softmax activation function. The final prediction score is used to form a list of possible outcomes for missing points. The point with the highest score is the most likely replacement. Other top-ranked prediction points can also help reconstruct sparse trajectories, improving the coverage and reliability of the prediction results. The entire model is optimized using the cross-entropy loss function, as described in the following formula: in, It is the set of users whose trajectories need to be reconstructed, with each user corresponding to a set of trajectories to be reconstructed. For the set of missing points within each trajectory , It is based on the user Actual access points The generated one-hot encoding, This represents the probability distribution of the predicted results.