A query-conditioned historical transition and trajectory semantic guidance method for next point-of-interest recommendation
By constructing an interest point transition graph and cross-user historical transition memory, combining feature-aware attention and gated residual updates, and integrating multi-granularity representation and semantic alignment, the problem of insufficient query adaptability and trajectory semantic expression in the global interest point representation in existing technologies is solved, thereby improving the accuracy and robustness of next interest point recommendation.
Patent Information
- Application Number
- CN202611349726.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-02
- Publication Date
- 2026-11-27
AI Technical Summary
In existing technologies, global interest point representation lacks query adaptability, graph aggregation process loses instance-level historical transfer attributes, structured trajectories are difficult to express overall behavioral semantics, and existing methods are difficult to retrieve instance-level cross-user historical transfers based on the current source interest point and time conditions while preserving global movement patterns.
We employ a query-conditional historical transfer and trajectory semantic guidance method. By constructing a transfer graph of interest points, spatial regions, and interest point categories, and combining cross-user historical transfer memory, we utilize feature-aware attention and gated residual updates to integrate user long-term preferences, time slots, spatial regions, and interest point category representations. We use a pre-trained text encoder and bidirectional cross-attention for semantic alignment, and Transformer for sequence modeling to jointly predict the next interest point, time slot, and spatial region.
It enables the representation of points of interest to change dynamically with the current prediction context, retains instance-level evidence of target points of interest, reduces the influence of current user history, takes into account long-term preferences and fine-grained point of interest shifts, and improves the accuracy and robustness of the next point of interest recommendation.
Smart Images

