## 3 Methodology
### Feature Engineering and Data Clustering  
In order to cluster the users, each of them was represented by a numerical vector of features, which represents their interests and travel habits. Four types of features were considered:  
* Activity interest features (251): these features represent different levels in the activity tree, which were chosen to show the categories more represented in the dataset. All tweets published by a user are assigned to activity categories as described in Section 3.1. The ratio of tweets in the highlighted activity interest features (Routes, Sports, Accommodation, Transportation, Nature, Food, Enotourism, AmusementParks, RecreationFacilities, Beach, Health&Care, NightLife, Shopping, Viewpoint, CulturalAmenities, Historic, Religious, Events, tourism_museum, amenity_arts_center, tourism_gallery, artwork_type_sculpture, artwork_type_architecture, artwork_type_statue, and other_ artwork.) to the total number of tweets published by the user is taken to represent the user's degree of interest in those activities. They are in the range [0, 1]. * Travel features (3): these features give an idea of the degree of mobility of the user inside the city. They encode the length of the stay of the user in Barcelona (maximum consecutive days that the user sent tweets from this city), and the maximum and average distances between the location of published tweets. These values are computed by counting the days the user published tweets in Barcelona, eliminating gaps to find the maximum stretch of days with published tweets. They are normalized in the range [0, 1]. \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} Source: Authors, from a previous work [39].  
\end{table} 
Table 1: Dataset summary. * Popularity features (5): these features show if the user is interested in the most popular places or if he/she prefers to visit places off the beaten track. They represent the percentage of tweets sent from the user from the top 10 most visited locations in Barcelona, the top 10-20, the top 20-50, the top 50-100, or from other POIs. These top visited locations are ranked by number of user visits in the dataset, and split into bins 1-10, 20-50, 50-100, and the rest (each bin represents a feature in this category). Then, the ratio of a user's tweets in each bin to his/her total number of tweets is used to represent the user in these features. They are in the range [0, 1]. * Temporal features (4): these features give an idea on the time of the day in which the user prefers to tour. They represent the percentages of tweets sent from the user at dawn (12:00 a.m.-7:00 a.m.), morning (7:00 a.m.-12:00 p.m.), afternoon (12:00 p.m.-8:00 p.m.), or night (8:00 p.m.-12:00 a.m.). As in the popularity features, bins are created to represent different time periods in the day (each bin represents a feature in this category). Then, the ratio of a user's tweets in each bin to his/her total number of tweets is used to represent the user in these features. They are in the range [0, 1]. Thus, each of the 6066 users was represented by a vector of 37 numbers, which codifies his/her leisure interests, moving ability, interest in popular places, and the preferred period of the day for visiting points of interest. All features were standardized using the _Z-score_ scaler, and the k-means clustering algorithm was used to cluster this dataset into 25 clusters (this number was empirically decided after some experiments). Five of the 25 clusters had less than 50 users, so they were not considered to be very relevant, and they were dismissed from the posterior mobility analysis. Thus, at the end of the clustering process, there were 20 clusters with a minimum of 50 visitors.