## 3 A Recommender of Tourist Activities Based on Clustering and Rule Mining
### Cluster Analysis
#### 3.3.1 Clustering Features  
In this work each user is represented by four kinds of features that represent the preferences of the user with regard to cultural and leisure activities, travel characteristics (length of stay and degree of mobility within the city), degrees of interest in popular POIs and period of the day with more touristic activity. * _Activity interest features_. These features embed the users' interests in different kinds of touristic activities. They represent different levels of abstraction in the activity tree, as the analysis would be too general if we only considered the eight main categories of the first level. The activities associated with higher percentages of users in Barcelona were selected for the clustering process. All these features were scored as the percentages \begin{table}
\begin{tabular}{c c} \hline \hline
**Statistics** & **Value** \\ \hline Total number of tweets in Barcelona & 1,523,801 \\ Total number of users in Barcelona & 108,515 \\ \hline
**Statistics after filtering** & \\ \hline Total number of tweets in Barcelona & 37,302 \\ Total number of users in Barcelona & 6066 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Data set summary. of tweets by users that were related to the particular types of activity. The selected features were the following:  
1. **Top-tier features**. These features represent some of the main categories in the activity tree. They are %Routes, %Sports, %Accommodation, %Transportation and %Nature. 2. **Middle-tier features**. These are activity features selected from the subcategories of the activity tree. They are %Food, %Enotourism, %AmusementParks, %RecreationFacilities, %Beach, %Health&Care, %NightLife, %Shopping, %Viewpoint, %CulturalAmenities, %Historic and %Religious. 3. **Bottom-tier features**. These activity features are OSM tags represented as leaves of the activity tree. They are %tourism, museum, %amenity_arts_centre and %tourism_gallery. 4. **Other features related to the activity tree**. In the analysis it was found out that the OSM tag _{tourism, artwork}_ was quite popular in our data set, but we did not know what type of artwork was being experienced. Thus, it was decided to break down this tag into several features that represent the type of artwork, using other tags associated with the POIs. These features are %artwork_type_sculpture, %artwork_type_architecture, %artwork_type_statue and %other_artwork. The last one represents cases of undetermined type or works of art that do not belong to the other three types. Figure 4 shows the 24 activity features and the percentages of users that visited them in Barcelona (according to the content and the location of their tweets). It may be seen that the top categories were RecreationFacilities, Religious, Historic and Food, followed by Museums and Accommodation. * _Travel features_. These features are related to the travel habits of the user. Concretely, they contain information on the durations of trips to Barcelona and the degrees of mobility within the city. They are the following: 1. **Length of stay**. It is the maximum number of consecutive days in which the user posted tweets from Barcelona. Figure 4: Activity features by percentages of users. 2. **Tweet distance maximum and average features**. Twtdistance_max and Twtdistance_avg are the maximum and average distances between the locations of the tweets of the user in Barcelona. They constitute contextual information on the user's ability to explore the city. * _Popularity features_: These features represent the interest of the user in visiting the most well-known and popular POIs. In order to obtain a popularity order, the POIs were rated according to the numbers of users in the database that had visited them. Popularity is split into five features. The first four (%top10_tweets, %top10-20_tweets, %top20-50_tweets and %top50-100_tweets) are the percentages of tweets of the user from POIs in positions 1-10, 10-20, 20-50 and 50-100 of the ranking.