## 3 Data and Methodology
### Nightlife Areas Identification Process  
The main objective of the work is to identify the nightlife areas in Lisbon. This identification is not straightforward, because nightlife areas do not necessarily contain nightlife establishments in them. For this purpose, at first, patterns in the number of mobile phones inside the grids containing a high number of nightlife establishments were identified, and then other grids that follow similar patterns were also labeled as nightlife areas. Both supervised and unsupervised learning methodologies were considered to find the nightlife areas. However, since the data were not annotated, we opted for an approach based on unsupervised learning, which was ultimately chosen due to the characteristics of the problem. The decision to opt for the unsupervised learning methodology was driven by its inherent advantages in the context of identifying nightlife areas. Unsupervised learning excels when dealing with unstructured data and patterns that may not be readily apparent. In the case of nightlife areas, where patterns may be dynamic and not clearly defined,unsupervised learning allows the algorithm to discover latent structures and relationships within the data autonomously. This autonomy is particularly beneficial when the characteristics of the problem are nuanced, or when there are a lack of labeled training data. Therefore, the versatility and adaptability of unsupervised learning make it a preferable choice for uncovering complex patterns in the context of identifying nightlife areas. Initially, experiments were carried out in order to find the unsupervised learning method that provided the best results for this work. After analyzing different clustering methods, and taking into account our end goal, as well as the data structure and size, a search was made for an efficient algorithm that is able to correctly identify nightlife areas based on our needs. Compared to the performance of traditional cluster analysis, self-organizing maps and the fuzzy C-means method for strategic grouping, the self-organizing maps (SOM) algorithm was demonstrated to be the most adequate for the task. The SOM algorithm, also known as Kohonen neural network, allows the mapping of data patterns [19]. The nightlife areas of the city of Lisbon were identified using this method in this work. Being a clustering algorithm, it identifies areas with similarities and groups them together. Given the many possible target variables of the clustering, such as the number of entries (C5) or exits (C6) in the grid, the number of mobile phones that remained (C3) and the total number of distinct mobile phones in the grid (C1), experiments were carried out in order to find the best one. Ultimately, C1 provided the best results. Having chosen the clustering technique and the target variable, the identification of the nightlife areas could begin. The methodology proceeded as follows:  
1. Isolate the C1 variable in all periods from Friday to Saturday;
2. Perform the clustering on the resulting time series;
3. Calculate the ratio between the number of nightlife establishments present in each cluster and the number of grids that belong to it;
4. Starting with the cluster with the largest ratio, and working downward, add the grids belonging to the list of nightlife areas;
5. Stop when an arbitrary predefined number of nightlife establishments are contained in the list of nightlife areas. Around 150,000 time series were obtained as a result of isolating the periods from Friday to Saturday in 2022. The choice of clustering these periods, instead of the whole week, was driven by the necessity of identifying similar patterns in the nightlife periods. The SOM algorithm ended up identifying 400 clusters in which people's movement patterns were similar. From these, 22 were selected. In total, 161 grids were identified as nightlife areas, where 314 of the 511 original establishments are contained. Figure 2 shows the location of these areas. In all maps presented in this paper, the north direction is oriented upwards.