## 3 A Recommender of Tourist Activities Based on Clustering and Rule Mining
### Personalised Recommendations of Touristic Activities
Thus, when all POIs visited by the user are in the top 10, \(\beta\) is 1 and the \(W_{pop}\) weights are applied. Inversely, when none of the POIs visited by the user appear in the top 10, \(\beta\) is 0 and \(W_{comb}\) coincides with \(W_{unpop}\). In the \(W_{pop}\) case, we wanted to give high priority to the rules containing POIs in the top 10 (while still considering the user's preferences), so we gave higher importance to _popularity_ratio_ and the three support metrics because they reflect popularity in the rule and in the cluster respectively. In the case of \(W_{unpop}\), we zeroed out the _popularity_ratio_ and relied on the other metrics, especially on the _preference_ratio_. Given the definition of \(W_{pop}\) and \(W_{unpop}\) in Table 5, \(W_{comb}\) was adapted for each user using Equation (7). These weights were then used in Equation (6) to combine the metrics of all the association rules of the user's cluster. The steps of the final recommendation process are the following:  
1. The user that desires a recommendation is assigned to a cluster. To make this assignment, first the values of the clustering features are extracted from the analysis of the Twitter history of the user (in the future, a survey will be used to gauge the user's preferences). Then the user is assigned to the closest cluster comparing the Euclidean distance between the user's features and the mean of the members in each cluster. The Euclidean distance was used because it was the distance metric employed in the previous k-means clustering process. 2. The system takes the association rules of the user's cluster and their metrics. 3. The popularity and preference metrics are computed for each rule, based on the user's data. 4. The user's personalised weights are computed as described in Equation (7). 5. The metrics in Table 5 are combined using the WA operator to give an overall score for each rule. 6. A final selection procedure (see Algorithm 3) is used to select the set of items to be recommended to the user. Algorithm 3 starts by ranking the association rules by their overall scores, and then the POIs in the highest ranked rule are added to the set of POIs to be recommended \(R\). It then loops through \(R\), adding the POIs in the highest ranked rule for which any POI in \(R\) appears in the antecedent. This process is repeated until we have the requested amount of POIs for recommendation or the association rules of the cluster have been exhausted. \begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline
**Case** & **Preference Ratio** & **Lift** & **Confidence** & **Support** & **Antecedent Support** & **Consequent Support** & **Popularity Ratio** \\ \hline \(W_{unpop}\) & 0.5 & 0.15 & 0.15 & 0.1 & 0.05 & 0.05 & 0.0 \\ \hline \(W_{pop}\) & 0.3 & 0.05 & 0.05 & 0.1 & 0.1 & 0.1 & 0.3 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Weights for different cases of interest. ```
Input: ARM rules Output: Set of recommended items \(R\)
```
1: Let \(N\) be the number of POIs to recommend
2: Let \(R\) be the empty set of POIs to recommend
3: Sort ARM rules by their score
4:while true do
5: Select the highest ranked rule not considered in the previous iteration
6: Add POIs in the rule to \(R\) (if not already in \(R\))
7:if ARM rules exhausted then
8: Stop process and return \(R\)
9:endif
10:for\(POI\) in \(R\)do
11: Select the highest ranked rule where \(POI\) appears in the antecedent
12: Repeat the for loop for newly added POIs
13:endfor
14:if size of \(R=N\)then
15: Stop process and return \(R\)
16:endif
17:endwhile ```  
**Algorithm 3** Selection pseudocode