POI recommendation method and system based on spatio-temporal lightweight graph attention mechanism
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI VOCATIONAL COLLEGE OF ELECTRONICS & INFORMATION TECH
- Filing Date
- 2026-06-18
- Publication Date
- 2026-08-07
AI Technical Summary
现有的时空建模方法,从离散表征到神经融合方法,同样未能在建模能力和计算效率之间取得平衡
[0061] (1) The single-head graph transformer layer in the feature extraction module of this invention adopts a single-layer single-head attention mechanism, which directly performs attention calculation in the full-dimensional embedding space, effectively solving the problem of high time complexity of traditional multi-head attention mechanism and improving computational efficiency.
Smart Images

Figure CN122527418A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence and big data analysis technology, specifically a POI recommendation method and system based on a spatiotemporal lightweight graph attention mechanism. Background Technology
[0002] With the widespread adoption of mobile devices and location-based services, location-based social networks (LBSNs) have generated massive amounts of spatiotemporal trajectory data, which vividly reveal users' movement patterns and inherent preferences. As a core function of LBSNs, Points of Interest (POI) recommendations not only enhance user experience through personalized needs but also create considerable commercial value in diverse fields such as tourism, retail, and services.
[0003] POI recommendation systems face two major challenges in task execution. First, they suffer from low computational efficiency, especially for graph transformer models, where the time complexity of the standard multi-head attention mechanism reaches O(hN). 2 d) (where hN) 2 (where d represents the number of attention heads, N represents the number of nodes in the graph, and d is the node embedding dimension). This severely limits the model's scalability, making it difficult to deploy in high-concurrency scenarios with millisecond-level response times. Secondly, the inherent spatiotemporal characteristics of POI data require specialized modeling strategies, while existing models have limited accuracy in modeling complex spatiotemporal dependencies, affecting recommendation accuracy.
[0004] Existing recommendation methods attempt to address these problems in isolation but fail to achieve this balance. Graph neural networks (GNNs) such as LightGCN improve computational efficiency but struggle to capture long-range dependencies. Transformer-based models enhance representational capabilities but incur high computational overhead. Existing spatiotemporal modeling methods, from discrete representations to neural fusion approaches, similarly fail to achieve a balance between modeling capability and computational efficiency. Summary of the Invention
[0005] The technical problem to be solved by this invention is to provide a POI recommendation method and system based on a spatiotemporal lightweight graph attention mechanism, which greatly improves the efficiency of recommendation and at the same time improves the accuracy of recommendation.
[0006] The technical solution of this invention is as follows:
[0007] The POI recommendation method based on a spatiotemporal lightweight graph attention mechanism includes the following steps:
[0008] (1) Obtain the user-interest interaction graph as input and generate node feature embedding vectors. Each edge of the user-interest interaction graph is associated with an original spatiotemporal data.
[0009] (2) The spatiotemporal feature fusion module encodes the original spatiotemporal data through the spatiotemporal encoder, and fuses the spatiotemporal feature embedding vector obtained after encoding with the node feature embedding vector to form a fused feature embedding vector;
[0010] (3) The feature extraction module extracts global and local features. The feature extraction module includes a single-head graph transformer layer, a subgraph processing module, a graph convolutional layer, a position-aware neural network layer, and a local graph processing module. The feature embedding vector is fused and the global features are extracted by the single-head graph transformer layer. The subgraph processing module generates encoder subgraphs and decoder subgraphs based on the attention weights generated by the single-head graph transformer layer. At the same time, the fused feature embedding vector is input to the graph convolutional layer. The graph convolutional layer aggregates the basic topology structure and injects global relative position information in combination with the position-aware neural network layer. Finally, the local graph processing module delineates local subgraphs and fuses sequence patterns to extract local features.
[0011] (4) The embedding integration and aggregation module performs attention aggregation and reconstruction on the generated encoder subgraph and decoder subgraph to obtain high-order global features. Then, it fuses the high-order global features and the extracted local features to generate user embedding vectors and interest point embedding vectors.
[0012] (5) Based on the generated user embedding vector and interest point embedding vector, calculate the user's preference score for the interest point, sort the preference scores in descending order, and output the interest points with the highest ranking as the POI recommendation results.
[0013] The user-interest interaction graph mentioned above is , That is, the set of all nodes in the user-interest interaction graph. For user nodes and points of interest The input layer transforms all nodes in the user-interest interaction graph into node feature embedding vectors, representing the union of the input graph. Node feature embedding vector This includes user node feature embedding vectors and interest point node feature embedding vectors. That is, the set of all edges in the user-interest interaction graph. For any user node and any point of interest node The set of ordered pairs formed by pairings, where the original spatiotemporal data associated with each edge is... , Represents a timestamp. Represents longitude. Represents latitude.
[0014] The spatiotemporal feature fusion module encodes the original spatiotemporal data using a spatiotemporal encoder, and then fuses the encoded spatiotemporal feature embedding vector with the node feature embedding vector to form a fused feature embedding vector. Specifically, this includes the following steps:
[0015] S21. Feature preprocessing: Based on the spatiotemporal attributes of the POI recommendations, the original spatiotemporal data is normalized, as shown in the following formula (1):
[0016] (1);
[0017] In equation (1), Represents the normalized time characteristics. This represents the minimum value in the entire timestamp data sequence. Represents the maximum value in the entire timestamp data sequence. Represents the normalized latitudinal characteristics. Represents the normalized longitude characteristics; , and Composition of normalized spatiotemporal feature vectors ;
[0018] S22, Spatiotemporal coding: A spatiotemporal encoder is used to process the normalized spatiotemporal feature vector. Encode the code as shown in formula (2) below:
[0019] (2);
[0020] In equation (2), the spatiotemporal encoder is a two-layer neural network structure, including two linear fully connected layers and a ReLU activation function. and This represents the weight matrix and bias vector of the first linear fully connected layer. and This represents the weight matrix and bias vector of the second linear fully connected layer. Represents the ReLU activation function; This represents the encoded spatiotemporal feature embedding vector;
[0021] S23. Adaptive Fusion: Embedding Spatiotemporal Features into Vectors With node feature embedding vector The features are fused to form a fused feature embedding vector. , see the following formula (3) for details:
[0022] (3);
[0023] In equation (3), The spatiotemporal feature embedding vector representing all edges associated with any node. The mean; This represents the spatiotemporal weighting coefficient, which is a hyperparameter.
[0024] The feature extraction module extracts global and local features, specifically including the following steps:
[0025] S31. The fused feature embedding vector is processed by a single-head graph transformer layer to extract global features. The single-head graph transformer layer adopts a single-layer single-head attention mechanism. The specific processing procedure is shown in the following formula (4):
[0026] (4);
[0027] In equation (4), Represents the fused feature embedding vector The row node embedding of the middle edge is the fused feature embedding vector of the starting node of each interactive edge. Represents the fused feature embedding vector The column node embedding of the middle edge is the fused feature embedding vector of the neighboring nodes pointed to by the same interaction edge. , and These are the weight projection matrices for the query, key, and value, respectively. Represents the query matrix; Represents the bond matrix; Representative value matrix; Represents transposition; Represents the dimension of the feature vector. Represents the scaling factor; Represents the original attention score; This represents the cutoff function; -10.0 and 10.0 represent the upper and lower limits of the cutoff, respectively. This represents the truncated attention score; Represents a row-based index; Represents the initial value to be accumulated; This represents the row node index corresponding to each edge; After grouping by the starting node, each group contains... The summation of rows is obtained by grouping the vectors. It is a very small constant to prevent the denominator from being zero; Represents attention weight; The output representing a single-layer, single-head attention is the extracted global feature;
[0028] S32, The subgraph processing module generates attention weights based on the single-headed graph transformer layer. The encoder subgraph and decoder subgraph are generated. The process of generating the encoder subgraph is shown in equation (5), and the process of generating the decoder subgraph is shown in equation (6).
[0029] (5);
[0030] In equation (5), Representing the side Attention weights, edge From the set of edges in the user-interest interaction graph ; Represents a multinomial random sampling function, with As a sampling probability, the edge with the higher the attention weight, the greater the probability of being selected; The representation is obtained by random sampling according to a distribution. This represents the set of edges in the encoder subgraph obtained after sampling and filtering. This represents the total number of encoder subgraph edges in the encoder subgraph edge set; This represents the encoder sample retention rate and is a hyperparameter. Representative set The total number of sides in the middle; The generated encoder subgraph is a set of all nodes in the user-interest interaction graph. It consists of the encoder subgraph edge set obtained after sampling and filtering;
[0031] (6);
[0032] In equation (6), Represents the sampling probability of the original mask; The sum of the original mask sampling probabilities of all edges in the user-interest interaction graph; Represents the sampling probability of the normalized mask; This represents the set of edges in the decoder subgraph obtained after sampling and filtering. Represents a multinomial random sampling function, with The sampling probability; This represents the total number of edges in the decoder subgraph edge set; Represents the decoder sample retention rate, which is a hyperparameter; The generated decoder subgraph is a set of all nodes in the user-interest interaction graph. It consists of the decoder subgraph edge set obtained after sampling and filtering;
[0033] The generated encoder and decoder subgraphs are used to calculate the contrastive loss using the standard InfoNCE framework, and backpropagation is used to optimize the parameters in the single-head graph transformer layer and the spatiotemporal feature fusion module.
[0034] S33, The convolutional layer receives the fused feature embedding vector. The basic topology is aggregated through multi-hop neighbor message passing, as shown in the following formula (7):
[0035] (7);
[0036] In equation (7), Representative node In the convolutional layer of the graph +1 layer fusion feature embedding vector, This represents the fused feature embedding vector of neighbor node j at layer l. ; Representative node The set of neighboring nodes; Representative node The graph degree, i.e., the degree of the nodes The number of connected edges Represents neighboring nodes The graph degree, i.e., the degree of the graph with neighboring nodes. The number of connected edges; Represents the symmetric normalization coefficient;
[0037] After processing by the Lth layer of the graph convolutional layer, the output is... That is, the fused feature embedding vector after aggregating the topological information of all nodes in the user-interest interaction graph;
[0038] S34. The position-aware neural network layer introduces anchor-based distance position coding to enable the network to perceive the spatial relative position of nodes, as shown in the following formula (8). Then, the position coding of each node is injected into the output of the graph convolutional layer, thereby injecting global relative position information into each node.
[0039] (8);
[0040] In equation (8), Representative node and anchor point The shortest path length between them; Representative node and anchor point The positional similarity weights between nodes; anchor points are multiple nodes selected in the user-interest interaction graph as positional reference points; nodes With multiple anchor points respectively Position similarity weights of nodes Location encoding;
[0041] S35. The local graph processing module first extracts the L-hop local subgraph for each node based on the output of the position-aware neural network layer. The L-hop local subgraph is an interaction graph composed of a node and its L-order neighbor nodes. The feature embedding vector of each node in the L-hop local subgraph is the fused feature embedding vector after aggregating the node's topological information. Local pooling is used to aggregate the node features in the L-hop local subgraph to obtain local topological aggregated features. At the same time, based on the output of the position-aware neural network layer, path encoding is performed on the user-interest point interaction sequence or random walk path to capture the sequence pattern of continuous access and extract the sequence features. Finally, the local topological aggregated features and the sequence features are fused to output the local structure-enhanced node representation, i.e., local features.
[0042] The method involves calculating the user's preference score for interest points based on the generated user embedding vector and interest point embedding vector. , see the following formula (9) for details:
[0043] (9);
[0044] In equation (9), Represents the user embedding vector. This represents the embedding vector of the interest point.
[0045] When the POI recommendation method is trained using a constructed composite loss function, the composite loss function... See the following formula (10) for details:
[0046] (10);
[0047] In equation (10), The Bayesian personalized ranking loss is calculated as shown in equation (11). The comparison loss function is shown in equation (12) below. The L2 regularization loss is represented by the following formula (13).
[0048] (11);
[0049] In equation (11), On behalf of users, These represent the points of interest that users have actually interacted with, and serve as positive samples. Representing user-uninteracted points of interest as negative samples. This represents the set of triplets consisting of users, positive samples, and negative samples during training. Preference scores representing positive samples of user preferences. The preference score represents the user's preference for negative samples. Represents the Sigmoid activation function;
[0050] (12);
[0051] In equation (12), The method represents user representation contrastive learning, which pulls in positive and negative sample embeddings of the same user and pulls out different users; The learning method involves comparative study of interest point representations, with similar interest point representations being aggregated and dissimilar ones being dispersed. This represents the cross-modal contrast loss between the user and points of interest; Represents the neighborhood contrast loss, which is the contrast loss calculated using the standard InfoNCE framework for the generated encoder subgraph and decoder subgraph; , and for , and The loss weights of the three terms are hyperparameters;
[0052] (13);
[0053] In equation (13), Represents the set of trainable parameters; Represents a single parameter in the set of trainable parameters; This represents the weight coefficient of the regularization term, and is a hyperparameter. This represents the square of the L2 norm.
[0054] The POI recommendation system based on the spatiotemporal lightweight graph attention mechanism includes an input layer, a spatiotemporal feature fusion module, a feature extraction module, an embedding integration and aggregation module, and an output layer.
[0055] The input layer is used to obtain the user-interest interaction graph, generate node feature embedding vectors, and associate a piece of original spatiotemporal data with each edge of the user-interest interaction graph;
[0056] The spatiotemporal feature fusion module encodes spatiotemporal features and fuses the encoded spatiotemporal feature embedding vector with the node feature embedding vector to form a fused feature embedding vector.
[0057] The feature extraction module is used to extract global and local features;
[0058] The embedding integration and aggregation module is used to perform attention aggregation and reconstruction on the generated encoder subgraph and decoder subgraph to obtain high-order global features. Then, the high-order global features and the extracted local features are fused to generate user embedding vectors and interest point embedding vectors.
[0059] The output layer is used to calculate the user's preference score for points of interest and output the POI recommendation results.
[0060] Advantages of this invention:
[0061] (1) The single-head graph transformer layer in the feature extraction module of this invention adopts a single-layer single-head attention mechanism, which directly performs attention calculation in the full-dimensional embedding space, effectively solving the problem of high time complexity of traditional multi-head attention mechanism and improving computational efficiency.
[0062] (2) The spatiotemporal feature fusion module of the present invention can integrate spatiotemporal patterns and retain graph structure node information, effectively capturing the inherent time periodicity and location correlation in user access behavior, making up for the shortcomings of existing spatiotemporal modeling strategies and improving the accuracy of recommendations. Attached Figure Description
[0063] Figure 1 This is a flowchart of the POI recommendation method of the present invention.
[0064] Figure 2 This is a block diagram illustrating the principle of the POI recommendation system of this invention.
[0065] Figure 3 This is a bar chart comparing the evaluation metrics of the GFormer model, STSim-GFormer w / o ST model, STSim-GFormer w / o Sim model, and STSim-GFormer model on the Gowalla dataset in the ablation study of this invention.
[0066] Figure 4 This is a bar chart comparing the evaluation metrics of the GFormer model, STSim-GFormer w / o ST model, STSim-GFormer w / o Sim model, and STSim-GFormer model on the Foursquare dataset in the ablation study of this invention.
[0067] Figure 5 This is a bar chart comparing the training times of the GFormer model, STSim-GFormer w / o ST model, STSim-GFormer w / o Sim model, and STSim-GFormer model on the Gowalla dataset and Foursquare dataset in the ablation study of this invention. Detailed Implementation
[0068] 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.
[0069] See Figure 1 and Figure 2 The POI recommendation method based on a spatiotemporal lightweight graph attention mechanism is a POI recommendation system. This system includes an input layer, a spatiotemporal feature fusion module, a feature extraction module, an embedding integration and aggregation module, and an output layer. The POI recommendation method specifically includes the following steps:
[0070] (1) The input layer obtains the user-interest point interaction graph as input and generates node feature embedding vectors. Each edge of the user-interest point interaction graph is associated with an original spatiotemporal data.
[0071] The user-interest interaction graph is as follows: , That is, the set of all nodes in the user-interest interaction graph. For user nodes and points of interest The input layer transforms all nodes in the user-interest interaction graph into node feature embedding vectors, representing the union of the input graph. Node feature embedding vector This includes user node feature embedding vectors and interest point node feature embedding vectors. That is, the set of all edges in the user-interest interaction graph. For any user node and any point of interest node The set of ordered pairs formed by pairings, where the original spatiotemporal data associated with each edge is... , Represents a timestamp. Represents longitude. Represents latitude;
[0072] (2) The spatiotemporal feature fusion module encodes the original spatiotemporal data through a spatiotemporal encoder, and fuses the resulting spatiotemporal feature embedding vector with the node feature embedding vector to form a fused feature embedding vector. The specific steps include:
[0073] S21. Feature preprocessing: Based on the spatiotemporal attributes of the POI recommendations, the original spatiotemporal data is normalized, as shown in the following formula (1):
[0074] (1);
[0075] In equation (1), Represents the normalized time characteristics. This represents the minimum value in the entire timestamp data sequence. Represents the maximum value in the entire timestamp data sequence. Represents the normalized latitudinal characteristics. Represents the normalized longitude characteristics; , and Composition of normalized spatiotemporal feature vectors ;
[0076] S22, Spatiotemporal coding: A spatiotemporal encoder is used to process the normalized spatiotemporal feature vector. Encode the code as shown in formula (2) below:
[0077] (2);
[0078] In equation (2), the spatiotemporal encoder is a two-layer neural network structure, including two linear fully connected layers and a ReLU activation function. and This represents the weight matrix and bias vector of the first linear fully connected layer. and This represents the weight matrix and bias vector of the second linear fully connected layer. Represents the ReLU activation function; This represents the encoded spatiotemporal feature embedding vector;
[0079] S23. Adaptive Fusion: Embedding Spatiotemporal Features into Vectors With node feature embedding vector The features are fused to form a fused feature embedding vector. , see the following formula (3) for details:
[0080] (3);
[0081] In equation (3), The spatiotemporal feature embedding vector representing all edges associated with any node. The mean; This represents the spatiotemporal weighting coefficient, which is a hyperparameter.
[0082] (3) The feature extraction module extracts global and local features. The feature extraction module includes a single-head graph transformer layer, a subgraph processing module, a graph convolutional layer, a position-aware neural network layer, and a local graph processing module. Specifically, it includes the following processing steps:
[0083] S31. The fused feature embedding vector is processed by a single-head graph transformer layer to extract global features. The single-head graph transformer layer adopts a single-layer single-head attention mechanism. The specific processing procedure is shown in the following formula (4):
[0084] (4);
[0085] In equation (4), Represents the fused feature embedding vector The row node embedding of the middle edge is the fused feature embedding vector of the starting node of each interactive edge. Represents the fused feature embedding vector The column node embedding of the middle edge is the fused feature embedding vector of the neighboring nodes pointed to by the same interaction edge. , and These are the weight projection matrices for the query, key, and value, respectively. Represents the query matrix; Represents the bond matrix; Representative value matrix; Represents transposition; Represents the dimension of the feature vector. Represents the scaling factor; Represents the original attention score; This represents the cutoff function; -10.0 and 10.0 represent the upper and lower limits of the cutoff, respectively. This represents the truncated attention score; Represents a row-based index; Represents the initial value to be accumulated; This represents the row node index corresponding to each edge; After grouping by the starting node, each group contains... The summation of rows is obtained by grouping the vectors. It is a very small constant to prevent the denominator from being zero; Represents attention weight; The output representing a single-layer, single-head attention is the extracted global feature;
[0086] S32, The subgraph processing module generates attention weights based on the single-headed graph transformer layer. The encoder subgraph and decoder subgraph are generated. The process of generating the encoder subgraph is shown in equation (5), and the process of generating the decoder subgraph is shown in equation (6).
[0087] (5);
[0088] In equation (5), Representing the side Attention weights, edge From the set of edges in the user-interest interaction graph ; Represents a multinomial random sampling function, with As a sampling probability, the edge with the higher the attention weight, the greater the probability of being selected; The representation is obtained by random sampling according to a distribution. This represents the set of edges in the encoder subgraph obtained after sampling and filtering. This represents the total number of encoder subgraph edges in the encoder subgraph edge set; This represents the encoder sample retention rate and is a hyperparameter. Representative set The total number of sides in the middle; The generated encoder subgraph is a set of all nodes in the user-interest interaction graph. It consists of the encoder subgraph edge set obtained after sampling and filtering;
[0089] (6);
[0090] In equation (6), Represents the sampling probability of the original mask; The sum of the original mask sampling probabilities of all edges in the user-interest interaction graph; Represents the sampling probability of the normalized mask; This represents the set of edges in the decoder subgraph obtained after sampling and filtering. Represents a multinomial random sampling function, with The sampling probability; This represents the total number of edges in the decoder subgraph edge set; Represents the decoder sample retention rate, which is a hyperparameter; The generated decoder subgraph is a set of all nodes in the user-interest interaction graph. It consists of the decoder subgraph edge set obtained after sampling and filtering;
[0091] The generated encoder and decoder subgraphs are used to calculate the contrast loss using the standard InfoNCE framework. Backpropagation optimizes the parameters in the single-head graph transformer layer and the spatiotemporal feature fusion module. The InfoNCE framework controls the concentration level of the distribution through a temperature parameter (value 0.2) and compares positive samples with negative samples.
[0092] S33, The convolutional layer receives the fused feature embedding vector. The basic topology is aggregated through multi-hop neighbor message passing, as shown in the following formula (7):
[0093] (7);
[0094] In equation (7), Representative node In the convolutional layer of the graph +1 layer fusion feature embedding vector, This represents the fused feature embedding vector of neighbor node j at layer l. ; Representative node The set of neighboring nodes; Representative node The graph degree, i.e., the degree of the nodes The number of connected edges Represents neighboring nodes The graph degree, i.e., the degree of the graph with neighboring nodes. The number of connected edges; Represents the symmetric normalization coefficient;
[0095] After processing by the Lth layer of the graph convolutional layer, the output is... That is, the fused feature embedding vector after aggregating the topological information of all nodes in the user-interest interaction graph;
[0096] S34. The position-aware neural network layer introduces anchor-based distance position coding to enable the network to perceive the spatial relative position of nodes, as shown in the following formula (8). Then, the position coding of each node is injected into the output of the graph convolutional layer, thereby injecting global relative position information into each node.
[0097] (8);
[0098] In equation (8), Representative node and anchor point The shortest path length between them; Representative node and anchor point The positional similarity weights between nodes; anchor points are multiple nodes selected in the user-interest interaction graph as positional reference points; nodes With multiple anchor points respectively Position similarity weights of nodes Location encoding;
[0099] S35. The local graph processing module first extracts the L-hop local subgraph (L=2) of each node based on the output of the position-aware neural network layer. The L-hop local subgraph is an interaction graph composed of a node and its two-order neighbor nodes. The two-order neighbor nodes include the first-order nodes adjacent to the node and the second-order nodes adjacent to the first-order nodes. The feature embedding vector of each node in the L-hop local subgraph is the fused feature embedding vector after the node aggregates topological information. Local pooling is used to aggregate the node features in the L-hop local subgraph to obtain local topological aggregated features. At the same time, based on the output of the position-aware neural network layer, path encoding is performed on the user-interest point interaction sequence or random walk path to capture the sequence pattern of continuous access and extract the sequence features. Finally, the local topological aggregated features and the sequence features are fused to output the local structure enhanced node representation, i.e., local features.
[0100] (4) The embedding integration and aggregation module performs attention aggregation and reconstruction on the generated encoder subgraph and decoder subgraph to obtain high-order global features. Then, it fuses the high-order global features and the extracted local features to generate user embedding vectors and interest point embedding vectors.
[0101] (5) The output layer calculates the user's preference score for the interest point based on the generated user embedding vector and interest point embedding vector. See equation (9) below for details, and sort the preference scores in descending order, and output the interest points with the highest ranking as the POI recommendation results;
[0102] (9);
[0103] In equation (9), Represents the user embedding vector. This represents the embedding vector of the interest point.
[0104] The POI recommendation system starts from the original user-interest interaction graph before training. Each node is used as an anchor point. The positional similarity weight from each node to each anchor point is calculated and concatenated to form the positional code of each node.
[0105] During training, when training is performed using a constructed composite loss function, the composite loss function... See the following formula (10) for details:
[0106] (10);
[0107] In equation (10), The Bayesian personalized ranking loss is calculated as shown in equation (11). The comparison loss function is shown in equation (12) below. The L2 regularization loss is represented by the following formula (13).
[0108] (11);
[0109] In equation (11), On behalf of users, These represent the points of interest that users have actually interacted with, and serve as positive samples. Representing user-uninteracted points of interest as negative samples. This represents the set of triplets consisting of users, positive samples, and negative samples during training. Preference scores representing positive samples of user preferences. The preference score represents the user's preference for negative samples. Represents the Sigmoid activation function;
[0110] (12);
[0111] In equation (12), The method represents user representation contrastive learning, which pulls in positive and negative sample embeddings of the same user and pulls out different users; The learning method involves comparative study of interest point representations, with similar interest point representations being aggregated and dissimilar ones being dispersed. This represents the cross-modal contrast loss between the user and points of interest; Represents the neighborhood contrast loss, which is the contrast loss calculated using the standard InfoNCE framework for the generated encoder subgraph and decoder subgraph; , and for , and The loss weights of the three terms are hyperparameters;
[0112] (13);
[0113] In equation (13), Represents the set of trainable parameters; Represents a single parameter in the set of trainable parameters; This represents the weight coefficient of the regularization term, and is a hyperparameter. This represents the square of the L2 norm.
[0114] Performance Analysis:
[0115] (1) Datasets: Gowalla and Foursquare datasets. As shown in Table 1, both datasets contain more than 25,000 points of interest (POIs). The Gowalla dataset contains check-in records from February 2009 to October 2010, while the Foursquare dataset covers check-in records from April 2012 to September 2013. Each check-in record contains a timestamp with second-order precision.
[0116] Table 1
[0117]
[0118] (2) Data preprocessing: According to the standard POI recommendation protocol, interest points with fewer than 10 interactive users on the Foursquare dataset and fewer than 15 interactive users on the Gowalla dataset were first selected; the timestamps were normalized to The location coordinates (longitude and latitude) are normalized to [0,1] to construct a user-interest interaction graph containing spatiotemporal features; the check-in records are divided into training set (70%), test set (20%) and validation set (10%) in chronological order.
[0119] (3) Evaluation metrics: Recall@K (Recall Rate@K), used to calculate the proportion of the top K recommended interest points visited by a user out of all the interest points actually visited by the user; NDCG@K (Normalized Discount Cumulative Gain@K), used to calculate the proportion and ranking of the top K recommended interest points out of all the interest points actually visited by the user; and the training time (in seconds) of each training cycle is measured to evaluate computational efficiency.
[0120] (4) Existing comparative models: Geo-Teaser: used to capture time series patterns of point of interest recommendations with geographical influence; GeoMF: a matrix factorization model that incorporates geographical influence using a two-dimensional kernel density estimation method; LightGCN: a simplified graph convolutional network that removes feature transformation and nonlinear activation operations; GPR: a graph-based geographic latent representation model that uses graph autoencoder technology for modeling; GNN-POI: a combination of graph neural networks and bidirectional LSTM to jointly model spatial and temporal features; RST-GCN: a regionalized temporal graph convolutional layer that combines spatial structure with self-attention mechanism to capture temporal dynamic features; Former: the original multi-head attention graph transformer model (number of heads = 4).
[0121] (5) Performance comparison results:
[0122] Table 2 shows the performance comparison results of the POI recommendation system STSim-GFormer of this invention and seven existing comparison models on the Gowalla and Foursquare datasets. Among them, Top-10 indicates that the model recommends the top 10 POIs for each user, and Top-20 indicates that the model recommends the top 20 POIs for each user.
[0123] Table 2
[0124]
[0125] The evaluation metrics in Table 2 show that STSim-GFormer consistently outperforms seven existing comparative models on both datasets.
[0126] On the Gowalla dataset, STSim-GFormer achieves significant performance improvements over the GFormer model: Recall@10 is improved by 18.5%, NDCG@10 by 22.9%, Recall@20 by 14.7%, and NDCG@20 by 26.5%. Similar improvements are observed on the Foursquare dataset: Recall@10 is improved by 8.7%, NDCG@10 by 16.1%, Recall@20 by 11.0%, and NDCG@20 by 21.6%.
[0127] (6) Ablation Study: To verify the effectiveness of the single-layer single-head attention mechanism and spatiotemporal feature fusion, the following model variants were used for ablation study: Former: the original multi-head attention graph transformer model (number of heads = 4); STSim-GFormer w / o ST: replacing the multi-head attention graph transformer model in the GFormer model with a single-layer single-head attention mechanism; STSim-GFormer w / o Sim: the GFormer model with only the spatiotemporal feature fusion module added; STSim-GFormer: the POI recommendation system of this invention. The evaluation results are shown in Table 3 below.
[0128] Table 3
[0129]
[0130] The evaluation index data in Table 3 show that: (1) STSim-GFormer w / o ST improves performance by 0.3%–7.4% compared to GFormer with reduced complexity; (2) STSim-GFormer w / o Sim brings a performance improvement of 10.1%–23.7%, proving the key role of the spatiotemporal feature fusion module in modeling user access behavior; (3) The combination of the single-layer single-head attention mechanism and the spatiotemporal feature fusion module in STSim-GFormer achieves optimal performance, confirming their complementarity.
[0131] Figure 3 This presentation compares the performance metrics of the GFormer model, STSim-GFormer w / o ST model, STSim-GFormer w / o Sim model, and STSim-GFormer model on the Gowalla dataset. Figure 4 This presentation compares the performance of the GFormer model, STSim-GFormer w / o ST model, STSim-GFormer w / o Sim model, and STSim-GFormer model on the Foursquare dataset using various evaluation metrics. Figure 3 and Figure 4 This indicates that the spatiotemporal feature fusion module contributes significantly more to performance improvement than the single-layer single-head attention mechanism, and the combination of the two achieves the best results.
[0132] (7) Efficiency Analysis:
[0133] (1) To verify the computational efficiency of the simplified attention mechanism, the training times of the GFormer model, STSim-GFormer w / o ST model, STSim-GFormer w / o Sim model, and STSim-GFormer model on the Gowalla and Foursquare datasets were compared. The comparison results are shown in [reference needed]. Figure 5 , Figure 5 The results show that, compared with the original GFormer, the simplified attention mechanism adopted by STSim-GFormer w / o ST can shorten the training time by about 7.7%–8.2%, verifying its computational efficiency. In STSim-GFormer w / o Sim, the spatiotemporal feature fusion module brings significant computational overhead, increasing the training time by 29.5%–31.6%. The complete architecture of STSim-GFormer offsets some of the overhead through a single-layer single-head attention mechanism, reducing the training time by 3.6%–7.3% compared with STSim-GFormer w / o Sim, thus achieving a balance between performance and computational efficiency.
[0134] (8) Conclusion
[0135] Extensive experiments on the Gowalla and Foursquare datasets demonstrate that the STSim-GFormer model of this invention significantly improves recommendation performance (recall and NDCG are improved by 8.7%-26.5%, respectively) while reducing computational complexity. Experimental results validate the dual advantages of the single-layer single-head attention mechanism and the spatiotemporal feature fusion module, greatly improving recommendation efficiency and accuracy simultaneously.
[0136] 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 POI recommendation method based on a spatiotemporal lightweight graph attention mechanism, characterized by: Specifically, it includes the following steps: (1) Obtain the user-interest interaction graph as input and generate node feature embedding vectors. Each edge of the user-interest interaction graph is associated with an original spatiotemporal data. (2) The spatiotemporal feature fusion module encodes the original spatiotemporal data through the spatiotemporal encoder, and fuses the spatiotemporal feature embedding vector obtained after encoding with the node feature embedding vector to form a fused feature embedding vector; (3) The feature extraction module extracts global and local features. The feature extraction module includes a single-head graph transformer layer, a subgraph processing module, a graph convolutional layer, a position-aware neural network layer, and a local graph processing module. The fused feature embedding vector is processed by a single-head graph transformer layer to extract global features. The subgraph processing module generates encoder and decoder subgraphs based on the attention weights generated by the single-head graph transformer layer. Simultaneously, the fused feature embedding vector is input to a graph convolutional layer, which aggregates the basic topology and injects global relative position information in conjunction with a position-aware neural network layer. Finally, the local graph processing module delineates local subgraphs and fuses sequence patterns to extract local features. (4) The embedding integration and aggregation module performs attention aggregation and reconstruction on the generated encoder subgraph and decoder subgraph to obtain high-order global features. Then, it fuses the high-order global features and the extracted local features to generate user embedding vectors and interest point embedding vectors. (5) Based on the generated user embedding vector and interest point embedding vector, calculate the user's preference score for the interest point, sort the preference scores in descending order, and output the interest points with the highest ranking as the POI recommendation results.
2. The POI recommendation method based on spatiotemporal lightweight graph attention mechanism according to claim 1, characterized in that: The user-interest interaction graph mentioned above is , That is, the set of all nodes in the user-interest interaction graph. For user nodes and points of interest The input layer transforms all nodes in the user-interest interaction graph into node feature embedding vectors, representing the union of the input graph. Node feature embedding vector This includes user node feature embedding vectors and interest point node feature embedding vectors. That is, the set of all edges in the user-interest interaction graph. For any user node and any point of interest node The set of ordered pairs formed by pairings, where the original spatiotemporal data associated with each edge is... , Represents a timestamp. Represents longitude. Represents latitude.
3. The POI recommendation method based on spatiotemporal lightweight graph attention mechanism according to claim 2, characterized in that: The spatiotemporal feature fusion module encodes the original spatiotemporal data using a spatiotemporal encoder, and then fuses the encoded spatiotemporal feature embedding vector with the node feature embedding vector to form a fused feature embedding vector. Specifically, this includes the following steps: S21. Feature preprocessing: Based on the spatiotemporal attributes of the POI recommendations, the original spatiotemporal data is normalized, as shown in the following formula (1): (1); In equation (1), Represents the normalized time characteristics. This represents the minimum value in the entire timestamp data sequence. Represents the maximum value in the entire timestamp data sequence. Represents the normalized latitudinal characteristics. Represents the normalized longitude characteristics; , and Composition of normalized spatiotemporal feature vectors ; S22, Spatiotemporal coding: A spatiotemporal encoder is used to process the normalized spatiotemporal feature vector. Encode the code as shown in formula (2) below: (2); In equation (2), the spatiotemporal encoder is a two-layer neural network structure, including two linear fully connected layers and a ReLU activation function. and This represents the weight matrix and bias vector of the first linear fully connected layer. and This represents the weight matrix and bias vector of the second linear fully connected layer. Represents the ReLU activation function; This represents the encoded spatiotemporal feature embedding vector; S23. Adaptive Fusion: Embedding Spatiotemporal Features into Vectors With node feature embedding vector The features are fused to form a fused feature embedding vector. , see the following formula (3) for details: (3); In equation (3), The spatiotemporal feature embedding vector representing all edges associated with any node. The mean; This represents the spatiotemporal weighting coefficient, which is a hyperparameter.
4. The POI recommendation method based on spatiotemporal lightweight graph attention mechanism according to claim 3, characterized in that: The feature extraction module extracts global and local features, specifically including the following steps: S31. The fused feature embedding vector is processed by a single-head graph transformer layer to extract global features. The single-head graph transformer layer adopts a single-layer single-head attention mechanism. The specific processing procedure is shown in the following formula (4): (4); In equation (4), Represents the fused feature embedding vector The row node embedding of the middle edge is the fused feature embedding vector of the starting node of each interactive edge. Represents the fused feature embedding vector The column node embedding of the middle edge is the fused feature embedding vector of the neighboring nodes pointed to by the same interaction edge. , and These are the weight projection matrices for the query, key, and value, respectively. Represents the query matrix; Represents the bond matrix; Representative value matrix; Represents transposition; Represents the dimension of the feature vector. Represents the scaling factor; Represents the original attention score; This represents the cutoff function; -10.0 and 10.0 represent the upper and lower limits of the cutoff, respectively. This represents the truncated attention score; Represents a row-based index; Represents the initial value to be accumulated; This represents the row node index corresponding to each edge; After grouping by the starting node, each group contains... The summation of rows is obtained by grouping the vectors. It is a very small constant to prevent the denominator from being zero; Represents attention weight; The output representing a single-layer, single-head attention is the extracted global feature; S32, The subgraph processing module generates attention weights based on the single-headed graph transformer layer. The encoder subgraph and decoder subgraph are generated. The process of generating the encoder subgraph is shown in equation (5), and the process of generating the decoder subgraph is shown in equation (6). (5); In equation (5), Representing the side Attention weights, edge From the set of edges in the user-interest interaction graph ; Represents a multinomial random sampling function, with As a sampling probability, the edge with the higher the attention weight, the greater the probability of being selected; The representation is obtained by random sampling according to a distribution. This represents the set of edges in the encoder subgraph obtained after sampling and filtering. This represents the total number of encoder subgraph edges in the encoder subgraph edge set; This represents the encoder sample retention rate and is a hyperparameter. Representative set The total number of sides in the middle; The generated encoder subgraph is a set of all nodes in the user-interest interaction graph. It consists of the encoder subgraph edge set obtained after sampling and filtering; (6); In equation (6), Represents the sampling probability of the original mask; The sum of the original mask sampling probabilities of all edges in the user-interest interaction graph; Represents the sampling probability of the normalized mask; This represents the set of edges in the decoder subgraph obtained after sampling and filtering. Represents a multinomial random sampling function, with The sampling probability; This represents the total number of edges in the decoder subgraph edge set; Represents the decoder sample retention rate, which is a hyperparameter; The generated decoder subgraph is a set of all nodes in the user-interest interaction graph. It consists of the decoder subgraph edge set obtained after sampling and filtering; The generated encoder and decoder subgraphs are used to calculate the contrastive loss using the standard InfoNCE framework, and backpropagation is used to optimize the parameters in the single-head graph transformer layer and the spatiotemporal feature fusion module. S33, The convolutional layer receives the fused feature embedding vector. The basic topology is aggregated through multi-hop neighbor message passing, as shown in the following formula (7): (7); In equation (7), Representative node In the convolutional layer of the graph +1 layer fusion feature embedding vector, This represents the fused feature embedding vector of neighbor node j at layer l. ; Representative node The set of neighboring nodes; Representative node The graph degree, i.e., the degree of the nodes The number of connected edges Represents neighboring nodes The graph degree, i.e., the degree of the graph with neighboring nodes. The number of connected edges; Represents the symmetric normalization coefficient; After processing by the Lth layer of the graph convolutional layer, the output is... That is, the fused feature embedding vector after aggregating the topological information of all nodes in the user-interest interaction graph; S34. The position-aware neural network layer introduces anchor-based distance position coding to enable the network to perceive the spatial relative position of nodes, as shown in the following formula (8). Then, the position coding of each node is injected into the output of the graph convolutional layer, thereby injecting global relative position information into each node. (8); In equation (8), Representative node and anchor point The shortest path length between them; Representative node and anchor point The positional similarity weights between nodes; anchor points are multiple nodes selected in the user-interest interaction graph as positional reference points; nodes With multiple anchor points respectively Position similarity weights of nodes Location encoding; S35. The local graph processing module first extracts the L-hop local subgraph for each node based on the output of the position-aware neural network layer. The L-hop local subgraph is an interaction graph composed of a node and its L-order neighbor nodes. The feature embedding vector of each node in the L-hop local subgraph is the fused feature embedding vector after aggregating the node's topological information. Local pooling is used to aggregate the node features in the L-hop local subgraph to obtain local topological aggregated features. At the same time, based on the output of the position-aware neural network layer, path encoding is performed on the user-interest point interaction sequence or random walk path to capture the sequence pattern of continuous access and extract the sequence features. Finally, the local topological aggregated features and the sequence features are fused to output the local structure-enhanced node representation, i.e., local features.
5. The POI recommendation method based on spatiotemporal lightweight graph attention mechanism according to claim 4, characterized in that: The method involves calculating the user's preference score for interest points based on the generated user embedding vector and interest point embedding vector. , see the following formula (9) for details: (9); In equation (9), Represents the user embedding vector. This represents the embedding vector of the interest point.
6. The POI recommendation method based on spatiotemporal lightweight graph attention mechanism according to claim 5, characterized in that: When the POI recommendation method is trained using a constructed composite loss function, the composite loss function... See the following formula (10) for details: (10); In equation (10), The Bayesian personalized ranking loss is calculated as shown in equation (11). The comparison loss function is shown in equation (12) below. The L2 regularization loss is represented by the following formula (13). (11); In equation (11), On behalf of users, These represent the points of interest that users have actually interacted with, and serve as positive samples. Representing user-uninteracted points of interest as negative samples. This represents the set of triplets consisting of users, positive samples, and negative samples during training. Preference scores representing positive samples of user preferences. The preference score represents the user's preference for negative samples. Represents the Sigmoid activation function; (12); In equation (12), The method represents user representation contrastive learning, which pulls in positive and negative sample embeddings of the same user and pulls out different users; The learning method involves comparative study of interest point representations, with similar interest point representations being aggregated and dissimilar ones being dispersed. This represents the cross-modal contrast loss between the user and points of interest; Represents the neighborhood contrast loss, which is the contrast loss calculated using the standard InfoNCE framework for the generated encoder subgraph and decoder subgraph; , and for , and The loss weights of the three terms are hyperparameters; (13); In equation (13), Represents the set of trainable parameters; Represents a single parameter in the set of trainable parameters; This represents the weight coefficient of the regularization term, and is a hyperparameter. This represents the square of the L2 norm.
7. A POI recommendation system for implementing the POI recommendation method of claim 1, characterized in that: It includes an input layer, a spatiotemporal feature fusion module, a feature extraction module, an embedding integration and aggregation module, and an output layer; The input layer is used to obtain the user-interest interaction graph, generate node feature embedding vectors, and associate a piece of original spatiotemporal data with each edge of the user-interest interaction graph; The spatiotemporal feature fusion module encodes spatiotemporal features and fuses the encoded spatiotemporal feature embedding vector with the node feature embedding vector to form a fused feature embedding vector. The feature extraction module is used to extract global and local features; The embedding integration and aggregation module is used to perform attention aggregation and reconstruction on the generated encoder subgraph and decoder subgraph to obtain high-order global features. Then, the high-order global features and the extracted local features are fused to generate user embedding vectors and interest point embedding vectors. The output layer is used to calculate the user's preference score for points of interest and output the POI recommendation results.