## 3 A Recommender of Tourist Activities Based on Clustering and Rule Mining
### Personalised Recommendations of Touristic Activities  
This is the final stage of the system. First, the recommender ranks the association rules obtained in the previous stage, which are used to decide the POIs to be recommended to a user. The set of recommended POIs should ideally fulfil these conditions:  
* It should contain only POIs that have been visited by other members of the same cluster. * It should fit the user's interests regarding the preferred types of activities and the attraction towards popular items. * It should reflect the causality of the association rules of the cluster, in order to recommend POIs with high affinity. To achieve these conditions, the recommendation process was formulated as a ranking problem. The association rules of the user's cluster were ranked based on their performances according to certain evaluation metrics, and POIs were selected while taking into account the associations expressed in those rules. The employed evaluation metrics were antecedent support, consequent support, support, confidence, lift and two new metrics that evaluated the rules in terms of the preferences of the user towards certain kinds of touristic activities and towards popular spots. Those two new metrics are the following:  
* _Preference ratio_: This metric evaluates if the POIs that appear in a rule belong to any of the activity categories preferred by the user. The activity categories coincide with the activity features used in the clustering process. Let \(CAT_{pref}\) be a user's preferred categories, i.e., the activity categories for which the user has at least one tweet. \(1_{CAT_{pref}}(\psi(POI))\) is the indicator function that has value 1 if \(\psi(POI)\in CAT_{pref}\) or 0 otherwise. \(\psi(POI)\) is a function that gets the category to which a POI belongs by looking up the activity tree. Furthermore, let \(D_{CAT}(POI)\) be a function that signals the user's degree of interest in a preferred category, where the degree of interest is the percentage of the user's visited POIs belonging to the preferred category. If \(P_{rule}\) is the set of POIs in a rule, the preference ratio is calculated as follows: \[\text{\emph{preference ratio}}=\frac{1}{|P_{rule}|}\sum_{p\in P_{ rule}}(1_{CAT_{pref}}(\psi(p))*D_{CAT}(p))\] (4)
* _Popularity ratio_: This is the percentage of popular POIs in a rule. Let \(P_{top10}\) be the top 10 POIs extracted from the data set, and \(1_{P_{top10}}(POI)\) is the indicator function with value 1 if \(POI\in P_{top10}\) and 0 otherwise. The popularity ratio is computed with the following formula: \[\text{\emph{popularity ratio}}=\frac{1}{|P_{rule}|}\sum_{p\in P_{ rule}}1_{P_{top10}}(p)\] (5)  
After computing all the metrics as shown in Equations (1) to (5), they were combined to get an overall score for each association rule, using a weighted arithmetic mean (also known as the _weighted average_ (WA) aggregation operator in decision support systems). Let \(A\) be the set of metrics to be aggregated \(A=(a_{1},\dots,a_{n})\) and \(W=(w_{1},\dots,w_{n})\) be the set of weights for each metric. Then,  
\[WA(A)=\sum_{i=1}^{n}w_{i}a_{i} \tag{6}\]  
The WA operator allows one to determine the relevance of each metric using weights. In this work the weight of each metric has been manually set, but it depended on the user's degree of interest in popular POIs. Two sets of weights were defined, one for usersinterested in popular POIs and the other for users interested in off the beaten track POIs. The weights were linearly combined as follows:  
\[W_{comb}=(1-\beta)W_{unpop}+\beta W_{pop} \tag{7}\]  
In this expression, \(W_{comb}\) is the set of adapted weights, and \(W_{unpop}\) and \(W_{pop}\) are the predefined sets of weights for the users interested in unpopular and popular POIs, respectively (shown in Table 5). The parameter \(\beta\) expresses the degree to which the user is interested in popular POIs. It is computed as the fraction of the user's visited POIs that are in the top 10.