Figure CN123178709A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a query-conditional historical transfer and trajectory semantic guidance method for recommending the next point of interest, specifically involving the recommendation of the next point of interest in location-based social networks, belonging to data mining and recommendation system technology; this invention takes the user's check-in trajectory as input and integrates query-conditional historical transfer and trajectory semantic guidance. Background Technology
[0002] With the development of mobile internet and location-based social networks, the platform continuously accumulates check-in data including users, locations, times, geographic coordinates, and location categories. Next Point of Interest (POI) recommendation aims to predict the most likely location a user will visit next based on their existing browsing history, and can be applied to personalized location recommendations, travel assistance, tourism planning, and urban mobility analysis.
[0003] Existing sequence recommendation methods typically utilize recurrent neural networks, attention networks, or Transformers to encode check-in sequences to learn local transitions and long-range temporal dependencies. Existing graph recommendation methods often compress the historical check-ins of different users into global node representations on an interest point graph to learn group movement patterns. However, the same source point of interest may correspond to different next destinations at different times and in different behavioral contexts, making it difficult to select historical transitions relevant to the current query using a fixed global point of interest representation. Graph propagation aggregates a large number of historical transitions into a single representation, which may lead to the loss of instance-level attributes such as the recentity of transitions, hourly differences, geographical distance, and regional consistency.
[0004] On the other hand, existing methods mainly use discrete structured attributes such as user ID, point of interest ID, time slot, spatial region, point of interest category, and geographic coordinates to describe trajectories. These attributes are suitable for expressing local spatiotemporal dependencies, but they are difficult to directly characterize the overall activity purpose of the current trajectory. For example, two trajectories with similar location categories and regional distributions may correspond to afternoon dining activities in a compact business district and nighttime entertainment activities across multiple districts, respectively. It is difficult to distinguish the trajectory-level behavioral semantics of the two based solely on discrete IDs.
[0005] To address the aforementioned issues, the next point-of-interest (POI) recommendation method needs to preserve global movement patterns while retrieving instance-level cross-user historical migrations based on the current source POI and time conditions. Simultaneously, it needs to align trajectory-level natural language semantics with successive check-in representations to adapt to check-in scenarios characterized by sparse data, irregular access patterns, and contextual dependence. Summary of the Invention
[0006] Purpose of the invention: To address the problems in existing technologies such as the lack of query adaptability in global interest point representation, the loss of instance-level historical transfer attributes in graph aggregation process, and the difficulty in expressing overall behavioral semantics in structured trajectories, this invention provides a query-conditional historical transfer and trajectory semantic guidance method for recommending the next interest point. It incorporates global graph representation, query-related cross-user historical transfer evidence, hierarchical multi-granular spatiotemporal information, and trajectory-level text semantics into a unified temporal prediction framework.
[0007] Technical solution: To achieve the above objectives, the technical solution adopted by this invention is as follows.
[0008] A query-conditional historical transition and trajectory semantic guidance method for next point of interest recommendation includes the following steps:
[0009] S100. Obtain all users' check-in records and represent each check-in record as a quintuple containing user, point of interest, timestamp, geographic coordinates, and point of interest category. Construct a complete check-in sequence for each user according to the timestamp order. Divide the complete check-in sequence into trajectory instances based on a preset time interval or natural day boundary. Divide the trajectory instances into training set, validation set, and test set. The trajectory instances in the training set are called training trajectories, the trajectory instances in the validation set are called validation trajectories, and the trajectory instances in the test set are called test trajectories. Map the timestamps to discrete time slots that distinguish between weekdays and weekends, and cluster the geographic coordinates of points of interest to obtain spatial region labels.
[0010] S200. Based on adjacent check-in records in the training trajectory, construct directed transfer graphs for points of interest, spatial regions, and categories of points of interest, respectively, and construct historical transfer memories. Record the source point of interest, source time slot, target point of interest, historical user, and target timestamp in the historical transfer records. Based on whether the user is the same person, divide the historical transfer memories into the current user's historical transfer memories and cross-user historical transfer memories.
[0011] S300. The observed portion of the trajectory instance is called the observation trajectory. The current point of interest is identified from the observation trajectory. The current point of interest is used as the source point of interest. Historical transfer records that match the current time conditions and whose target timestamp is earlier than the current timestamp are retrieved from the cross-user historical transfer memory. The recentity, hourly similarity, geographical proximity and regional consistency of each historical transfer record relative to the current check-in record are calculated. The records are sorted according to the comprehensive relevance, and the target points of interest are deduplicated and the number is truncated.
[0012] S400. Use the directed transition graph of interest points to obtain the global interest point transition representation. Based on the retrieved target interest points and the corresponding relation feature vectors, construct key vectors and value vectors. Aggregate historical evidence through a feature-aware attention mechanism and obtain the context-adaptive enhanced representation of the current interest point through dimension-level gated residual update.
[0013] The S500 algorithm integrates long-term user preference representations, time slot representations, spatial region map representations, interest point category map representations, and context-adaptive enhanced representations of the current interest point to obtain a structured check-in sequence. Based on the observed trajectory, trajectory text describing the dominant interest point category, typical activity periods, and spatial region dispersion is generated. A pre-trained text encoder is then used to encode the trajectory text to obtain a semantic sequence. Finally, the semantic sequence is aligned with the structured check-in sequence through bidirectional cross-attention, and semantically enhanced check-in sequence is obtained through semantic gating residual fusion.
[0014] S600: To enhance the semantics of the check-in sequence, position encoding and long-term user preference representation are added. A Transformer encoder with temporal attention mask is used for sequence modeling, and prediction tasks for the next point of interest, the next time slot, the next spatial region, and the next point of interest category are jointly trained.
[0015] S700 converts the predicted distributions of time slots, spatial regions, and interest point categories into interest point-level compatibility signals, adjusts and normalizes the basic probability distribution of the next interest point, and outputs the previous probability in descending order of the adjusted probability. Points of interest.
[0016] Specifically, steps S100 and S200 include: dividing a day into a 24-hour index, and using weekdays and weekends as day-type indexes, thereby forming 48 time slots; using The clustering algorithm clusters the geographic coordinates of all points of interest and forms a set of spatial regions; repeated transfers are retained in the directed transfer graph of points of interest to represent the frequency of user transfers, and the transfers of adjacent points of interest are mapped to the corresponding directed transfer graphs of spatial regions and directed transfer graphs of point of interest categories, and self-loops are set in the directed transfer graphs of point of interest categories; the directed transfer graphs, historical access frequency statistics, historical transfer records and point of interest level compatibility mappings are all established based solely on the training set.
[0017] Specifically, in step S300, the historical transfer memory is indexed according to the source interest point and the source time slot, and sorted according to the target timestamp; for the current check-in record, it first searches in the cross-user historical transfer memory for records with the same source interest point and a cycle hour distance not greater than the time retrieval threshold. Historical transfer records, when the number of different target points of interest contained in all retrieved historical transfer records is less than a preset upper limit. At that time, according to the cyclic hour distance, expand to the remaining source time slots of the same day type, and only retain historical transfer records whose target timestamp is strictly earlier than the current timestamp.
[0018] Specifically, the relative novelty Hourly similarity Geographical proximity and regional consistency Calculate according to the following formulas respectively:
[0019]
[0020]
[0021]
[0022]
[0023] in: For the current timestamp and the number The hourly difference between the target timestamps of each historical transfer record For the cycle hour distance, For the current point of interest and the first The geographical distance between target points of interest in each historical transfer record. and These are the current point of interest and the first... The spatial region of the target point of interest in the historical transfer record. and These are the time-normalized scale and the distance-normalized scale, respectively.
[0024] The relationship feature vector is constructed based on four features, and the comprehensive relevance is calculated according to the following formula. :
[0025]
[0026] Sort by overall relevance, remove duplicates of target interest points, and truncate the number of points.
[0027] Specifically, in step S400, the global interest point transfer representation of the current interest point is projected into a query vector; the corresponding relation feature vector is mapped into a relation representation through a relational multilayer perceptron, and then superimposed onto the first... The attention weights are calculated using the key and value vectors of the global interest point transfer representation of the target interest point in each historical transfer record; the attention weights are then calculated using the following formula. and historical evidence :
[0028]
[0029] in: For query vector, key vector Sum value vector It is composed of the global interest point transfer representation and the relation representation of the target interest point. The dimension representing the global interest point transfer. Scalar mapping function for relation feature vectors; For the current check-in record and the number The feature vector representing the relationship between historical transfer records;
[0030] Perform dimension-level gated residual updates using the following formula:
[0031]
[0032]
[0033] in: For dimension-level gated vectors, It is the Sigmoid activation function. This represents element-wise multiplication. , and For trainable parameters, Current point of interest The global interest point transfer representation obtained Current point of interest Context-adaptive augmented representation.
[0034] Specifically, in step S500, the global interest point transfer representation is weighted and summed according to the normalized historical access frequency of the user at each interest point, and then fused with the trainable user embedding to obtain the user's long-term preference representation; the spatial region directed transfer graph and the interest point category directed transfer graph are encoded using independent gated graph neural networks to obtain the spatial region graph representation and the interest point category graph representation; the time slot is decomposed into hour index and day type index and the corresponding embedding is superimposed to obtain the time slot representation; the user's long-term preference representation, the current time slot representation, the current spatial region graph representation, the current interest point category graph representation, and the current interest point context adaptive enhancement representation are concatenated and nonlinearly projected to form a structured check-in representation.
[0035] Specifically, the trajectory text is generated solely based on the observed trajectory and does not include any check-in records to be predicted; the dominant point of interest category is determined by the most frequently occurring point of interest category in the observed trajectory; the typical activity period is a preset time phrase mapped from the average local access hours of the observed trajectory; and the spatial region dispersion is determined based on the geographical coordinate distribution of points of interest in the observed trajectory. These three types of information are filled into a fixed text template, segmented, and then input into a pre-trained text encoder. Finally, linear projection and layer normalization are used to obtain a trajectory text semantic representation consistent with the dimensions of the structured check-in representation.
[0036] Specifically, the bidirectional cross-attention includes a check-in to text direction and a text to check-in direction; the check-in to text direction uses structured check-in representation as the query and trajectory text semantic representation as the key and value, enabling each structured check-in representation to extract relevant trajectory text semantic representation clues; the text to check-in direction uses trajectory text semantic representation as the query and structured check-in representation as the key and value, enabling each trajectory text semantic representation to aggregate relevant structured check-in representation information; the output of the text to check-in direction is masked and averaged to obtain a trajectory-level semantic guidance vector, and dimension-level semantic gated residual fusion is completed according to the following formula:
[0037]
[0038]
[0039] in: It is a trajectory-level semantic guidance vector. For the first Each sign-in represents a dimension-level semantically gated vector. , and For trainable parameters, The first step after enhanced cross-attention from check-in to text direction A structured sign-in representation. The first one obtained by semantically gated residual fusion A semantically enhanced sign-in representation.
[0040] Specifically, in step S600, the semantically enhanced check-in sequence is multiplied by a dimension scaling factor and a sinusoidal positional encoding is added to obtain a position-encoded check-in sequence; the projected user long-term preference representation is copied to each valid sequence position of the position-encoded check-in sequence, and the contributions of the position-encoded check-in sequence and the user long-term preference representation are controlled by learnable coefficients to obtain the check-in sequence to be encoded; the check-in sequence to be encoded is input into a Transformer encoder, a temporal attention mask is used to prevent any valid sequence position from accessing its subsequent check-in representation, and a padding mask is used to exclude invalid sequence positions; the hidden state of the last valid sequence position output by the Transformer encoder is input into the interest point prediction head, the temporal slot prediction head, the spatial region prediction head, and the interest point category prediction head, respectively, and the overall training loss is calculated according to the following formula. :
[0041]
[0042] in: , , and These represent the tasks of predicting points of interest, time slots, spatial regions, and categories of points of interest, respectively. For the task Cross-entropy loss, For the task The weight.
[0043] Specifically, in step S700, a compatibility mapping is established based on the training data, encompassing time slots to points of interest, spatial regions to points of interest, and points of interest categories to points of interest. The three auxiliary prediction distributions are mapped to compatibility vectors on candidate points of interest, and the adjustment score of the candidate points of interest is calculated using the following formula. :
[0044]
[0045] in: Candidate points of interest The base probability, , and These are compatibility features for time slots, spatial regions, and points of interest categories. , and These are preset weights for time slots, spatial regions, and point-of-interest categories, respectively. The numerical stability constant is used to output the score with the highest probability after normalization. Points of interest and their order.
[0046] Beneficial Effects: The query-conditional historical transfer and trajectory semantic guidance method for next point of interest recommendation provided by this invention has at least the following advantages compared with existing technologies: 1. By retrieving completed cross-user historical transfers based on the current source point of interest and time conditions, instance-level target point of interest evidence is preserved outside the global graph representation, allowing the point of interest representation to dynamically change with the current prediction context; 2. Initial screening and attention calculation are performed using four types of interpretable relationship features: recentity, hourly similarity, geographical proximity, and regional consistency, and strict time constraints and user exclusion rules are set to avoid using future information and reduce the impact of the current user's own historical records on the search results; 3. By considering users, time slots, spatial regions, and time slots, the method can effectively guide the search for the next point of interest. The system integrates five granularities of interest point (OP) category representations, taking into account long-term preferences, periodic rhythms, coarse-grained spatial movement, functional activity transfer, and fine-grained OOP transfer. It generates trajectory text using fixed templates and employs bidirectional cross-attention for sequential semantic alignment to characterize trajectory-level behavioral semantics corresponding to dominant activity categories, typical activity periods, and spatial distribution ranges. The pre-trained text encoder does not directly undertake the OOP prediction task. It uses a Transformer with temporal attention masks and multi-task joint supervision to simultaneously constrain the next OOP, time slot, region, and category. During the inference phase, it utilizes auxiliary distributions to adjust the probabilities of candidate OOPs, thereby improving the accuracy and robustness of the top candidate ranking. Attached Figure Description
[0047] Figure 1 This is a schematic diagram of the overall implementation process of the method of the present invention.
[0048] Figure 2 This is a schematic diagram of the overall structure of the recommendation model designed based on the method of this invention.
[0049] Figure 3 This is a structural block diagram of the present invention. Detailed Implementation
[0050] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0051] like Figure 1 , Figure 2 , Figure 3As shown, this invention discloses a query-conditional historical transfer and trajectory semantic guidance method for recommending the next point of interest. It discretizes the user's complete check-in sequence spatiotemporally, constructing a transfer map of points of interest, spatial regions, and point of interest categories, as well as cross-user historical transfer memories. It retrieves cross-user historical transfer records earlier than the current timestamp based on the current point of interest and time conditions, performing feature-aware attention aggregation and gated residual updates based on recentity, hourly similarity, geographical proximity, and regional consistency. It fuses user, time slot, spatial region, point of interest category, and enhanced point of interest representation, constructing a text description based on the observed trajectory, and achieving semantic alignment using a pre-trained text encoder and bidirectional cross-attention. It employs a Transformer for sequence encoding with temporal masking, jointly predicting the next point of interest, time slot, spatial region, and point of interest category, and outputting the previous sequence after adjusting candidate probabilities. There are several points of interest. The invention will now be described in detail below, step by step.
[0052] S000, Initial Definition
[0053] Construct a complete check-in sequence for each user according to timestamp order. Divide the complete check-in sequence into trajectory instances based on preset time intervals or natural day boundaries. Divide the trajectory instances into training set, validation set, and test set. The trajectory instances in the training set are called training trajectories, the trajectory instances in the validation set are called validation trajectories, and the trajectory instances in the test set are called test trajectories. The part of the trajectory instance that has been observed is called the observation trajectory.
[0054] Let the user set, interest point set, interest point category set, time slot set, and spatial region set be denoted as follows: , , , and , will users The Sign-in record Defined as:
[0055]
[0056] in: For users, For points of interest, For timestamps, The geographic coordinates of the point of interest (latitude coordinates are...) Longitude coordinates are ), Categories based on points of interest; users Complete check-in sequence Observation trajectory And the check-in records to be predicted They are defined as follows:
[0057]
[0058] in: This represents the total number of check-in records contained in the complete user check-in sequence. For observation trajectory The total number of check-in records included, and , These are the check-in records to be predicted.
[0059] S100, sign-in data preprocessing, time slot mapping, and spatial region generation.
[0060] The system cleans, sorts, and segments user check-in data, maps timestamps to discrete time slots that distinguish between weekdays and weekends, and generates spatial region labels using point-of-interest geographic coordinates.
[0061] S110. Delete duplicate or incomplete sign-in records that do not meet data quality requirements, sort them by user and timestamp, and divide consecutive sign-in records into trajectory instances according to preset time intervals or natural day boundaries; divide the training set, validation set and test set in chronological order to prevent future sign-in records from participating in the construction of the training structure.
[0062] S120. In terms of time, a local day is divided into a 24-hour index, and further distinguishes between weekdays and weekends; for any time slot label... Hourly Index and day type index They are respectively:
[0063]
[0064] in: Belongs to 0 to 23, It belongs to 0 or 1, thus forming 48 discrete time slots; the corresponding time slots represent for:
[0065]
[0066] in: and These are the hourly index embedding matrix and the day-type index embedding matrix, respectively. For time slots The time slot is represented.
[0067] S130. In the spatial dimension, execute the geographic coordinates of all points of interest. Clustering assigns each point of interest to a macroscopic spatial region. The number of cluster centers is used to control spatial granularity and can be determined based on validation set performance or business coverage. Spatial regions serve only as coarse-grained movement patterns and relationship characteristics and do not replace fine-grained point of interest (POI) identifiers.
[0068] S200, global directed transfer graph and cross-user historical transfer memory construction.
[0069] Based on adjacent check-in records in the training trajectory, three directed transition graphs are constructed: points of interest, spatial regions, and categories of points of interest. Cross-user historical transition memories are also constructed.
[0070] S210, For each pair of adjacent check-in records in the training trajectory and At points of interest and Directed edges are established between them, and repeated transitions are preserved, so that high-frequency movement patterns have a greater impact in graph representation learning. Let the initial interest point embedding matrix be... The directed transfer structure of interest points is Using gated graph neural networks targeting points of interest Obtain the directed transition graph of interest points :
[0071]
[0072] in: The first in The elements are denoted as Used to represent points of interest The relevant global sharing and transfer patterns, i.e., points of interest The global interest point transfer representation.
[0073] S220, and These are the global transition representation matrix for the spatial region and the global transition representation matrix for interest point categories, respectively, corresponding to the spatial region. and points of interest categories The representations of are respectively denoted as and Add self-loops to the directed transition graph of interest point categories to preserve the functional information of the nodes themselves.
[0074]
[0075] in: , These are gated graph neural networks targeting spatial regions and interest point categories, respectively. , These are embedding matrices for spatial regions and interest point categories, respectively. , These are directed transfer structures for spatial regions and interest point categories, respectively.
[0076] S230. For each pair of adjacent check-in records, record the source point of interest, source time slot, target point of interest, historical user, and target timestamp in the historical transfer memory, and build an index according to the source point of interest and source time slot, sorting the index by the target timestamp. The historical transfer memory consists only of training trajectories.
[0077] S300, Query conditional historical transfer record retrieval and relation feature calculation.
[0078] Based on the current point of interest and the current time condition, retrieve cross-user historical transfer memories, exclude future historical transfer records and the user's own historical transfer records, calculate recentity, hourly similarity, geographical proximity and regional consistency, and complete comprehensive relevance ranking, deduplication of target points of interest and number truncation.
[0079] S310, The time retrieval threshold is the distance between the cycle hours. This sets the upper limit on the number of different target points of interest that can be retained during the retrieval phase. Given the current check-in record. First, retrieve the source interest point equal to And the cycle hour distance Not greater than the threshold The candidate historical transfer records. When the number of different target interest points in the candidate historical transfer records is insufficient... Then, the search scope is expanded to other time slots of the same day type, arranged from nearest to farthest in hourly distance. Only target timestamps strictly earlier than the current timestamp are retained. Historical transfers, and excludes those by current users. The generated historical transfer records. Spatial region labels are not used as hard search criteria, but as features for subsequent relationships.
[0080] S320, Regarding the first There are 1 candidate historical transfer record, and the hour difference between its target timestamp and the current timestamp is 1. The cycle hour distance is The geographical distance between the current point of interest and the target point of interest is Define the following four normalization relation features:
[0081]
[0082]
[0083]
[0084]
[0085] in: and These are the normalized scales for time and distance, respectively. For the first The spatial region of the target point of interest for each historical transfer record. All four features are between 0 and 1; higher values indicate a stronger correlation between the corresponding historical transfer record and the current check-in record. These four features are combined to form a relational feature vector. :
[0086]
[0087] And calculate the overall relevance:
[0088]
[0089] S330, according to Sort by high to low; when multiple historical transfer records point to the same target point of interest, only the overall relevance is retained. The highest scorer; ultimately, the most will be retained. A search set is formed from different target points of interest. :
[0090]
[0091] in: For the current check-in record The obtained historical transfer retrieval set, For the historical transfer retrieval set, the first The target points of interest in the historical transfer records. For the current check-in record and the number The relationship feature vector between historical transfer records The number of different target points of interest actually retained, and .
[0092] S400, feature-aware attention, and gated residual interest point enhancement.
[0093] We learn global interest point transition representations using directed interest point transition graphs, aggregate retrieved historical evidence through a feature-aware attention mechanism, and use gated residual updates to generate context-adaptive enhanced representations for the current interest points.
[0094] S410. The global transition representation of the current point of interest is used to construct the query vector; the global transition representation of the target point of interest provides the basic key and value; the relational features are mapped to the latent space of the point of interest by a relational multilayer perceptron and then added with key and value:
[0095]
[0096]
[0097]
[0098] in: These are the trainable projection matrices used to construct the query vector, key vector, and value vector, respectively. This is the query vector for the current point of interest; For relational multilayer perceptrons; Relational feature vector The relational representation obtained by the relational multilayer perceptron mapping described above; and The first The key vector and value vector corresponding to each historical transfer record; For target points of interest The global interest point transfer representation.
[0099] S420. Calculate attention weights using representation compatibility and relational feature bias. :
[0100]
[0101] in: The dimension representing the global interest point transfer. To map relational features to scalar functions, For the first The attention weights corresponding to each historical transfer record; padded or invalid records are masked before normalization. Historical evidence is obtained according to the following formula. :
[0102]
[0103] S430. To enable the fusion of historical evidence across different sign-in locations and representation dimensions as needed, calculate the dimension-level update gate and perform residual updates:
[0104]
[0105]
[0106] in: For dimension-level gated vectors, It is the Sigmoid activation function. This represents element-wise multiplication. , and For trainable parameters, Current point of interest The global interest point transfer representation obtained Current point of interest Context-adaptive augmented representation.
[0107] S440. Use the gated residual update result as the context-adaptive augmented representation of the current point of interest. This context-adaptive augmented representation retains both the global transition information in the directed transition graph of the point of interest and the instance-level historical target evidence retrieved for the current source point of interest and time conditions.
[0108] S500, hierarchical multi-granularity sign-in representation and trajectory semantic guidance.
[0109] It integrates long-term user preferences, time slots, spatial region maps, interest point category maps, and context-adaptive enhanced representations of current interest points; it constructs trajectory text based on observed trajectories, and completes the alignment and fusion of trajectory text semantic representations with structured check-in representations through pre-trained text encoders, bidirectional cross-attention, and dimensional semantic gating.
[0110] S510, Set For users Trainable embeddings, For users Accessing points of interest in training data Normalized frequency. User interest preference aggregation representation. and user long-term preference representation They are respectively:
[0111]
[0112]
[0113] in: A trainable projection matrix representing long-term user preferences. This is the corresponding bias vector.
[0114] S520, Representing long-term user preferences Time slot representation Spatial region map representation Point of Interest Category Map Representation and context-adaptive representation By splicing and performing nonlinear projection, a structured sign-in representation is obtained. :
[0115]
[0116] in: This is a trainable projection matrix used to fuse long-term user preference representations, temporal slot representations, spatial region graph representations, interest point category graph representations, and context-adaptive augmented representations. For the corresponding bias vector, This represents a vector concatenation operation. Represents a non-linear activation function. The structured sign-in representations are arranged in chronological order. The structured check-in sequence is obtained. :
[0117]
[0118] S530. For the observed trajectory, the most frequently occurring point of interest category is selected as the dominant point of interest category. The average local access hours are calculated and mapped to a preset typical activity period. The spatial dispersion is determined based on the concentration of accessed geographic coordinates or the number of cross-regional accesses. Then, the three types of information are filled into a fixed text template to form the trajectory text. Generate trajectory text Strictly exclude check-in records that are to be predicted .
[0119] S540, Track text The words are segmented and input into a pre-trained text encoder, then projected onto a unified model dimension and normalized layer by layer to obtain a trajectory text semantic sequence. :
[0120]
[0121] in: For pre-trained text encoders to train trajectory text The encoded output text tokens represent sequences. To project text tokens onto a trainable projection matrix of uniform model dimensions, For the corresponding bias vector, The sequence is a semantic representation of the trajectory text obtained through linear projection and layer normalization.
[0122] S550, employing a bidirectional cross-attention aligned structured check-in sequence. Sequence of semantic representation of trajectory text This yields a structured check-in sequence with enhanced text direction. Enhanced trajectory-aware text semantic representation sequence from text to check-in direction :
[0123]
[0124] in: This represents a bidirectional cross-attention operation. The output sequence is the check-in text direction. This is the output sequence of text in the direction of check-in.
[0125] Bidirectional cross-attention includes a check-in to text direction and a text to check-in direction. The check-in to text direction uses structured check-in representations as queries and trajectory text semantic representations as keys and values, enabling each structured check-in representation to extract relevant trajectory text semantic representation clues. The text to check-in direction uses trajectory text semantic representations as queries and structured check-in representations as keys and values, enabling each trajectory text semantic representation to aggregate relevant structured check-in representation information. Both directions can be configured with residual connections, layer normalization, and position-wise feedforward networks. Fill positions are masked during attention computation and pooling.
[0126] S560, Representation of trajectory-aware text tags Perform mask mean pooling to obtain the trajectory-level semantic guidance vector. :
[0127]
[0128] in: This indicates that mean pooling is performed only at valid text marker positions. The trainable projection matrix of the pooling result. For the corresponding bias vector, For users The trajectory-level semantic guidance vector. For the first Dimensional semantic-gated residual fusion is calculated for each sign-in record:
[0129]
[0130]
[0131] in: For the first Each sign-in represents a dimension-level semantically gated vector. , and For trainable parameters, The first step after enhanced cross-attention from check-in to text direction A structured sign-in representation. The first one obtained by semantically gated residual fusion A semantically enhanced sign-in representation.
[0132] Arranged in chronological order The semantically enhanced check-in sequence is obtained. The pre-trained text encoder is used to encode trajectory text and does not directly output the probability of interest points. The final prediction is still completed by the subsequent sequence encoder and task prediction head.
[0133] S600, Transformer sequence encoding with temporal attention mask, and multi-task joint training.
[0134] The semantically enhanced check-in sequence is input into a Transformer encoder with a temporal attention mask to jointly predict the next point of interest, the next time slot, the next spatial region, and the next point of interest category.
[0135] S610, In semantically enhanced check-in sequences A sinusoidal position code is added to the above to obtain a position-coded check-in sequence; the projected long-term user preference representation is injected into each valid sequence position of the position-coded check-in sequence. The check-in sequence to be encoded is obtained. :
[0136]
[0137] in: This indicates the operation of adding sinusoidal position codes to the input sequence. For dimensional scaling factor, To unify the representation of dimensions; To project long-term user preference representations onto a trainable projection matrix of a unified model dimension; This refers to the operation of copying the projected long-term user preference representation to all valid sequence positions; and Learnable coefficients that control the contributions of location-encoded check-in sequences and user long-term preference representations, respectively; This is the check-in sequence to be encoded.
[0138] S620, The sign-in sequence to be encoded Input Transformer encoder:
[0139]
[0140] in: The hidden state sequence output by the Transformer encoder. For the first The hidden state vector corresponding to each valid sequence position. The number of valid check-in records in the observed trajectory; the Transformer encoder uses a temporal attention mask to make the first... Each valid sequence position only accesses the current and previous sign-in representations, and invalid sequence positions are excluded using a padding mask.
[0141] S630, Take the last valid position Input the prediction headers for interest points, time slots, spatial regions, and interest point categories respectively:
[0142]
[0143] in: Indicates the type of prediction task. , , and These represent tasks related to points of interest, time slots, spatial regions, and categories of points of interest, respectively. and Tasks The prediction head weight matrix and bias vector, For the task The unnormalized prediction score vector at the last valid sequence position The predicted probability distribution is obtained after Softmax normalization. This is the hidden state vector at the last valid sequence position. The corresponding attributes are used as supervision labels, and the overall training objective is:
[0144]
[0145] in: For the task Cross-entropy loss, The weights are assigned to the tasks. Interest point prediction is the primary task, while the other tasks provide auxiliary supervision on the temporal, spatial, and functional attributes of candidate interest points.
[0146] S700, probability adjustment, and recommended output.
[0147] The auxiliary task distribution is transformed into an interest-point level compatibility signal, the base probability of the next interest point is adjusted, and the output includes the previous one. A list of recommended points of interest.
[0148] S710. Construct compatibility mapping matrices for time slots—interest points, spatial regions—interest points, and interest point categories—interest points using training data. , and The three auxiliary prediction distributions are mapped to interest point-level compatibility vectors. , and .
[0149] S720, After introducing the numerical stability constant Adjust candidate points of interest according to the following formula Logarithmic score:
[0150]
[0151] in: Assign the basic prediction distribution of the next point of interest to candidate points of interest. The probability, , and Candidate points of interest Time slot compatibility, spatial region compatibility, and point of interest category compatibility. , and These are the adjustment weights for the three types of compatibility signals. To prevent positive stability constants from occurring in logarithmic operations, Candidate points of interest Adjusted scores. For all implement Obtain the adjusted probabilities of points of interest, and return to the previous list in descending order of probability. Points of interest. Compatibility mapping, weights, and their normalization forms can be set equivalently according to the distribution of business data.
[0152] Examples and Effect Verification
[0153] In one set of embodiments, three Foursquare check-in datasets—New York, Osaka, and Singapore—were used for validation. After preprocessing, the New York dataset contained 1080 users, 5129 points of interest (POIs), 106398 check-ins, and 33089 trajectories; the Osaka dataset contained 1171 users, 2685 POIs, 100652 check-ins, and 26458 trajectories; and the Singapore dataset contained 2328 users, 4606 POIs, 138049 check-ins, and 44397 trajectories. POIs with fewer than 10 check-ins and users with fewer than 20 check-ins were removed. The training, validation, and test sets were then divided chronologically in an 8:1:1 ratio. Check-ins by the same user on the same day constituted one trajectory, with a maximum trajectory length of 50.
[0154] In this embodiment, the latitude and longitude coordinates of the point of interest are... Clustering, the number of clusters The number of spatial regions is set to 300; the embedding dimensions of interest points, users, spatial regions, time slots, and interest point categories are set to 128, 128, 64, 64, and 32, respectively; the sequence encoder contains two Transformer layers and two attention heads; the pre-trained text encoder uses BERT-base-uncased, and its parameters are frozen during training; the optimizer uses Adam with a learning rate of 5×10⁻⁶. -4 The batch size is set to 128, the maximum training time is 100 rounds, and early stopping is performed based on the performance of the validation set.
[0155] The implementation achieved first-order accuracies of 0.3262, 0.3622, and 0.2690 on the New York, Osaka, and Singapore datasets, respectively, and mean regression rank of 0.4496, 0.4625, and 0.3612, respectively. Compared to the highest-performing baseline method on each dataset, the relative improvements in first-order accuracies were 23.67%, 8.94%, and 11.35%, respectively, and the relative improvements in mean regression rank were 13.47%, 4.27%, and 9.57%, respectively. Ablation analysis showed that removing query conditional historical transition enhancements or removing trajectory semantic guidance both reduced the recommendation metrics on multiple datasets, indicating that the two types of information have complementary effects on the ranking of top candidates.
[0156] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the present invention in any way, and all technical solutions obtained by equivalent substitution or equivalent transformation fall within the protection scope of the present invention.
Claims
1. A query-conditional historical transfer and trajectory semantic guidance method for recommending the next point of interest, characterized in that: Includes the following steps: S100. Obtain all users' check-in records and represent each check-in record as a quintuple containing user, point of interest, timestamp, geographic coordinates, and point of interest category; construct the complete check-in sequence for each user according to the timestamp order, divide the complete check-in sequence into trajectory instances according to the preset time interval or natural day boundary, divide the trajectory instances into training set and test set, the trajectory instances in the training set are called training trajectories, and the trajectory instances in the test set are called test trajectories. Timestamps are mapped to discrete time slots that distinguish between weekdays and weekends, and the geographic coordinates of points of interest are clustered to obtain spatial region labels. S200. Based on adjacent check-in records in the training trajectory, construct directed transfer graphs for points of interest, spatial regions, and categories of points of interest, respectively, and construct historical transfer memories. Record the source point of interest, source time slot, target point of interest, historical user, and target timestamp in the historical transfer records. Based on whether the user is the same person, divide the historical transfer memories into the current user's historical transfer memories and cross-user historical transfer memories. S300. The observed portion of the trajectory instance is called the observation trajectory. The current point of interest is identified from the observation trajectory. The current point of interest is used as the source point of interest. Historical transfer records that match the current time conditions and whose target timestamp is earlier than the current timestamp are retrieved from the cross-user historical transfer memory. The recentity, hourly similarity, geographical proximity and regional consistency of each historical transfer record relative to the current check-in record are calculated. The records are sorted according to the comprehensive relevance, and the target points of interest are deduplicated and the number is truncated. S400. Use the directed transition graph of interest points to obtain the global interest point transition representation. Based on the retrieved target interest points and the corresponding relation feature vectors, construct key vectors and value vectors. Aggregate historical evidence through a feature-aware attention mechanism and obtain the context-adaptive enhanced representation of the current interest point through dimension-level gated residual update. The S500 algorithm integrates long-term user preference representations, time slot representations, spatial region map representations, interest point category map representations, and context-adaptive enhanced representations of the current interest point to obtain a structured check-in sequence. Based on the observed trajectory, trajectory text describing the dominant interest point category, typical activity periods, and spatial region dispersion is generated. A pre-trained text encoder is then used to encode the trajectory text to obtain a semantic sequence. Finally, the semantic sequence is aligned with the structured check-in sequence through bidirectional cross-attention, and semantically enhanced check-in sequence is obtained through semantic gating residual fusion. S600: To enhance the semantics of the check-in sequence, position encoding and long-term user preference representation are added. A Transformer encoder with temporal attention mask is used for sequence modeling, and prediction tasks for the next point of interest, the next time slot, the next spatial region, and the next point of interest category are jointly trained. S700 converts the predicted distributions of time slots, spatial regions, and interest point categories into interest point-level compatibility signals, adjusts and normalizes the basic probability distribution of the next interest point, and outputs the previous probability in descending order of the adjusted probability. Points of interest.
2. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 1, characterized in that: Steps S100 and S200 include: dividing a day into a 24-hour index, and using weekdays and weekends as day-type indexes, thereby forming 48 time slots; using... The clustering algorithm clusters the geographic coordinates of all points of interest and forms a set of spatial regions; repeated transfers are retained in the directed transfer graph of points of interest to represent the frequency of user transfers, and the transfers of adjacent points of interest are mapped to the corresponding directed transfer graphs of spatial regions and directed transfer graphs of point of interest categories, and self-loops are set in the directed transfer graphs of point of interest categories; the directed transfer graphs, historical access frequency statistics, historical transfer records and point of interest level compatibility mappings are all established based only on the training set.
3. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 1, characterized in that: In step S300, the historical transfer memory is indexed according to the source interest point and the source time slot, and sorted according to the target timestamp; for the current check-in record, it first searches in the cross-user historical transfer memory for records with the same source interest point and whose cycle hour distance is not greater than the time retrieval threshold. Historical transfer records, when the number of different target points of interest contained in all retrieved historical transfer records is less than a preset upper limit. At that time, according to the cyclic hour distance, expand to the remaining source time slots of the same day type, and only retain historical transfer records whose target timestamp is strictly earlier than the current timestamp.
4. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 3, characterized in that: The recentity Hourly similarity Geographical proximity and regional consistency Calculate according to the following formulas respectively: , , , , in: For the current timestamp and the number The hourly difference between the target timestamps of each historical transfer record For the cycle hour distance, For the current point of interest and the first The geographical distance between target points of interest in each historical transfer record. and These are the current point of interest and the first... The spatial region of the target point of interest in the historical transfer record. and These are the time-normalized scale and the distance-normalized scale, respectively. The relationship feature vector is constructed based on four features, and the comprehensive relevance is calculated according to the following formula. : , Sort by overall relevance, remove duplicates of target interest points, and truncate the number of points.
5. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 4, characterized in that: In step S400, the global interest point transfer representation of the current interest point is projected into a query vector; the corresponding relation feature vector is mapped into a relation representation via a relational multilayer perceptron, and then superimposed onto the first... The attention weights are calculated using the key and value vectors of the global interest point transfer representation of the target interest point in each historical transfer record; the attention weights are then calculated using the following formula. and historical evidence : , in: For query vector, key vector Sum value vector It is composed of the global interest point transfer representation and the relation representation of the target interest point. The dimension representing the global interest point transfer. Scalar mapping function for relation feature vectors; For the current check-in record and the number The feature vector representing the relationship between historical transfer records; Perform dimension-level gated residual updates using the following formula: , , in: For dimension-level gated vectors, It is the Sigmoid activation function. This represents element-wise multiplication. , and For trainable parameters, Current point of interest The global interest point transfer representation obtained Current point of interest Context-adaptive augmented representation.
6. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 5, characterized in that: In step S500, the global interest point transfer representation is weighted and summed according to the normalized historical access frequency of the user at each interest point, and then fused with the trainable user embedding to obtain the user's long-term preference representation; the spatial region directed transfer graph and the interest point category directed transfer graph are encoded using independent gated graph neural networks to obtain the spatial region graph representation and the interest point category graph representation; the time slot is decomposed into hour index and day type index and superimposed with the corresponding embedding to obtain the time slot representation; the user's long-term preference representation, the current time slot representation, the current spatial region graph representation, the current interest point category graph representation, and the current interest point context adaptive enhancement representation are concatenated and nonlinearly projected to form a structured check-in representation.
7. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 6, characterized in that: The trajectory text is generated solely based on the observed trajectory and does not contain any check-in records to be predicted. The dominant interest point category is determined by the most frequent interest point category in the observed trajectory. The typical activity period is a preset time phrase mapped from the average local access hours of the observed trajectory. The spatial region dispersion is determined based on the geographical coordinate distribution of interest points in the observed trajectory. The three types of information are filled into a fixed text template, segmented, and then input into a pre-trained text encoder. Finally, linear projection and layer normalization are used to obtain a trajectory text semantic sequence with dimensions consistent with the structured check-in sequence.
8. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 7, characterized in that: The bidirectional cross-attention includes a check-in to text direction and a text to check-in direction. The check-in to text direction uses structured check-in representations as queries and trajectory text semantic representations as keys and values, enabling each structured check-in representation to extract relevant trajectory text semantic representation clues. The text to check-in direction uses trajectory text semantic representations as queries and structured check-in representations as keys and values, enabling each trajectory text semantic representation to aggregate relevant structured check-in representation information. The output of the text to check-in direction is masked and averaged to obtain a trajectory-level semantic guidance vector, and dimension-level semantic gated residual fusion is completed using the following formula: , , in: It is a trajectory-level semantic guidance vector. For the first Each sign-in represents a dimension-level semantically gated vector. , and For trainable parameters, The first text direction cross-attention enhancement after check-in A structured sign-in representation. The first one obtained by semantically gated residual fusion A semantically enhanced sign-in representation.
9. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 8, characterized in that: In step S600, the semantically enhanced check-in sequence is multiplied by a dimension scaling factor and a sinusoidal positional encoding is added to obtain a position-encoded check-in sequence. The projected user long-term preference representation is copied to each valid sequence position of the position-encoded check-in sequence, and the contributions of the position-encoded check-in sequence and the user long-term preference representation are controlled by learnable coefficients to obtain the check-in sequence to be encoded. The check-in sequence to be encoded is input into the Transformer encoder, and a temporal attention mask is used to prevent any valid sequence position from accessing its subsequent check-in representation, and a padding mask is used to exclude invalid sequence positions. The hidden state of the last valid sequence position output by the Transformer encoder is input into the interest point prediction head, the temporal slot prediction head, the spatial region prediction head, and the interest point category prediction head, respectively, and the overall training loss is calculated according to the following formula. : , in: , , and These represent the tasks of predicting points of interest, time slots, spatial regions, and categories of points of interest, respectively. For the task Cross-entropy loss, For the task The weight.
10. The query-conditional historical transfer and trajectory semantic guidance method for recommending to the next point of interest according to claim 9, characterized in that: In step S700, compatibility mappings are established based on the training data, including time slots to interest points, spatial regions to interest points, and interest point categories to interest points. The three auxiliary prediction distributions are mapped to compatibility vectors on candidate interest points, and the adjustment scores of candidate interest points are calculated using the following formula. : in: Candidate points of interest The base probability, , and These are compatibility features for time slots, spatial regions, and points of interest categories. , and These are preset weights for time slots, spatial regions, and point-of-interest categories, respectively. The numerical stability constant is used to output the score with the highest probability after normalization. Points of interest and their order.
