A personalized tourism route recommendation method and system based on a Transformer-LSTM model
By employing a personalized travel route recommendation method based on the Transformer-LSTM model, which combines tourist demand and attraction supply characteristics, a coherent, executable travel route that aligns with tourist preferences is generated. This addresses the shortcomings of existing technologies and achieves higher accuracy and personalization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING NORMAL UNIVERSITY
- Filing Date
- 2026-06-03
- Publication Date
- 2026-07-28
AI Technical Summary
Existing tourism route recommendation methods struggle to generate coherent, executable, and dynamic tourism routes that align with tourists' preferences. Furthermore, deep learning methods fall short in terms of multi-source feature fusion, accuracy of attraction selection, and consistency of route sequence.
A personalized travel route recommendation method based on the Transformer-LSTM model is adopted. By integrating the characteristics of tourist demand and scenic spot supply, the Transformer attention mechanism is used for global correlation modeling, and the travel route is generated by LSTM sequence decoding. The personalized travel route is generated by combining supply and demand joint decoding initialization and greedy inference.
It improves the accuracy, coherence, personalization, and stability of travel route recommendations, enhances the matching degree with tourist preferences, reduces duplicate attractions and invalid recommendations, and improves the executability and interpretability of the recommendation results.
Smart Images

Figure CN122472301A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent tourism services and relates to intelligent tourism route recommendation technology, specifically to a personalized tourism route recommendation method and system based on the Transformer-LSTM model. Background Technology
[0002] With the development of online travel platforms, mobile internet, and artificial intelligence technologies, travel route recommendation has gradually become an important technical problem in smart tourism services. Route recommendation typically refers to generating an ordered sequence of visits consisting of multiple points of interest, given user travel constraints and interests. In tourism scenarios, this problem is usually expressed as the Tourist Trip Design Problem (TTDP). Unlike recommending individual attractions, personalized travel route recommendation not only needs to determine the attractions tourists might be interested in but also the order in which to visit multiple attractions, comprehensively considering factors such as attraction opening hours, ticket prices, attractiveness, spatial distance, length of stay, travel budget, and tourist preferences. Therefore, it possesses comprehensive characteristics of attraction selection, sequence generation, constraint satisfaction, and supply-demand matching.
[0003] Existing TTDP (Traveling Salesman Problem) and tour route recommendation methods are typically modeled as Traveling Salesman Problems, Vehicle Routing Problems, Orienteering Problems, and their variations, and solved using heuristic algorithms, metaheuristic algorithms, probabilistic models, biomimetic algorithms, clustering methods, and constrained optimization methods. These methods can address issues such as attraction selection, visit order, and time budget to some extent, but they usually prioritize shortest distance, least time, lowest cost, or maximum benefit, failing to adequately characterize individual tourist preferences, travel motivations, and implicit needs. With the growth of personalized travel demands, related research has further developed in areas such as POI package recommendation, next POI recommendation, and deep learning route generation. It has begun to utilize check-in data, GPS trajectories, online reviews, and historical route data, combined with models such as LSTM, Transformer, graph neural networks, and reinforcement learning to characterize tourist visiting behavior and POI relationships.
[0004] However, existing technologies still have shortcomings: on the one hand, some methods mainly focus on selecting attractions or predicting the next destination, making it difficult to generate coherent, executable, and complete travel routes that align with tourists' dynamic preferences; on the other hand, existing deep learning methods often focus solely on sequence prediction or feature representation, failing to adequately utilize the synergistic coupling between the global attention modeling capability of Transformers and the sequence decoding and generation capabilities of LSTMs, making it difficult to simultaneously achieve multi-source feature fusion, accuracy in attraction selection, and coherence in route sequence. Furthermore, while existing online travel platforms or generative AI itinerary assistants can generate itinerary text, they rely more on general semantic understanding, text generation, or knowledge base retrieval, lacking a sequence generation mechanism specifically designed for travel route recommendation tasks. Therefore, the recommendation results still have room for improvement in terms of accuracy, stability, personalization, and interpretability. Summary of the Invention
[0005] Purpose of the invention: To overcome the shortcomings of existing technologies, this invention provides a personalized travel route recommendation method and system based on the Transformer-LSTM model. It integrates the Transformer attention mechanism and the LSTM sequence decoding mechanism. The Transformer is used to perform global correlation modeling of multi-source tourist demand and attraction supply characteristics, and the LSTM is used to progressively generate the attraction sequence in the travel route, thereby improving the accuracy, coherence, personalization and stability of the travel route recommendation results.
[0006] Technical Solution: To achieve the above objectives, this invention provides a personalized travel route recommendation method based on the Transformer-LSTM model, comprising the following steps:
[0007] S1: Based on structured processing, construct characteristic data of the supply side and demand side;
[0008] S2: Perform feature cleaning, mapping, and preprocessing on the characteristic data of the supply and demand sides;
[0009] S3: Construct a supply and demand grouping coding structure based on supply-side characteristic data and demand-side characteristic data;
[0010] S4: Based on the supply and demand group coding structure, use the Transformer-LSTM encoder to extract the context dependencies in the feature sequence to obtain the coded representation of each feature group;
[0011] S5: Based on the supply-side coding results and the demand-side coding results, perform joint decoding initialization for both supply and demand.
[0012] S6: Based on contextual dependencies and decoding initialization, the probability of candidate attractions is calculated step by step through the LSTM decoding module of the trained personalized travel route recommendation model;
[0013] S7: Based on the probability of candidate attractions, greedy inference is used to output recommended routes;
[0014] S8: Output the recommended explanation results based on the recommended route.
[0015] Further, in step S1, supply-side information and demand-side information of candidate attractions are obtained and structured respectively. Supply-side features include the geospatial features, cultural theme features, industrial operation features, and cognitive-emotional features of attractions. Among them, geospatial features include information such as latitude and longitude, accessibility, and spatial distance; cultural theme features include thematic attributes such as history and culture, urban life, folk experience, and natural ecology; industrial operation features include information such as scenic spot level, ticket price, and comprehensive rating; and cognitive-emotional features include information such as tourists' cognitive imagery, comments, perceptions, and emotional evaluations of attractions. Demand-side features include information such as tourists' demographic attributes, personal values, travel behavior, travel motivation, and route preferences, which are used to characterize tourists' personalized needs in terms of attraction type, tour pace, experience mode, and route preference.
[0016] Further, step S2 includes: cleaning, handling missing values, classifying and standardizing the raw data on the supply and demand sides, and uniformly mapping scenic spot names, scenic spot aliases, parent and child scenic spots and duplicate scenic spots to form a standardized POI database; further, based on feature correlation identification and the elimination of highly redundant feature dimensions, normalizing the supply-side features and demand-side features respectively, so that the features on both sides have a relatively stable numerical scale before being input into the model, reducing the suppression of the other side's features by one side's features.
[0017] Furthermore, in step S3, the supply-side features are divided into four feature groups: geospatial, cultural theme, industrial operation, and cognitive emotion. The demand-side features are encoded as a single demand group. Discrete or continuous features within each feature group are embedded to obtain corresponding feature vector sequences. For non-zero features in each feature group, a preset number of high-weight features are selected according to their weights, and the selected feature weights are normalized before being injected into the corresponding embedding vector. Supply-side and demand-side features are processed using independent encoding parameters to prevent tourist demand-side information from being overwhelmed by attraction supply-side information during the encoding process.
[0018] Further, step S4 includes: adding positional encoding to the vector sequence of each feature group, inputting it into the Transformer module, calculating the global correlation between features within the group through a self-attention mechanism; then inputting the output of the Transformer module into the LSTM module to further extract the contextual dependencies in the feature sequence, and obtaining the encoded representation of each feature group.
[0019] Further, step S5 includes: aggregating the supply-side encoding results and the demand-side encoding results to obtain the supply-side context representation and the demand-side context representation, and then mapping the two together to the initial hidden state and the initial cell state of the LSTM decoder; at the same time, injecting the embedding vectors of the given starting point and ending point attractions into the initial state of the decoder, so that the decoder can obtain tourist demand information, attraction supply information and starting and ending point constraint information simultaneously before generating the tourist route, avoiding the decoding process relying only on single-sided features or starting from an empty state.
[0020] Furthermore, the personalized travel route recommendation model in step S6 includes a feature embedding layer, a Transformer module, an LSTM encoding module, an LSTM decoding module, a decoding initialization mapping layer, and an output layer. The training method includes:
[0021] Using historical real tourist routes as monitoring signals, and taking the next attraction at each step of the real route as the prediction target, the cross-entropy loss between the model's prediction results and the real attractions is calculated:
[0022]
[0023] in Indicates the first in the real line One scenic spot, This represents the sequence of historical sites preceding the t-th site, where u represents the tourist.
[0024] The parameters of the feature embedding layer, Transformer module, LSTM encoding module, LSTM decoding module, decoding initialization mapping layer, and output layer are updated by backpropagation based on the loss function until the preset number of training rounds or convergence conditions are reached, thus obtaining the trained personalized travel route recommendation model.
[0025] Furthermore, the method by which the LSTM decoding module progressively calculates the probability of candidate locations in step S6 includes:
[0026] In the recommendation phase, the target tourist demand characteristics, candidate attraction supply characteristics, starting point attraction, and ending point attraction are input. With the given starting point attraction as the initial input, the LSTM decoding module gradually predicts the attractions to be visited in the next moment based on the attractions generated in the previous moment, the current hidden state, and the encoder context information.
[0027] The decoding process at step t is represented as:
[0028]
[0029] in, This represents the embedding vector of the attraction at the previous time step. This represents the context vector obtained from the encoder context by the attention mechanism. This represents the hidden state at the current moment; then, the selection probability of all candidate attractions is calculated through the output layer:
[0030]
[0031] in, Let W represent the probability of selecting the t-th attraction given that the preceding attractions and tourist demand have been generated. W and b are trainable parameters.
[0032] Further, step S7 includes:
[0033] In each step of the generation process, visited attractions, invalid attractions, and attractions that do not meet the origin and destination constraints are masked to obtain the set of available attractions for the current step. To avoid duplicate visits and invalid recommendations, the model uses a greedy decoding approach, selecting the attraction with the highest predicted probability from the current set of available attractions as the next attraction to visit.
[0034]
[0035] in, This represents the set of candidate scenic spots after constraint masking in step t. This represents the sequence of recommended attractions generated up to step t. Indicates the first Recommended attractions selected by the foot;
[0036] Repeat the above process until the final destination is generated or the preset maximum route length is reached, ultimately outputting a personalized, orderly travel route composed of multiple Points of Interest (POIs):
[0037]
[0038] in, This represents a personalized travel itinerary generated for tourist u. This represents the t-th recommended attraction on the route.
[0039] This invention also provides a personalized travel route recommendation system based on the Transformer-LSTM model, comprising:
[0040] The feature data construction module, based on structured processing, constructs feature data for both the supply and demand sides;
[0041] The preprocessing module performs feature cleaning, mapping, and preprocessing on the feature data from both the supply and demand sides.
[0042] The supply and demand grouping coding structure construction module constructs a supply and demand grouping coding structure based on supply-side characteristic data and demand-side characteristic data.
[0043] The encoding representation module extracts the contextual dependencies in the feature sequence using a Transformer-LSTM encoder based on the supply-demand grouping encoding structure, and obtains the encoded representation of each feature group.
[0044] The decoding initialization module performs joint decoding initialization for both supply and demand sides based on the supply-side and demand-side coding results.
[0045] The model training module trains the personalized travel route recommendation model.
[0046] The candidate attraction probability calculation module calculates the probability of candidate attractions step by step through the LSTM decoding module.
[0047] The recommended route output module uses greedy inference to output recommended routes based on the probability of candidate attractions.
[0048] The explanation result output module outputs recommended explanation results based on the recommended route.
[0049] This invention generates personalized travel routes by grouping and encoding tourist demand-side features and attraction supply-side features, and then utilizing the Transformer attention mechanism and LSTM sequence decoding mechanism. The core of this method is supply-demand group feature modeling, Transformer-LSTM encoding, supply-demand joint decoding initialization, and greedy inference, without introducing graph neural network modules or bundle search modules.
[0050] Beneficial effects: Compared with the prior art, the present invention has the following advantages:
[0051] First, this invention simultaneously incorporates tourist demand-side characteristics and attraction supply-side characteristics, and groups and encodes them. This allows the model to comprehensively utilize multi-source information, including tourist demographic attributes, personal values, travel behavior, travel motivations, route preferences, and attraction geospatial, cultural themes, industry operations, and cognitive-emotional factors. Therefore, compared to methods that rely solely on attraction popularity, distance, historical visit frequency, or single user interests for recommendations, this invention can more accurately characterize tourists' personalized needs and improve the matching degree between recommended routes and tourist preferences.
[0052] Second, this invention models the global correlation between multi-source features using a Transformer attention mechanism and generates a sequence of attractions in the tourist route step by step according to the order of visits using an LSTM decoder. Simultaneously, the supply-side context representation and the demand-side context representation are jointly mapped to the initial state of the LSTM decoder, allowing the decoder to simultaneously obtain attraction supply information and tourist demand information at the start of route generation. Therefore, the model can capture the overall correlation between tourist demand and attraction attributes, and also learn the attraction combination relationships and visit order patterns in historical real-world routes, reducing the problem of over-reliance on one-sided features and improving the accuracy, sequential coherence, and responsiveness to the differentiated needs of different tourists in personalized tourist route recommendations.
[0053] Third, this invention uses real historical tourist routes as supervisory signals for model training, enabling the model to learn the patterns of attraction selection, attraction combination relationships, and visit order from real tourist routes. Experimental results show that, under the same data partitioning and evaluation criteria, the method of this invention achieves superior recommendation accuracy in personalized tourist route recommendation tasks. Specifically, the Interior-F1 score reaches 0.5010, approximately 1.28 times that of the heuristic baseline Greedy-Similarity, 1.42 times that of the metaheuristic baseline ACO, 2.44 times that of the most basic LSTM_Pos_Trans, and 2.35 times that of the large language model baseline DeepSeek. This demonstrates that this invention has significant advantages in terms of attraction selection accuracy and personalized route generation quality.
[0054] Fourth, this invention masks visited attractions, invalid attractions, and attractions that do not meet the origin-destination constraints during the tour route generation process, preventing attractions that do not meet the constraints from participating in the current step of selection. This reduces the number of duplicate attractions, invalid attractions, and recommendations that do not meet the route constraints, improving the feasibility and stability of the generated tour routes in practical applications.
[0055] Fifth, this invention can assess the impact of supply-side and demand-side features on the recommendation results through feature perturbation or contribution analysis methods, and output the importance results of different feature groups. Therefore, it can provide traceable explanatory evidence for personalized travel route recommendations, improving the interpretability and credibility of the recommendations.
[0056] In summary, this invention improves the preference matching accuracy, attraction selection accuracy, route sequence coherence, and practical feasibility of personalized travel route recommendations by employing multi-source supply and demand feature encoding, Transformer global association modeling, LSTM sequential decoding, joint supply and demand initialization, and route constraint processing. Experimental results further demonstrate that the method of this invention achieves higher recommendation accuracy and better personalized route generation performance compared to existing baseline methods. Attached Figure Description
[0057] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0058] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. After reading this invention, any modifications of the invention in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.
[0059] Example 1:
[0060] like Figure 1 As shown, this embodiment provides a personalized travel route recommendation method based on the Transformer-LSTM model, including the following steps:
[0061] S1: Based on structured processing, construct characteristic data of the supply side and demand side;
[0062] The system acquires supply-side information and demand-side information of candidate attractions and processes them in a structured manner. Supply-side features include the geospatial features, cultural theme features, industrial operation features, and cognitive-emotional features of the attractions. Among them, geospatial features include information such as latitude and longitude, accessibility, and spatial distance; cultural theme features include thematic attributes such as history and culture, urban life, folk experience, and natural ecology; industrial operation features include information such as scenic area level, ticket price, and comprehensive rating; and cognitive-emotional features include information such as tourists' cognitive imagery, comments, perceptions, and emotional evaluations of the attractions. Demand-side features include information such as tourists' demographic attributes, personal values, travel behavior, travel motivations, and route preferences, which are used to characterize tourists' personalized needs in terms of attraction type, tour pace, experience mode, and route preference.
[0063] S2: Perform feature cleaning, mapping, and preprocessing on the characteristic data of the supply and demand sides;
[0064] The raw data from both the supply and demand sides are cleaned, missing values are handled, categories are coded, and numerical standardization is performed. Scenic spot names, aliases, parent and child scenic spots, and duplicate scenic spots are uniformly mapped to form a standardized POI database. Furthermore, based on feature correlation identification and the elimination of highly redundant feature dimensions, the features on the supply side and the features on the demand side are normalized respectively, so that the features on both sides have a relatively stable numerical scale before being input into the model, reducing the suppression of the other side by the features on one side.
[0065] S3: Construct a supply and demand grouping coding structure based on supply-side characteristic data and demand-side characteristic data;
[0066] Supply-side features are divided into four feature groups: geospatial, cultural theme, industrial operation, and cognitive-emotional. Demand-side features are encoded as a single demand group. Discrete or continuous features within each feature group are embedded to obtain corresponding feature vector sequences. For non-zero features in each feature group, a preset number of high-weight features are selected according to their weights, and these weights are normalized before being injected into the corresponding embedding vectors. Supply-side and demand-side features are processed using independent encoding parameters to prevent tourist demand-side information from being overwhelmed by attraction supply-side information during the encoding process.
[0067] S4: Based on the supply and demand group coding structure, use the Transformer-LSTM encoder to extract the context dependencies in the feature sequence to obtain the coded representation of each feature group;
[0068] After adding positional encoding to the vector sequence of each feature group, it is input into the Transformer module, which calculates the global correlation between features within the group through a self-attention mechanism. Then, the output of the Transformer module is input into the LSTM module to further extract the contextual dependencies in the feature sequence, thus obtaining the encoded representation of each feature group.
[0069] In this embodiment, the global correlation between features within a group is calculated using a self-attention mechanism, as expressed below:
[0070]
[0071] in, Let represent the query matrix, key matrix, and value matrix, respectively, and d represent the vector dimension. Through this step, the model can comprehensively learn tourist demand characteristics, attraction supply characteristics, and their contextual relationships during the encoding stage.
[0072] S5: Based on the supply-side coding results and the demand-side coding results, perform joint decoding initialization for both supply and demand.
[0073] The supply-side encoding results and demand-side encoding results are aggregated to obtain the supply-side context representation and the demand-side context representation, respectively. Then, the two are jointly mapped to the initial hidden state and the initial cell state of the LSTM decoder. At the same time, the embedding vectors of the given starting point and ending point attractions are jointly injected into the initial state of the decoder, so that the decoder can obtain tourist demand information, attraction supply information and starting and ending point constraint information simultaneously before generating the tourist route, avoiding the decoding process relying only on one-sided features or starting from an empty state.
[0074] S6: Based on contextual dependencies and decoding initialization, the probability of candidate attractions is calculated step by step through the LSTM decoding module of the trained personalized travel route recommendation model;
[0075] The personalized travel route recommendation model includes a feature embedding layer, a Transformer module, an LSTM encoding module, an LSTM decoding module, a decoding initialization mapping layer, and an output layer. Training methods include:
[0076] Using historical real tourist routes as monitoring signals, and taking the next attraction at each step of the real route as the prediction target, the cross-entropy loss between the model's prediction results and the real attractions is calculated:
[0077]
[0078] in Indicates the first in the real line One scenic spot, Let u represent the sequence of historical sites preceding the t-th site, and u represent the tourist.
[0079] The parameters of the feature embedding layer, Transformer module, LSTM encoding module, LSTM decoding module, decoding initialization mapping layer, and output layer are updated by backpropagation based on the loss function until the preset number of training rounds or convergence conditions are reached, thus obtaining the trained personalized travel route recommendation model.
[0080] The methods used by the LSTM decoding module to progressively calculate the probability of candidate locations include:
[0081] In the recommendation phase, the target tourist demand characteristics, candidate attraction supply characteristics, starting point attraction, and ending point attraction are input. With the given starting point attraction as the initial input, the LSTM decoding module gradually predicts the attractions to be visited in the next moment based on the attractions generated in the previous moment, the current hidden state, and the encoder context information.
[0082] The decoding process at step t is represented as:
[0083]
[0084] in, This represents the embedding vector of the attraction at the previous time step. This represents the context vector obtained from the encoder context by the attention mechanism. This represents the hidden state at the current moment; then, the selection probability of all candidate attractions is calculated through the output layer:
[0085]
[0086] in, Let W represent the probability of selecting the t-th attraction given that the preceding attractions and tourist demand have been generated. W and b are trainable parameters.
[0087] S7: Based on the probability of candidate attractions, greedy inference is used to output recommended routes;
[0088] In each step of the generation process, visited attractions, invalid attractions, and attractions that do not meet the origin and destination constraints are masked to obtain the set of available attractions for the current step. To avoid duplicate visits and invalid recommendations, the model uses a greedy decoding approach, selecting the attraction with the highest predicted probability from the current set of available attractions as the next attraction to visit.
[0089]
[0090] in, This represents the set of candidate scenic spots after constraint masking in step t. This represents the sequence of recommended attractions generated up to step t. Indicates the first Recommended attractions selected by the foot;
[0091] Repeat the above process until the final destination is generated or the preset maximum route length is reached, ultimately outputting a personalized, orderly travel route composed of multiple Points of Interest (POIs):
[0092]
[0093] in, This represents a personalized travel itinerary generated for tourist u. This represents the t-th recommended attraction on the route.
[0094] S8: Output the recommended explanation results based on the recommended route;
[0095] After the model is trained or applied, feature perturbation or contribution analysis methods can be used to assess the importance of supply-side and demand-side features respectively, obtain the degree of contribution of different feature groups to the recommendation results, and output the proportion of the influence of tourist demand and attraction supply on the recommendation decision, thereby providing an interpretable basis for personalized tourism route recommendation results.
[0096] Through the above technical solution, this invention combines the global feature association capability of Transformer with the sequence generation capability of LSTM, and through supply and demand joint decoding initialization and greedy inference mechanism, enables the model to simultaneously utilize tourists' personalized needs, attraction supply attributes, origin and destination constraints and historical route sequence patterns to generate orderly tourism routes that meet tourists' personalized needs, thereby improving the accuracy, coherence, stability, executability and interpretability of the recommendation results.
[0097] Example 2:
[0098] This embodiment provides a personalized travel route recommendation system based on the Transformer-LSTM model, including:
[0099] The feature data construction module, based on structured processing, constructs feature data for both the supply and demand sides;
[0100] The preprocessing module performs feature cleaning, mapping, and preprocessing on the feature data from both the supply and demand sides.
[0101] The supply and demand grouping coding structure construction module constructs a supply and demand grouping coding structure based on supply-side characteristic data and demand-side characteristic data.
[0102] The encoding representation module extracts the contextual dependencies in the feature sequence using a Transformer-LSTM encoder based on the supply-demand grouping encoding structure, and obtains the encoded representation of each feature group.
[0103] The decoding initialization module performs joint decoding initialization for both supply and demand sides based on the supply-side and demand-side coding results.
[0104] The model training module trains the personalized travel route recommendation model.
[0105] The candidate attraction probability calculation module calculates the probability of candidate attractions step by step through the LSTM decoding module.
[0106] The recommended route output module uses greedy inference to output recommended routes based on the probability of candidate attractions.
[0107] The explanation result output module outputs recommended explanation results based on the recommended route.
[0108] Example 3:
[0109] To verify the effectiveness and effects of the present invention, the following experiments were conducted in this embodiment:
[0110] (1) Data preparation
[0111] Resource attribute data were collected from 727 scenic spots in Jiangsu Province, including 26 dimensions of supply-side characteristics across four categories: spatial location, cultural theme, industrial operation, and cognitive imagery. 1873 tourist preference questionnaires were collected, including 32 dimensions of demand-side characteristics across five categories: demographic attributes, values, travel behavior, travel motivation, and route preference. Based on actual tourist visit records, 930 effective tourist routes were constructed as training and evaluation data.
[0112] (2) Feature preprocessing
[0113] The original 58-dimensional features were tokenized to generate a 264-dimensional interest vector. Highly redundant emotional perception dimensions (with a Pearson correlation coefficient r>=0.9 with the cognitive image dimension) in the supply side were removed, resulting in the deletion of 49 redundant tokens. L1 normalization was applied to both the supply and demand sides, with each assigned a total weight of 0.5.
[0114] (3) Model configuration
[0115] The supply-side encoder is divided into four channels (spatial location, cultural theme, industrial operation, and cognitive imagery). Each channel uses an independent Transformer-LSTM encoding unit, with the Transformer layer configured as a 2-head attention layer and a 1-layer encoder layer, and the LSTM layer configured as a 128-dimensional hidden state. The demand side uses the same architecture as the supply side but with independent parameters: a Transformer-LSTM encoder. The decoder uses a 128-dimensional LSTM unit, injecting information from both sides through equal initialization of supply and demand.
[0116] (4) Training configuration
[0117] The AdamW optimizer was used with a learning rate of 0.005, weight decay of 0.01, gradient accumulation steps of 8, and gradient clipping threshold of 1.0. Training was performed for 40 epochs, with evaluation on the validation set every 2 epochs. The model parameters that best performed on the validation set were saved.
[0118] (5) Reasoning methods
[0119] A greedy decoding strategy is adopted, in which the scenic spot with the highest probability is selected as the output at each step, until the destination scenic spot is generated or the maximum route length is reached.
[0120] (6) Experimental results
[0121] The average performance under five different random seeds was: Int-F1 = 0.5010, F1 = 0.8133, Precision = 0.8653, Recall = 0.8170, Sequence Similarity = 0.6700, and Edit Distance = 0.3300. Feature contribution analysis showed that the supply side contributed approximately 74.5%, and the demand side contributed approximately 25.5%, verifying that the supply-demand dual-tower structure successfully activated the utilization of demand-side information.
Claims
1. A personalized travel route recommendation method based on the Transformer-LSTM model, characterized in that, Includes the following steps: S1: Based on structured processing, construct characteristic data of the supply side and demand side; S2: Perform feature cleaning, mapping, and preprocessing on the characteristic data of the supply and demand sides; S3: Construct a supply and demand grouping coding structure based on supply-side characteristic data and demand-side characteristic data; S4: Based on the supply and demand group coding structure, use the Transformer-LSTM encoder to extract the context dependencies in the feature sequence to obtain the coded representation of each feature group; S5: Based on the supply-side coding results and the demand-side coding results, perform joint decoding initialization for both supply and demand. S6: Based on contextual dependencies and decoding initialization, the probability of candidate attractions is calculated step by step through the LSTM decoding module of the trained personalized travel route recommendation model; S7: Based on the probability of candidate attractions, greedy inference is used to output recommended routes; S8: Output the recommended explanation results based on the recommended route.
2. The personalized travel route recommendation method based on the Transformer-LSTM model according to claim 1, characterized in that, In step S1, supply-side information of candidate attractions and demand-side information of tourists are obtained and then structured. Supply-side features include the geospatial features, cultural theme features, industrial operation features, and cognitive and emotional features of attractions. Demand-side characteristics are used to characterize tourists’ personalized needs in terms of attraction type, tour pace, experience mode, and route preference.
3. The personalized travel route recommendation method based on the Transformer-LSTM model according to claim 1, characterized in that, Step S2 includes: cleaning the raw data from the supply side and the demand side, handling missing values, classifying and standardizing the data, and mapping the names of attractions, aliases of attractions, parent and child attractions and duplicate attractions in a unified manner to form a standardized POI database.
4. The personalized travel route recommendation method based on the Transformer-LSTM model according to claim 1, characterized in that, In step S3, the supply-side features are divided into four feature groups: geospatial, cultural theme, industrial operation, and cognitive emotion. The demand-side features are encoded as a whole demand group. The discrete or continuous features in each feature group are embedded to obtain the corresponding feature vector sequence. For non-zero features in each feature group, a preset number of high-weight features can be selected according to the feature weights, and the selected feature weights are normalized and then injected into the corresponding embedding vector.
5. The personalized travel route recommendation method based on the Transformer-LSTM model according to claim 4, characterized in that, Step S4 includes: adding positional encoding to the vector sequence of each feature group, inputting it into the Transformer module, calculating the global correlation between features within the group through a self-attention mechanism; then inputting the output of the Transformer module into the LSTM module to further extract the contextual dependencies in the feature sequence and obtain the encoded representation of each feature group.
6. The personalized travel route recommendation method based on the Transformer-LSTM model according to claim 5, characterized in that, Step S5 includes: aggregating the supply-side encoding results and the demand-side encoding results to obtain the supply-side context representation and the demand-side context representation, and then mapping the two together to the initial hidden state and the initial cell state of the LSTM decoder; at the same time, injecting the embedding vectors of the given starting point and ending point attractions into the initial state of the decoder, so that the decoder can obtain tourist demand information, attraction supply information and starting and ending point constraint information simultaneously before generating the tourist route.
7. The personalized travel route recommendation method based on the Transformer-LSTM model according to claim 6, characterized in that, The personalized travel route recommendation model in step S6 includes a feature embedding layer, a Transformer module, an LSTM encoding module, an LSTM decoding module, a decoding initialization mapping layer, and an output layer. The training method includes: Using historical real tourist routes as monitoring signals, and taking the next attraction at each step of the real route as the prediction target, the cross-entropy loss between the model's prediction results and the real attractions is calculated: ; in Indicates the first in the real line One scenic spot, This represents the sequence of historical sites preceding the t-th site, where u represents the tourist. The parameters of the feature embedding layer, Transformer module, LSTM encoding module, LSTM decoding module, decoding initialization mapping layer, and output layer are updated by backpropagation based on the loss function until the preset number of training rounds or convergence conditions are reached, thus obtaining the trained personalized travel route recommendation model.
8. A personalized travel route recommendation method based on a Transformer-LSTM model according to claim 7, characterized in that, The method for the LSTM decoding module to progressively calculate the probability of candidate sites in step S6 includes: In the recommendation phase, the target tourist demand characteristics, candidate attraction supply characteristics, starting point attraction, and ending point attraction are input. With the given starting point attraction as the initial input, the LSTM decoding module gradually predicts the attractions to be visited in the next moment based on the attractions generated in the previous moment, the current hidden state, and the encoder context information. The decoding process at step t is represented as: ; in, This represents the embedding vector of the attraction at the previous time step. This represents the context vector obtained from the encoder context by the attention mechanism. This represents the hidden state at the current moment; then, the selection probability of all candidate attractions is calculated through the output layer: ; in, Let W represent the probability of selecting the t-th attraction given that the preceding attractions and tourist demand have been generated. W and b are trainable parameters.
9. A personalized travel route recommendation method based on the Transformer-LSTM model according to claim 8, characterized in that, Step S7 includes: In each step of the generation process, visited attractions, invalid attractions, and attractions that do not meet the origin and destination constraints are masked to obtain the set of available attractions for the current step. To avoid duplicate visits and invalid recommendations, the model uses a greedy decoding approach, selecting the attraction with the highest predicted probability from the current set of available attractions as the next attraction to visit. ; in, This represents the set of candidate scenic spots after constraint masking in step t. This represents the sequence of recommended attractions generated up to step t. Indicates the first Recommended attractions selected by the steps; Repeat the above process until the final destination is generated or the preset maximum route length is reached, ultimately outputting a personalized, ordered travel itinerary composed of multiple Points of Interest (POIs). ; in, This represents a personalized travel itinerary generated for tourist u. This represents the t-th recommended attraction on the route.
10. A personalized travel route recommendation system based on the Transformer-LSTM model, characterized in that, For implementing the method of claim 1, the system comprises: The feature data construction module, based on structured processing, constructs feature data for both the supply and demand sides; The preprocessing module performs feature cleaning, mapping, and preprocessing on the feature data from both the supply and demand sides. The supply and demand grouping coding structure construction module constructs a supply and demand grouping coding structure based on supply-side characteristic data and demand-side characteristic data. The encoding representation module extracts the contextual dependencies in the feature sequence using a Transformer-LSTM encoder based on the supply-demand grouping encoding structure, and obtains the encoded representation of each feature group. The decoding initialization module performs joint decoding initialization for both supply and demand sides based on the supply-side and demand-side coding results. The model training module trains the personalized travel route recommendation model. The candidate attraction probability calculation module calculates the probability of candidate attractions step by step through the LSTM decoding module. The recommended route output module uses greedy inference to output recommended routes based on the probability of candidate attractions. The explanation result output module outputs recommended explanation results based on the recommended route.