# Research on Tourism Route Recommendation Strategy Based on Convolutional Neural Network and Collaborative Filtering Algorithm

Authors: Shan He
Journal: Security and Communication Networks
 (2022)

---

## Abstract

With improving people’s living standards, tourism has become essential leisure and entertainment. At present, it has begun to shift from a quantity-oriented tourism method to a quality-oriented tourism method. It is difficult for passengers to choose the route that suits them from the numerous routes. Given the above problems, this study proposes a travel route recommendation algorithm that combines a convolutional neural network and collaborative filtering. The algorithm uses a convolutional neural network to extract the latent features in the customer and travel itinerary data and then uses the matrix factorization method based on collaborative filtering to perform score prediction. The experimental results show that the algorithm can meet the travel requirements of different customers. At the same time, the recommendation accuracy of the tourist route is improved, and technology and method are provided for realizing the personalized recommendation service of the tourist route.


---

## Body

## 1. Introduction

At present, the introduction of various tourism products has made the amount of tourism information extremely large, and it is difficult for users to quickly locate the products they are interested in from a large amount of tourism information [1]. In order to compete for tourists and increase revenue, travel companies need to continuously meet the needs of tourists and formulate travel routes that meet the interests of tourists [2]. Tourism recommendation system is an essential means to solve the problem of tourism information overload. It can actively push tourism routes that meet tourists’ interests and help them make decisions quickly [3].Tourist route recommendation algorithms mainly include four categories: content-based recommendation, collaborative filtering-based recommendation [4], knowledge-based recommendation, and social media-based recommendation [5]. Content-based travel route recommendation recommends similar routes to tourists based on the travel products they choose [6]. Recommend optional tours for tourists for a limited time. Tourist route recommendation based on collaborative filtering recommends the routes selected by tourists with similar interests according to the tourists’ route preferences [7]. Knowledge-based travel route recommendation introduces tourism domain knowledge into the route recommendation system to improve the accuracy of route recommendation [8]. Travel route recommendation based on social media introduces the tourist relationship in social media into the route recommendation process [9].The current route recommendation is generally based on the location of tourists, using geographic information systems and mobile devices to recommend surrounding routes or places [10]. But since tourist travel is often limited by climatic time, and users’ interests also change, time is crucial for route selection [11]. Literature [12] recommends routes based on spending the least amount but reaching more destinations within a certain period. Literature [13] designed a personalized similarity model and used the user’s heterogeneous travel information to make recommendations at a specific location at a particular moment. Literature [14] uses a time-dependent network to solve the problem of random changes in the number of tours and attractions and selects the next attraction through conditional probability. Literature [15] proposed a time-sensitive travel route recommendation method based on dynamic transition graphs. Literature [16] designed a two-step greedy heuristic algorithm to predict the next destination. It considers space-time conflicts and solves the problem of sparse data. Literature [17] proposed a multiconstraint K-greedy algorithm based on the opening hours of scenic spots, ticket GIS coordinates, scenic spot evaluation information, etc., which can recommend better tourist routes for tourists. However, in the actual route selection process, whether a user will select a route is often affected by the theme of the route and the user’s interest [18].With the rapid development of smart mobile devices and the Internet, the problem of tourist information overload has emerged. Let tourists spend a lot of time and energy screening travel information, significantly reducing customer travel medical examination. The emergence of a travel recommendation system can assist tourists to quickly and accurately select resources that match their needs from the overloaded information. This study proposes a travel route recommendation algorithm integrating convolutional neural networks and collaborative filtering. The algorithm first converts the user comment data into words and extracts the hidden features in the user and travel route data through a convolutional neural network. Then, the collaborative filtering recommendation based on users and travel routes is completed. The algorithm can recommend scientific and reasonable travel routes for users to meet their travel needs in different situations.


## 2. The Algorithm Proposed in This Study

### 2.1. Problem Description

The collaborative filtering algorithm mines the hidden features of tourists or tourist routes according to the data of tourists’ interest and preference for tourism. Then its correlations are calculated and score predictions are made. Finally, a recommendation is generated. In general, data is often very sparse. The current collaborative filtering is difficult to extract the deeply hidden features in the data.For example, suppose there arew tourists and t travel routes. The sample data is in the form of a 4-tuple (userx, itemy ,cxy,rxy), where rxy represents the rating of tourists x on the tourist route y, which is an integer value from 1 to 5. cxy represents the comment of tourist x on the tourist route y, which is a piece of text with different lengths. R is an w∗t rating matrix and C is an w∗t review matrix, where rxy∈Rw×t,cxy∈Cw×t, as shown in Table 1.Table 1
Rating and comment data.
UserItemItem1Item2…ItemwUser1r00, c00???User2?r22, c22??…??rxy, cxy?Userw????In Table1, each row represents the ratings and reviews published by a tourist. Each column represents the ratings and reviews received by a tourist route. ? means no rating comment information. The matrices R and C can be obtained from Table 1.Therefore, the problem to be solved in this study is to integrate the convolutional neural network into the collaborative filtering algorithm based on the rating matrixRw×t and the comment matrix Cw×t, Mining hidden features of tourists and tourist routes and predicting tourists’ ratings for unrated routes.


### 2.2. Collaborative Filtering Model Design

The collaborative filtering algorithm model that integrates the convolutional neural network preprocesses the data, including removing invalid data and retaining comment and rating data. Then, each travel itinerary merges all its review data separately for each tourist and average the rating data. Then, the combined review data is converted into a vector-based on the text vectorization technology. The vectorized tourist and tourism data are sent to the convolutional neural network for training. Based on the convolutional neural network, the latent features of all comments of the tourist userx are extracted as the latent feature representation px of the tourist. Similarly, extract a particular travel route item, the implicit features of all reviews, as the feature representation qy of the item. Then, based on the matrix decomposition method in collaborative filtering, the inner product of the transpose of px and qy is performed to obtain the predicted score rxy'=pxqxT. Finally, the Adam optimization method is used to train the model to minimize the error between the predicted score rxy' and the real score rxy.The model structure is shown in Figure1, including the input layer, convolution layer, pooling layer, fully connected layer, and output layer. The input layer receives the vectorized review text as the input feature x, and the average score as the input feature y. The convolution layer performs convolution calculation on the input features by sliding the convolution kernel and obtaining the feature map. The pooling layer uses the maximum pooling method to reduce the dimension of the feature map calculated by the convolution layer and retains the more essential features in the network. The fully connected layer maps the learned latent features to the sample space then passes to the output layer to generate the output.Figure 1
Structure of LSTM network.The model is divided into upper, middle, and lower parts (see Figure1): tourist submodel, matrix decomposition model, and tourist route submodel, respectively. The input data format of the tourist sub-sub-model is vecxuserr−xitem, which is regarded as a multiclassification problem. A 5-class prediction is made on the review data vector of a tourist. The category is r−xuser and is extracted from the fully connected layer during the training process as the latent feature rx. The input data format of the travel route submodel is (vecxitem, r−xitem which is also regarded as a multiclassification problem. That is, the comment vec y, of an item is used for 5-category prediction. The category is r−xitem, and during the training process, the hidden feature qx of the tourist route is extracted from the fully connected layer. The middle part is the matrix decomposition submodel, which takes the latent features px of tourists learned in the submodel of tourists and the latent features qx of items learned in the submodel of tourist routes as inner products. Get the predicted score rxy'=pxqyT. Based on the Adam optimization method training, the whole model and the submodel minimize tourists. The prediction error of the travel route submodel and matrix factorization model calculates the error between the predicted score rxy′ and the real score rxy.Score prediction is realized based on nonnegative matrix factorization (NMF). The matrixR∈R+w×t is decomposed into two submatrices W∈R+w×z and T∈R+z×t by NMF. All R,w,andt, terms are on negative terms because the following relationship can be derived: R ≈ W × T. In the context of recommender systems, R+w×t represents an m∗t nonnegative matrix. W can be understood as a tourist route. T is the latent factor. Z is the number of nondecomposable factors of R. In real recommendation problems, there are no negative terms (travel routes, tourists, ratings). The nonnegative constraints on W and T improve the interpretability of the collaborative filtering system.The NMF is initialized based on the tourist route latent factor. The goal of the model is to find two lower-ranked nonnegative matricesWIq∈R+w×z and T∈R+z×t to predict ratings, calculated as R=WIqT. Set up a constraint between R and WIqN as the objective function.(1)R−WIqT2=∑pxRpx−WIqTpx2.In the formula,WIq represents the latent factor matrix initialized based on the contextual features of the tourist route.Overfitting may occur in the prediction process, so the F-norm regular term is added to the objective function, and the objective function is rewritten as(2)12ρw∑twWIqp2+12ρt∑tTTx2,R−WIqT2=∑pxRpx−WIqTpx2+,where ρw is the regular term of feature vector WIqp and ρt is the regular term of Tx.The eigenmatricesWIq and T are obtained by minimizing the objective function. The mathematical model is defined as (3)W,T=minR−WIqT2,where W>0 and T>0.Initialize the matrixT to a random matrix of size z×t: T=randomz×t, where z is the minimum factor of the rating matrix. Calculate the minimum value of the objective function by iteratively updating W and T. The mathematical formula of iteration is (4)Wpz←WpzTNRpzTNTWIqpz,Tzx←TzxWIqNRzxWIqNWIqTzx.The predicted rating of touristp for tourist route x can be calculated as(5)Rpx′=WpTx.In the formula,Rpx′ is the predicted score.Algorithm 1 summarizes the algorithm of the recommendation system in this study. The algorithm iteratively updates the two latent factor matricesW and T until convergence is achieved.Algorithm 1: Recommendation algorithm based on nonnegative maximal matrix.
Inputs: the scoring matrixR of the dataset, the maximum number of iterations Maxiter, the threshold.Output: feature matricesW and T.(1)
Preprocess auxiliary information of tourist routes to obtain sentence matrix.(2)
Use CNN to extract the feature vector of the sentence matrix.(3)
Initialization:T=randomz×t,W=Iq=WIq.(4)
forz from 1 to Maxiter do /⋆ Minimize the objective function minR−WT2,W≥0,T≥0⋆/(5)
forp from 1 to W do(6)
Wpz←WpzTNRpz/TNTWIqpz.(7)
endfor(8)
forx from 1 to T do(9)
Tzx←TzxWIqNRpz/WIqNWIqTpz.(10)
endfor(11)
Rerr=RMSER−WT2//Calculate the objective function(12)
if Rerr < threshold(13)
Break(14)
Endif.(15)
Endfor.(16)
Return.


#### 2.2.1. Text Vectorization

Text vectorization uses word embedding to map text to w-dimensional vectors. First, for each tourist, all the review data are merged separately for each travel itinerary and average their scores. The raw data is processed into visitor review rating data and item review rating data. The user data format is as follows.(userx,cx0⊕cx1⊕⋯⊕cxt,1/t∑j=1trxy, the travel route data format is: itemx,c0y⊕c1y⊕⋯⊕cwy,1/w∑x−1wrxy), where ⊕ means that the text is concatenated with spaces. Arrange the above formula as formulas (6) and (7).(6)userx,dxuser,r−xuser,(7)itemy,dyitem,r−yitem,where dxuser represents all the reviews of tourist userx on item1∼itemt and r−xuser represents the mean of all ratings of tourist userx on item1∼itemt. Then, based on the text vectorization technique, the merged review data is represented by a vector as vecxuser. It is defined as formulas (8) and (9).(8)vecyuser=Doc2VecCdxuser,(9)vecyitem=Doc2VecCdyitem,where the Doc2VecC function returns a w-dimensional vector, which represents each document dxuser as a simple average of word embeddings, and ensure that the generated vector representation can capture the semantic information of the document during training learning. After text vectorization, the sample data of tourist x can be expressed as(10)userx,vecxuser,r−xuser.The data of travel routey is represented as(11)userx,vecxuser,r−xuser.


#### 2.2.2. Convolutional Layer

The convolutional layer is the core of the convolutional neural network, which is used to perform convolution calculations on the input sample features and extract important features. In the model in this study, the convolution layer receives the text vectorsvecxuser and vecxitem of user userx to tourist route itemy as input features. Then perform operation reshape on it and convert it to the size of k∗k, where k∗k=m. Suppose there are t neurons in the convolution layer, and each neuron n passes through the sliding convolution kernel Fn. Perform convolution calculations on the input samples and obtain new feature maps. The convolution kernel is also called a filter. The convolution computation in each convolution kernel slides across the width and height of the input data. Calculate the inner product of the entire convolution kernel and the input data anywhere. Assuming that the size of the convolution kernel is s, that is, Fn∈Rs×s, the nth feature map can be calculated by the following formula:(12)wn=fvecxuser∗Fn+hx.Among them, ∗ represents the convolution calculation,hx represents the bias term, which is a real number, and f is a nonlinear activation function. It can introduce nonlinear factors into the model and solve the problem that linear models are difficult to represent as features. Commonly used activation functions are Sigmoid function, Tanh function, and ReLU function. The calculation formulas of the three activation functions are as follows:(13)ReLUi=max0,i,Tanhi=ei−e−iei+e−i,Sigmoidi=11+e−i.


#### 2.2.3. Pooling Layer

The pooling layer is mainly used to reduce the dimension of the feature map calculated by the convolution layer. Retain the more essential features in the network while controlling the “overfitting” phenomenon to a certain extent. Suppose the feature graphWn=w1,w2,…,wk−s+1 is obtained in the n-th convolution layer. The maximum pooling takes the maximum value in Wn, and un represents the pooling result of the n-th convolutional layer, which is given by(14)un=maxWn=maxw1,w2,…,wk−s+1.


#### 2.2.4. Fully Connected and Output Layer

The fully connected layer receives the output of the pooling layer. Suppose there arew neurons in the fully connected layer. After the fully connected layer ReLU activation function, a fixed-size vector px is obtained, which is the implicit feature of the tourist user x. Similarly, the implicit feature vector qy of the tourist route item y can also be obtained. The calculation formula is as follows:(15)qy=ReLUmitemyPitemy+hitemy,px=ReLUmuserxPuserx+huserx,where px,qy∈Rw,Puserx and Pitemy represent the pooling layer outputs of the tourist and tourist route submodels, respectively. muserx and mitemy are the weights of the fully connected layers of the tourist and tourist route submodels, respectively, and huserx and hitemy are the corresponding biases.


#### 2.2.5. Matrix Factorization

Matrix decomposition uses matrix multiplication to decompose the user-item rating matrix into two low-dimensional user feature matrices and item feature matrices. In the model-based collaborative filtering algorithm, the model of tourists and tourist routes is constructed. From historical data such as ratings of tourists and tourist routes, learn the feature matrix of users and the feature matrix of items. Then the two feature matrices are multiplied to get the predicted score matrix. Finally, fit the predicted score matrix and the actual score matrix.This study constructs a tourist submodel and an item submodel based on the convolutional neural network. From the reviews posted by tourists and all the reviews received by the tourist routes, the latent featurespx of tourists and the latent features qy of tourist routes is learned. Then calculate the inner product of the implicit feature matrix of tourists and the implicit feature matrix of the tourist route. The predicted score matrix rxy'∈R is obtained, and the calculation formula is as follows:(16)rxy'=pxqyN.Fit the predicted score and the actual score by the Adam optimization method. For tourist routes with ratings, make their predicted ratings as close to the actual ratings as possible. From this, it can be assumed that an unrated tour will have an actual rating close to the predicted rating. The calculation formula is shown in the below formula.(17)rxy≈rxy'=pxqyN.


## 2.1. Problem Description

The collaborative filtering algorithm mines the hidden features of tourists or tourist routes according to the data of tourists’ interest and preference for tourism. Then its correlations are calculated and score predictions are made. Finally, a recommendation is generated. In general, data is often very sparse. The current collaborative filtering is difficult to extract the deeply hidden features in the data.For example, suppose there arew tourists and t travel routes. The sample data is in the form of a 4-tuple (userx, itemy ,cxy,rxy), where rxy represents the rating of tourists x on the tourist route y, which is an integer value from 1 to 5. cxy represents the comment of tourist x on the tourist route y, which is a piece of text with different lengths. R is an w∗t rating matrix and C is an w∗t review matrix, where rxy∈Rw×t,cxy∈Cw×t, as shown in Table 1.Table 1
Rating and comment data.
UserItemItem1Item2…ItemwUser1r00, c00???User2?r22, c22??…??rxy, cxy?Userw????In Table1, each row represents the ratings and reviews published by a tourist. Each column represents the ratings and reviews received by a tourist route. ? means no rating comment information. The matrices R and C can be obtained from Table 1.Therefore, the problem to be solved in this study is to integrate the convolutional neural network into the collaborative filtering algorithm based on the rating matrixRw×t and the comment matrix Cw×t, Mining hidden features of tourists and tourist routes and predicting tourists’ ratings for unrated routes.


## 2.2. Collaborative Filtering Model Design

The collaborative filtering algorithm model that integrates the convolutional neural network preprocesses the data, including removing invalid data and retaining comment and rating data. Then, each travel itinerary merges all its review data separately for each tourist and average the rating data. Then, the combined review data is converted into a vector-based on the text vectorization technology. The vectorized tourist and tourism data are sent to the convolutional neural network for training. Based on the convolutional neural network, the latent features of all comments of the tourist userx are extracted as the latent feature representation px of the tourist. Similarly, extract a particular travel route item, the implicit features of all reviews, as the feature representation qy of the item. Then, based on the matrix decomposition method in collaborative filtering, the inner product of the transpose of px and qy is performed to obtain the predicted score rxy'=pxqxT. Finally, the Adam optimization method is used to train the model to minimize the error between the predicted score rxy' and the real score rxy.The model structure is shown in Figure1, including the input layer, convolution layer, pooling layer, fully connected layer, and output layer. The input layer receives the vectorized review text as the input feature x, and the average score as the input feature y. The convolution layer performs convolution calculation on the input features by sliding the convolution kernel and obtaining the feature map. The pooling layer uses the maximum pooling method to reduce the dimension of the feature map calculated by the convolution layer and retains the more essential features in the network. The fully connected layer maps the learned latent features to the sample space then passes to the output layer to generate the output.Figure 1
Structure of LSTM network.The model is divided into upper, middle, and lower parts (see Figure1): tourist submodel, matrix decomposition model, and tourist route submodel, respectively. The input data format of the tourist sub-sub-model is vecxuserr−xitem, which is regarded as a multiclassification problem. A 5-class prediction is made on the review data vector of a tourist. The category is r−xuser and is extracted from the fully connected layer during the training process as the latent feature rx. The input data format of the travel route submodel is (vecxitem, r−xitem which is also regarded as a multiclassification problem. That is, the comment vec y, of an item is used for 5-category prediction. The category is r−xitem, and during the training process, the hidden feature qx of the tourist route is extracted from the fully connected layer. The middle part is the matrix decomposition submodel, which takes the latent features px of tourists learned in the submodel of tourists and the latent features qx of items learned in the submodel of tourist routes as inner products. Get the predicted score rxy'=pxqyT. Based on the Adam optimization method training, the whole model and the submodel minimize tourists. The prediction error of the travel route submodel and matrix factorization model calculates the error between the predicted score rxy′ and the real score rxy.Score prediction is realized based on nonnegative matrix factorization (NMF). The matrixR∈R+w×t is decomposed into two submatrices W∈R+w×z and T∈R+z×t by NMF. All R,w,andt, terms are on negative terms because the following relationship can be derived: R ≈ W × T. In the context of recommender systems, R+w×t represents an m∗t nonnegative matrix. W can be understood as a tourist route. T is the latent factor. Z is the number of nondecomposable factors of R. In real recommendation problems, there are no negative terms (travel routes, tourists, ratings). The nonnegative constraints on W and T improve the interpretability of the collaborative filtering system.The NMF is initialized based on the tourist route latent factor. The goal of the model is to find two lower-ranked nonnegative matricesWIq∈R+w×z and T∈R+z×t to predict ratings, calculated as R=WIqT. Set up a constraint between R and WIqN as the objective function.(1)R−WIqT2=∑pxRpx−WIqTpx2.In the formula,WIq represents the latent factor matrix initialized based on the contextual features of the tourist route.Overfitting may occur in the prediction process, so the F-norm regular term is added to the objective function, and the objective function is rewritten as(2)12ρw∑twWIqp2+12ρt∑tTTx2,R−WIqT2=∑pxRpx−WIqTpx2+,where ρw is the regular term of feature vector WIqp and ρt is the regular term of Tx.The eigenmatricesWIq and T are obtained by minimizing the objective function. The mathematical model is defined as (3)W,T=minR−WIqT2,where W>0 and T>0.Initialize the matrixT to a random matrix of size z×t: T=randomz×t, where z is the minimum factor of the rating matrix. Calculate the minimum value of the objective function by iteratively updating W and T. The mathematical formula of iteration is (4)Wpz←WpzTNRpzTNTWIqpz,Tzx←TzxWIqNRzxWIqNWIqTzx.The predicted rating of touristp for tourist route x can be calculated as(5)Rpx′=WpTx.In the formula,Rpx′ is the predicted score.Algorithm 1 summarizes the algorithm of the recommendation system in this study. The algorithm iteratively updates the two latent factor matricesW and T until convergence is achieved.Algorithm 1: Recommendation algorithm based on nonnegative maximal matrix.
Inputs: the scoring matrixR of the dataset, the maximum number of iterations Maxiter, the threshold.Output: feature matricesW and T.(1)
Preprocess auxiliary information of tourist routes to obtain sentence matrix.(2)
Use CNN to extract the feature vector of the sentence matrix.(3)
Initialization:T=randomz×t,W=Iq=WIq.(4)
forz from 1 to Maxiter do /⋆ Minimize the objective function minR−WT2,W≥0,T≥0⋆/(5)
forp from 1 to W do(6)
Wpz←WpzTNRpz/TNTWIqpz.(7)
endfor(8)
forx from 1 to T do(9)
Tzx←TzxWIqNRpz/WIqNWIqTpz.(10)
endfor(11)
Rerr=RMSER−WT2//Calculate the objective function(12)
if Rerr < threshold(13)
Break(14)
Endif.(15)
Endfor.(16)
Return.


### 2.2.1. Text Vectorization

Text vectorization uses word embedding to map text to w-dimensional vectors. First, for each tourist, all the review data are merged separately for each travel itinerary and average their scores. The raw data is processed into visitor review rating data and item review rating data. The user data format is as follows.(userx,cx0⊕cx1⊕⋯⊕cxt,1/t∑j=1trxy, the travel route data format is: itemx,c0y⊕c1y⊕⋯⊕cwy,1/w∑x−1wrxy), where ⊕ means that the text is concatenated with spaces. Arrange the above formula as formulas (6) and (7).(6)userx,dxuser,r−xuser,(7)itemy,dyitem,r−yitem,where dxuser represents all the reviews of tourist userx on item1∼itemt and r−xuser represents the mean of all ratings of tourist userx on item1∼itemt. Then, based on the text vectorization technique, the merged review data is represented by a vector as vecxuser. It is defined as formulas (8) and (9).(8)vecyuser=Doc2VecCdxuser,(9)vecyitem=Doc2VecCdyitem,where the Doc2VecC function returns a w-dimensional vector, which represents each document dxuser as a simple average of word embeddings, and ensure that the generated vector representation can capture the semantic information of the document during training learning. After text vectorization, the sample data of tourist x can be expressed as(10)userx,vecxuser,r−xuser.The data of travel routey is represented as(11)userx,vecxuser,r−xuser.


### 2.2.2. Convolutional Layer

The convolutional layer is the core of the convolutional neural network, which is used to perform convolution calculations on the input sample features and extract important features. In the model in this study, the convolution layer receives the text vectorsvecxuser and vecxitem of user userx to tourist route itemy as input features. Then perform operation reshape on it and convert it to the size of k∗k, where k∗k=m. Suppose there are t neurons in the convolution layer, and each neuron n passes through the sliding convolution kernel Fn. Perform convolution calculations on the input samples and obtain new feature maps. The convolution kernel is also called a filter. The convolution computation in each convolution kernel slides across the width and height of the input data. Calculate the inner product of the entire convolution kernel and the input data anywhere. Assuming that the size of the convolution kernel is s, that is, Fn∈Rs×s, the nth feature map can be calculated by the following formula:(12)wn=fvecxuser∗Fn+hx.Among them, ∗ represents the convolution calculation,hx represents the bias term, which is a real number, and f is a nonlinear activation function. It can introduce nonlinear factors into the model and solve the problem that linear models are difficult to represent as features. Commonly used activation functions are Sigmoid function, Tanh function, and ReLU function. The calculation formulas of the three activation functions are as follows:(13)ReLUi=max0,i,Tanhi=ei−e−iei+e−i,Sigmoidi=11+e−i.


### 2.2.3. Pooling Layer

The pooling layer is mainly used to reduce the dimension of the feature map calculated by the convolution layer. Retain the more essential features in the network while controlling the “overfitting” phenomenon to a certain extent. Suppose the feature graphWn=w1,w2,…,wk−s+1 is obtained in the n-th convolution layer. The maximum pooling takes the maximum value in Wn, and un represents the pooling result of the n-th convolutional layer, which is given by(14)un=maxWn=maxw1,w2,…,wk−s+1.


### 2.2.4. Fully Connected and Output Layer

The fully connected layer receives the output of the pooling layer. Suppose there arew neurons in the fully connected layer. After the fully connected layer ReLU activation function, a fixed-size vector px is obtained, which is the implicit feature of the tourist user x. Similarly, the implicit feature vector qy of the tourist route item y can also be obtained. The calculation formula is as follows:(15)qy=ReLUmitemyPitemy+hitemy,px=ReLUmuserxPuserx+huserx,where px,qy∈Rw,Puserx and Pitemy represent the pooling layer outputs of the tourist and tourist route submodels, respectively. muserx and mitemy are the weights of the fully connected layers of the tourist and tourist route submodels, respectively, and huserx and hitemy are the corresponding biases.


### 2.2.5. Matrix Factorization

Matrix decomposition uses matrix multiplication to decompose the user-item rating matrix into two low-dimensional user feature matrices and item feature matrices. In the model-based collaborative filtering algorithm, the model of tourists and tourist routes is constructed. From historical data such as ratings of tourists and tourist routes, learn the feature matrix of users and the feature matrix of items. Then the two feature matrices are multiplied to get the predicted score matrix. Finally, fit the predicted score matrix and the actual score matrix.This study constructs a tourist submodel and an item submodel based on the convolutional neural network. From the reviews posted by tourists and all the reviews received by the tourist routes, the latent featurespx of tourists and the latent features qy of tourist routes is learned. Then calculate the inner product of the implicit feature matrix of tourists and the implicit feature matrix of the tourist route. The predicted score matrix rxy'∈R is obtained, and the calculation formula is as follows:(16)rxy'=pxqyN.Fit the predicted score and the actual score by the Adam optimization method. For tourist routes with ratings, make their predicted ratings as close to the actual ratings as possible. From this, it can be assumed that an unrated tour will have an actual rating close to the predicted rating. The calculation formula is shown in the below formula.(17)rxy≈rxy'=pxqyN.


## 2.2.1. Text Vectorization

Text vectorization uses word embedding to map text to w-dimensional vectors. First, for each tourist, all the review data are merged separately for each travel itinerary and average their scores. The raw data is processed into visitor review rating data and item review rating data. The user data format is as follows.(userx,cx0⊕cx1⊕⋯⊕cxt,1/t∑j=1trxy, the travel route data format is: itemx,c0y⊕c1y⊕⋯⊕cwy,1/w∑x−1wrxy), where ⊕ means that the text is concatenated with spaces. Arrange the above formula as formulas (6) and (7).(6)userx,dxuser,r−xuser,(7)itemy,dyitem,r−yitem,where dxuser represents all the reviews of tourist userx on item1∼itemt and r−xuser represents the mean of all ratings of tourist userx on item1∼itemt. Then, based on the text vectorization technique, the merged review data is represented by a vector as vecxuser. It is defined as formulas (8) and (9).(8)vecyuser=Doc2VecCdxuser,(9)vecyitem=Doc2VecCdyitem,where the Doc2VecC function returns a w-dimensional vector, which represents each document dxuser as a simple average of word embeddings, and ensure that the generated vector representation can capture the semantic information of the document during training learning. After text vectorization, the sample data of tourist x can be expressed as(10)userx,vecxuser,r−xuser.The data of travel routey is represented as(11)userx,vecxuser,r−xuser.


## 2.2.2. Convolutional Layer

The convolutional layer is the core of the convolutional neural network, which is used to perform convolution calculations on the input sample features and extract important features. In the model in this study, the convolution layer receives the text vectorsvecxuser and vecxitem of user userx to tourist route itemy as input features. Then perform operation reshape on it and convert it to the size of k∗k, where k∗k=m. Suppose there are t neurons in the convolution layer, and each neuron n passes through the sliding convolution kernel Fn. Perform convolution calculations on the input samples and obtain new feature maps. The convolution kernel is also called a filter. The convolution computation in each convolution kernel slides across the width and height of the input data. Calculate the inner product of the entire convolution kernel and the input data anywhere. Assuming that the size of the convolution kernel is s, that is, Fn∈Rs×s, the nth feature map can be calculated by the following formula:(12)wn=fvecxuser∗Fn+hx.Among them, ∗ represents the convolution calculation,hx represents the bias term, which is a real number, and f is a nonlinear activation function. It can introduce nonlinear factors into the model and solve the problem that linear models are difficult to represent as features. Commonly used activation functions are Sigmoid function, Tanh function, and ReLU function. The calculation formulas of the three activation functions are as follows:(13)ReLUi=max0,i,Tanhi=ei−e−iei+e−i,Sigmoidi=11+e−i.


## 2.2.3. Pooling Layer

The pooling layer is mainly used to reduce the dimension of the feature map calculated by the convolution layer. Retain the more essential features in the network while controlling the “overfitting” phenomenon to a certain extent. Suppose the feature graphWn=w1,w2,…,wk−s+1 is obtained in the n-th convolution layer. The maximum pooling takes the maximum value in Wn, and un represents the pooling result of the n-th convolutional layer, which is given by(14)un=maxWn=maxw1,w2,…,wk−s+1.


## 2.2.4. Fully Connected and Output Layer

The fully connected layer receives the output of the pooling layer. Suppose there arew neurons in the fully connected layer. After the fully connected layer ReLU activation function, a fixed-size vector px is obtained, which is the implicit feature of the tourist user x. Similarly, the implicit feature vector qy of the tourist route item y can also be obtained. The calculation formula is as follows:(15)qy=ReLUmitemyPitemy+hitemy,px=ReLUmuserxPuserx+huserx,where px,qy∈Rw,Puserx and Pitemy represent the pooling layer outputs of the tourist and tourist route submodels, respectively. muserx and mitemy are the weights of the fully connected layers of the tourist and tourist route submodels, respectively, and huserx and hitemy are the corresponding biases.


## 2.2.5. Matrix Factorization

Matrix decomposition uses matrix multiplication to decompose the user-item rating matrix into two low-dimensional user feature matrices and item feature matrices. In the model-based collaborative filtering algorithm, the model of tourists and tourist routes is constructed. From historical data such as ratings of tourists and tourist routes, learn the feature matrix of users and the feature matrix of items. Then the two feature matrices are multiplied to get the predicted score matrix. Finally, fit the predicted score matrix and the actual score matrix.This study constructs a tourist submodel and an item submodel based on the convolutional neural network. From the reviews posted by tourists and all the reviews received by the tourist routes, the latent featurespx of tourists and the latent features qy of tourist routes is learned. Then calculate the inner product of the implicit feature matrix of tourists and the implicit feature matrix of the tourist route. The predicted score matrix rxy'∈R is obtained, and the calculation formula is as follows:(16)rxy'=pxqyN.Fit the predicted score and the actual score by the Adam optimization method. For tourist routes with ratings, make their predicted ratings as close to the actual ratings as possible. From this, it can be assumed that an unrated tour will have an actual rating close to the predicted rating. The calculation formula is shown in the below formula.(17)rxy≈rxy'=pxqyN.


## 3. Experimental Results and Analysis

### 3.1. Dataset

The travel data comes from a travel company owned by an airline. It includes 25,714 travel records of 4,731 tourists on 1,439 tourist routes, and each tourist contains at least three routes that they have participated in. Each record includes tour group number, tourist name, gender, ID number, line departure time, line price, and detailed introduction to attractions. It is an implicit feedback dataset. As long as a tourist has participated in a certain route, it is considered that the tourist likes this route. The dataset is split into a training set (train), a validation set (validation), and a test set (test) in a ratio of 7 : 2 : 1. The training set is used to train the model, the validation set is used for parameter selection, and the test set is used to evaluate the model.


### 3.2. Evaluation Indicators

This study uses Precision, Recall, F1 value, and Normalized Discounted Cumulative Gain (NDCG) as the algorithm evaluation criteria.Precision: The recommendation accuracy refers to the ratio of the number of travel routes that tourists like to the total number of recommended travel routes among the recommended travel routes.(18)Precision=∑p∈PRp∩Np∑p∈PRp.In the formula,Rp represents the list of recommended items for tourist p according to the behavior of tourist p on the training set, and Np represents the list of items that tourist p likes on the test set.Recall rate (Recall): The recall rate of the recommendation system represents the ratio between the number of travel routes that tourists like among the recommended travel routes and the number of travel routes that tourists like. The calculation process of the recall rate is as follows:(19)Recall=∑p∈PRp∩Np∑p∈PNp.F1 score: It is a comprehensive index of precision and recall. The larger the value of F1, the better the algorithm’s performance. The F1 value is defined as follows:(20)F1=2×Precision×RecallPrecision+Recall.NDCG@K is used to sort the predicted probability value of each travel route in the recommended list. If the predicted probability value of the top travel route in the recommended list is more significant, the greater the value of NDCG, the better the recommendation effect of the model.(21)NDCG@K=1P∑p∈PNDCGp@K,where P represents the number of tourists in the test set and ∑p∈PTDCAp@K is the sum of the NDCG values of each tourist.


### 3.3. Parameter Training

#### 3.3.1. Effects of Negative Sampling Rates

The negative sampling rate indicates how many disliked items are sampled for each traveler. At a fixed negative sampling rate, the number of disliked lines sampled for each tourist is different. The larger the negative sampling rate, the more unfavorable routes are sampled for the same tourist. There are many negative samples in the optimization process. If the value of the negative sampling rate is smaller, the number of lines that are not liked is extracted, and there will be fewer negative samples. Therefore, it is discussed in the experiment how many negative samples are drawn for each tourist, making the model perform the best. The grid search method is used in the experiment, and the negative sampling rate is selected according to the algorithm’s performance. With fixed regularization parameters and latent factors, the search range for negative sampling rates is {0.0, 0.2, 0.4, 0.6, 0.8, 1.0}, and the performance results are shown in Figure2.Figure 2
Effect of negative sampling rate.It can be seen from Figure2 that as increases, the three evaluation indicators of Top@5, Top@10, and Top@15 first increase and then decrease, later tend to remain unchanged. The results confirm that the model performance first increases and then decreases as the number of negative samples increases. The larger the number of negative samples, the slower the model’s training will be. Therefore, to balance model performance and efficiency, the negative sampling rate is taken as 0.2.


#### 3.3.2. Influence of Vector Dimension

The vector dimension represents the length of the latent features of tourists and travel itineraries. The larger the vector dimension, the richer the information representation of tourists and tourist routes, but the more significant computation. The smaller the vector dimension, the less accurate, but the faster the learning speed. Therefore, in the case of balancing accuracy and calculation amount, a more appropriate dimension size is generally set through experiments. Set the vector dimension search range to {0, 20, 40, 60, 80, 100}, and the experimental results are shown in Figure3. It can be seen from Figure 3 that with the increase of vector dimension, the NDCG and F1 indicators proliferate. When the vector dimension reaches more than 40, the growth rate slows down, and the algorithm performance tends to be stable. The growth of the Recall indicator is not as dramatic as that of NDCG and F1, but it still increases first and then decreases. After reaching 40, the growth rate slows down, so the vector dimension is taken as 40.Figure 3
Effect of dimension size.


### 3.4. Experimental Results and Comparative Analysis

To further illustrate the effect and prediction performance of the algorithm in this study, the algorithm in this study is compared with other traditional recommendation algorithms. The performance comparisons of the four algorithms in Recall@K, NDCG@K, and F1 are shown in Table2.Table 2
Comparison of the proposed with other methods.
MethodRecallNDCGF1 scoreTop@5Top@10Top@15Top@5Top@10Top@15Top@5Top@10Top@15Proposed0.5080.5640.5960.4690.4970.5060.4050.4180.419Literature [19]0.4910.5450.5840.4520.4830.4930.3850.4070.405Literature [20]0.4720.5310.5820.4460.4650.4750.3820.3940.407Literature [21]0.4670.5260.5510.4250.4460.4570.3760.3830.389It can be seen from Table1 that as N increases, Recall@K, NDCG@K, and F1@K all increase. Among them, the growth rate of Recall@K is particularly obvious. Such results validate the fact that in reality, the more routes are offered to tourists, and the more routes will be chosen to satisfy tourists’ interests. However, there are many recommended routes, and the routes that tourists are most interested in may not always be at the top of the recommended list. Based on the two methods of network representation learning, the results of our algorithm and literature [19] are better than that of literature [20] and literature [21]. This is because the network representation learning method is used to learn route and passenger vector representation, making better data information. A good uniform representation is obtained. It is difficult for literature [20] and literature [21] to fuse and fully utilize this information. The proposed is better than literature [19]. It shows that using the word vector method to add information about the co-occurrence of tourists, common liking of route pairs, and a shared dislike of route pairs can get a better vector representation of routes and passengers. However, literature [19] only utilizes the feature information of scenic spots to learn the vector representation. The performance of literature [20] is better than that of literature [21] because literature [20] makes good use of extra data information. Literature [21] only uses the interaction matrix of tourists and routes.


## 3.1. Dataset

The travel data comes from a travel company owned by an airline. It includes 25,714 travel records of 4,731 tourists on 1,439 tourist routes, and each tourist contains at least three routes that they have participated in. Each record includes tour group number, tourist name, gender, ID number, line departure time, line price, and detailed introduction to attractions. It is an implicit feedback dataset. As long as a tourist has participated in a certain route, it is considered that the tourist likes this route. The dataset is split into a training set (train), a validation set (validation), and a test set (test) in a ratio of 7 : 2 : 1. The training set is used to train the model, the validation set is used for parameter selection, and the test set is used to evaluate the model.


## 3.2. Evaluation Indicators

This study uses Precision, Recall, F1 value, and Normalized Discounted Cumulative Gain (NDCG) as the algorithm evaluation criteria.Precision: The recommendation accuracy refers to the ratio of the number of travel routes that tourists like to the total number of recommended travel routes among the recommended travel routes.(18)Precision=∑p∈PRp∩Np∑p∈PRp.In the formula,Rp represents the list of recommended items for tourist p according to the behavior of tourist p on the training set, and Np represents the list of items that tourist p likes on the test set.Recall rate (Recall): The recall rate of the recommendation system represents the ratio between the number of travel routes that tourists like among the recommended travel routes and the number of travel routes that tourists like. The calculation process of the recall rate is as follows:(19)Recall=∑p∈PRp∩Np∑p∈PNp.F1 score: It is a comprehensive index of precision and recall. The larger the value of F1, the better the algorithm’s performance. The F1 value is defined as follows:(20)F1=2×Precision×RecallPrecision+Recall.NDCG@K is used to sort the predicted probability value of each travel route in the recommended list. If the predicted probability value of the top travel route in the recommended list is more significant, the greater the value of NDCG, the better the recommendation effect of the model.(21)NDCG@K=1P∑p∈PNDCGp@K,where P represents the number of tourists in the test set and ∑p∈PTDCAp@K is the sum of the NDCG values of each tourist.


## 3.3. Parameter Training

### 3.3.1. Effects of Negative Sampling Rates

The negative sampling rate indicates how many disliked items are sampled for each traveler. At a fixed negative sampling rate, the number of disliked lines sampled for each tourist is different. The larger the negative sampling rate, the more unfavorable routes are sampled for the same tourist. There are many negative samples in the optimization process. If the value of the negative sampling rate is smaller, the number of lines that are not liked is extracted, and there will be fewer negative samples. Therefore, it is discussed in the experiment how many negative samples are drawn for each tourist, making the model perform the best. The grid search method is used in the experiment, and the negative sampling rate is selected according to the algorithm’s performance. With fixed regularization parameters and latent factors, the search range for negative sampling rates is {0.0, 0.2, 0.4, 0.6, 0.8, 1.0}, and the performance results are shown in Figure2.Figure 2
Effect of negative sampling rate.It can be seen from Figure2 that as increases, the three evaluation indicators of Top@5, Top@10, and Top@15 first increase and then decrease, later tend to remain unchanged. The results confirm that the model performance first increases and then decreases as the number of negative samples increases. The larger the number of negative samples, the slower the model’s training will be. Therefore, to balance model performance and efficiency, the negative sampling rate is taken as 0.2.


### 3.3.2. Influence of Vector Dimension

The vector dimension represents the length of the latent features of tourists and travel itineraries. The larger the vector dimension, the richer the information representation of tourists and tourist routes, but the more significant computation. The smaller the vector dimension, the less accurate, but the faster the learning speed. Therefore, in the case of balancing accuracy and calculation amount, a more appropriate dimension size is generally set through experiments. Set the vector dimension search range to {0, 20, 40, 60, 80, 100}, and the experimental results are shown in Figure3. It can be seen from Figure 3 that with the increase of vector dimension, the NDCG and F1 indicators proliferate. When the vector dimension reaches more than 40, the growth rate slows down, and the algorithm performance tends to be stable. The growth of the Recall indicator is not as dramatic as that of NDCG and F1, but it still increases first and then decreases. After reaching 40, the growth rate slows down, so the vector dimension is taken as 40.Figure 3
Effect of dimension size.


## 3.3.1. Effects of Negative Sampling Rates

The negative sampling rate indicates how many disliked items are sampled for each traveler. At a fixed negative sampling rate, the number of disliked lines sampled for each tourist is different. The larger the negative sampling rate, the more unfavorable routes are sampled for the same tourist. There are many negative samples in the optimization process. If the value of the negative sampling rate is smaller, the number of lines that are not liked is extracted, and there will be fewer negative samples. Therefore, it is discussed in the experiment how many negative samples are drawn for each tourist, making the model perform the best. The grid search method is used in the experiment, and the negative sampling rate is selected according to the algorithm’s performance. With fixed regularization parameters and latent factors, the search range for negative sampling rates is {0.0, 0.2, 0.4, 0.6, 0.8, 1.0}, and the performance results are shown in Figure2.Figure 2
Effect of negative sampling rate.It can be seen from Figure2 that as increases, the three evaluation indicators of Top@5, Top@10, and Top@15 first increase and then decrease, later tend to remain unchanged. The results confirm that the model performance first increases and then decreases as the number of negative samples increases. The larger the number of negative samples, the slower the model’s training will be. Therefore, to balance model performance and efficiency, the negative sampling rate is taken as 0.2.


## 3.3.2. Influence of Vector Dimension

The vector dimension represents the length of the latent features of tourists and travel itineraries. The larger the vector dimension, the richer the information representation of tourists and tourist routes, but the more significant computation. The smaller the vector dimension, the less accurate, but the faster the learning speed. Therefore, in the case of balancing accuracy and calculation amount, a more appropriate dimension size is generally set through experiments. Set the vector dimension search range to {0, 20, 40, 60, 80, 100}, and the experimental results are shown in Figure3. It can be seen from Figure 3 that with the increase of vector dimension, the NDCG and F1 indicators proliferate. When the vector dimension reaches more than 40, the growth rate slows down, and the algorithm performance tends to be stable. The growth of the Recall indicator is not as dramatic as that of NDCG and F1, but it still increases first and then decreases. After reaching 40, the growth rate slows down, so the vector dimension is taken as 40.Figure 3
Effect of dimension size.


## 3.4. Experimental Results and Comparative Analysis

To further illustrate the effect and prediction performance of the algorithm in this study, the algorithm in this study is compared with other traditional recommendation algorithms. The performance comparisons of the four algorithms in Recall@K, NDCG@K, and F1 are shown in Table2.Table 2
Comparison of the proposed with other methods.
MethodRecallNDCGF1 scoreTop@5Top@10Top@15Top@5Top@10Top@15Top@5Top@10Top@15Proposed0.5080.5640.5960.4690.4970.5060.4050.4180.419Literature [19]0.4910.5450.5840.4520.4830.4930.3850.4070.405Literature [20]0.4720.5310.5820.4460.4650.4750.3820.3940.407Literature [21]0.4670.5260.5510.4250.4460.4570.3760.3830.389It can be seen from Table1 that as N increases, Recall@K, NDCG@K, and F1@K all increase. Among them, the growth rate of Recall@K is particularly obvious. Such results validate the fact that in reality, the more routes are offered to tourists, and the more routes will be chosen to satisfy tourists’ interests. However, there are many recommended routes, and the routes that tourists are most interested in may not always be at the top of the recommended list. Based on the two methods of network representation learning, the results of our algorithm and literature [19] are better than that of literature [20] and literature [21]. This is because the network representation learning method is used to learn route and passenger vector representation, making better data information. A good uniform representation is obtained. It is difficult for literature [20] and literature [21] to fuse and fully utilize this information. The proposed is better than literature [19]. It shows that using the word vector method to add information about the co-occurrence of tourists, common liking of route pairs, and a shared dislike of route pairs can get a better vector representation of routes and passengers. However, literature [19] only utilizes the feature information of scenic spots to learn the vector representation. The performance of literature [20] is better than that of literature [21] because literature [20] makes good use of extra data information. Literature [21] only uses the interaction matrix of tourists and routes.


## 4. Conclusion

With the rapid development of smart tourism under the Internet, more and more people are accustomed to choosing travel routes on major travel websites. At present, there is a lot of recommended information about travel routes on travel websites, and all of them are mainly display information. Choosing a travel route that meets the interests of tourists from many travel information has become an urgent problem for the platform to solve. This study proposes a travel itinerary recommendation algorithm combining convolutional neural networks and collaborative filtering. The algorithm convolutional neural network consists of an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer. The algorithm first vectorizes the information about tourists and tourist routes and obtains the implicit feature map through volume and neural network. Then use the collaborative filtering algorithm to complete the line recommendation. This study uses the evaluation criteria of Recall, Normalized Discounted Cumulative Gain (NDCG), and F1 score. The experimental results show that the proposed algorithm has higher recommendation accuracy and recall. At the same time, the search accuracy and convergence speed of the optimal solution are significantly improved. At present, users will choose a variety of transportation modes during travel. Urban traffic conditions are complex, and different modes of transportation have a great impact on the travel experience. In the following work, the influence of travel mode on travel route recommendation will be considered. How to apply travel mode to tourism route recommendation is a problem that we need to focus on and solve.



---

*Source: 4659567-2022-05-07.xml*