Full text
Station Segmentation of Lisbon bicycle sharing system based on users demand and supply Marisa Martinho Fernandes Project work presented as the partial requirement for obtaining a Master's degree in Information Management
NOVA Information Management School Instituto Superior de Estatística e Gestão de Informação Universidade Nova de Lisboa STATION SEGMENTATION OF LISBON BICYCLE SHARING SYSTEM BASED ON USERS DEMAND AND SUPPLY Marisa Martinho Fernandes Project Work presented as the partial requirement for obtaining a Master's degree in Information Management, Specialization in Knowledge Management and Business Intelligence Advisor: Mauro Castelli January 2021
iii ACKNOWLEDGEMENTS I would like to thank everyone that crossed my path during my academic life and contributed to enrich my life and to my personal and academic growth. A warm thank you to my family, in special to my parents that supported me in this journey and worked hard all their lives to make sure that I had the opportunity to educate myself and pursuit for a better and prosperous future for me. A huge thank you to Mauro Castelli that tirelessly supported me throughout my master thesis, without him to achieving this mark on my life would have been much more difficult. All my friends that kept on offering me all the support that I need and kept on reminding me that I was almost there, a big thank you followed by a big hug, without you this journey would have been lonelier. At last, but not least, an enormous thank you to myself for keeping on this project while working, for not stopping believing that it was possible though difficult, for not accepting the tempting thought of “I can leave it for the next year”, for keeping determinedly faithful to my ambition.
iv Everyone thinks of changing the world, but no one thinks of changing himself. Leo Tolstoy
v ABSTRACT Bike-sharing systems are well known in the sustainable mobility field and have several aspects that need optimization and improvement. One of the most relevant aspects is station segmentation based on user demand and supply, and it is the focus of the thesis. The segmentation work has an enormous potential to reduce complexity in predicting the bicycle demand and supply, thus improving the overall quality of service. Several machine learning algorithms were used to investigate the aforementioned segmentation task. This work considers two popular and well-known clustering algorithms to extract and analyze interesting patterns, like the difference between arrivals and departures throughout time and stations: the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) and the hierarchical clustering. The algorithms are applied to the specific case of GIRA, the bicycle sharing system (BSS) of the city of Lisbon. The obtained results suggest that considering the variables under analysis, the optimal number of clusters to be used in a second phase of the BSS optimization (demand and supply forecast) is the same as the number of stations in the Lisbon BSS. The results are very insightful and allow future work to focus either on the demand forecast or the enrichment of the variables under study. KEYWORDS Machine learning; Timeseries segmentation; Bike-sharing systems; Sustainable mobility
vi Index 1. Introduction .................................................................................................................. 1 2. Related work ................................................................................................................. 3 3. Data understanding ...................................................................................................... 6 4. Pre-processing .............................................................................................................. 8 4.1. Data cleaning ......................................................................................................... 8 4.2. Data integration................................................................................................... 10 4.3. Data Reduction .................................................................................................... 11 4.4. Data Transformation ........................................................................................... 12 5. Bike Stations dimensionality reduction ...................................................................... 13 5.1. Unsupervised learning vs Supervised learning .................................................... 13 5.1.1. Unsupervised learning .................................................................................. 13 5.1.2. Supervised learning ...................................................................................... 13 5.2. Unsupervised learning applied to time series ..................................................... 13 5.3. Distance measure ................................................................................................ 14 5.4. Algorithms for unsupervised learning ................................................................. 15 5.4.1. Hierarchical Clustering ................................................................................. 15 5.4.2. Density-based spatial clustering of applications with noise (DBSCAN) ....... 16 5.5. Measuring cluster quality .................................................................................... 17 5.5.1. Intrinsic evaluation methods ........................................................................ 18 6. Results, conclusion and future work .......................................................................... 19 7. Bibliography ................................................................................................................ 22
vii LIST OF TABLES Table 1 - Bicycle station file - information ................................................................................. 6 Table 2 - Bicycle trips file - information ..................................................................................... 6 Table 3 - Incoherence example 1 ............................................................................................... 9 Table 4 - Incoherence example 2 ............................................................................................... 9 Table 5 - Incoherence example 3 ............................................................................................. 10 Table 6 - Incoherence example 4 ............................................................................................. 10 Table 7 - New features information ......................................................................................... 11 Table 8 - Differences between unsupervised and supervised learning (Jones, Johnston, & Kruger, 2019) .................................................................................................................... 13 Table 9 - Calculations of the DTW distance between time series a and b (Izakian, Pedrycz, & Jamal, 2015) ..................................................................................................................... 15 Table 10 - DBSCAN algorithm (Chauhan, 2020) ....................................................................... 17 Table 11 - Time series clustering results .................................................................................. 20
viii LIST OF ABBREVIATIONS AND ACRONYMS PCA Principal Component Analysis IST Instituto Superior Técnico DTW Dynamic Time Warping BSS Bicycle Sharing Systems FFBSS Free-Floating Bicycle Sharing System SBRP Static Bicycle Repositioning System DBRP Dynamic Bicycle Repositioning System ANN Artificial Neural Network DBSCAN Density-based spatial clustering of applications with noise
1 1. INTRODUCTION A bicycle sharing system (BSS) can be defined as a network of bicycles spread in a city, available to users. A user can take a bicycle at the starting point, drive it until the destination point and leave the bicycle where the trip finished, moment in which the bicycle will become available to other users. Bicycle sharing systems gained popularity in recent years and became a popular service in major cities. The first BSS world-wide was introduced in Amsterdam in 1965 (Shaheen, 2012) and the bicycles were unlocked and placed around the city. The next BSSs went through some changes and challenges: some of them were paid, and some have suffered from theft or even vandalism. Throughout the years, BSSs became more popular around the world and by the beginning of April of 2020 there were 2102 cities with BSS, with approximately 17866900 self-service public use bicycles and electric assisted bicycles. (DeMaio & DesJardins, s.d.). Cities are characterized by an agitated life, traffic congestion, long waiting times between public transports connections, and bad air quality. BSSs can be seen as a way of counteracting or minimizing some of these issues. In Albiński and coauthors (Albiński, Fontaine, & Minner, 2018) work, a BSS is presented as a good alternative transport mode with respect to the existent ones (train, tram, metro and bus). In fact, if the city has a well-structured bicycle infrastructure, riding a bicycle can be the fastest way to go from one place to another and, as a consequence, a time-saving alternative. Besides that, it has a positive impact on user’s health due to the exercise done by riding a bike. Moreover, the reduction of greenhouse gas emissions is also a factor that contributes for the BSS adoption and its increasing popularity. Forma and coauthors (Forma, Raviv, & Tzur, 2015) and Shui and coauthors (Shui & Szeto, 2018) pointed out that BSS is an environmentally friendly option and it can complement the public transportation. This study uses machine learning techniques to cluster docking stations with similar demand and offer behaviors, taking into account the BSS of Lisbon. The city made available a BSS in 2017 with the project GIRA, and by September of 2019 it counted with 81 stations and around 600 (both casual and electric) shared bicycles. There are two types of BSS: the so-called traditional BSS, which is characterized by having the bicycles associated to a docking station and the free-floating BSS (FFBSS) in which there is not a fixed place for each bicycle and the bicycles free-float around the city (Liu, Szeto, & Ho, 2018). The BSS of Lisbon is a traditional BSS. In the context of a traditional BSS, each journey typically starts from a specific docking-station, finishes in another, and the user does not need to return to the initial station. This type of behavior contributes to empty and full stations. It is important to note the BSSs are efficient when stations are balanced (not empty or full). Therefore, unbalanced stations lead to inefficiency in BSS which also leads to unsatisfied users and, consequently, to a potential loss of users. (Dell'Amico, Iori, Novellani, & Subramanian, 2018) The unbalanced station is also a problem in the context of the GIRA project that will be addressed in this work. There are two common approaches to minimize the problem of unbalanced BSS, being the first user-based and the second truck-based. The user-based approach is usually less costly than the latter, but it rarely solves the problem by itself. In particular, the user-based approach gives a reward/incentive to users that start a trip in stations with an excess of bicycles and to the users that end a trip in stations with a deficit of bicycles. The truck-based approach addresses the problem by
8 4. PRE-PROCESSING This chapter will explore one of the most time consuming and also one of the most important tasks for the success of the algorithm’s results. (Kamber, Han, & Pei, 2011) The approach taken in this chapter was guided by (Witten, Pal, Hall, & Frank, 2016). The authors of the book split pre-processing step into 4 major categories: 1. Data cleaning routines are applied to have clean the data. Those routines are put in practice through: filling missing values; smoothing noisy data; removing outliers and identifying and resolving inconsistencies or incoherences. 2. Data Integration is used when there is the need or the possibility to get more data from another data source. Getting more data, will very likely enrich the explanability of the phenomena under analysis. Data integration is not all roses, it is common that with it, redundancies, noise and inconsistencies will rise. Therefore, it’s important that this step is explored along side with data cleaning. 3. Data Reduction goal is to have a dataset with less variables but with the same or almost the same explanability of the phenomena. There are some techniques that can be used and fall under data reduction step, such as: dimensionality reduction techniques (e.g., PCA, factor analysis, forward feature selection, etc.), feature subset selection (e.g., irrelevant or redundant features) or feature creation (e.g., creation of new features that summarize others such as creating the variable duration instead of having date start and data end). 4. Data Transformation step is responsible for transforming data (if needed) into a state that will make the modeling process mode efficient. This process includes several possible techniques, such as: feature construction (e.g., creation of new features from existing ones), aggregation (e.g., aggregate data by datetime every 10 minutes instead of having data to the second), normalization (e.g., scale features to a smaller range) or discretization (e.g., convert or partition continuous values into intervals or into new features). 4.1. DATA CLEANING This sub-chapter will go deeper in how the first step of pre-processing, the data cleaning, was applied in the context of this study. The steps taken will be described alongside with some specific example to a better understanding of the work done: Resolve incoherencies 1) As it was mentioned in Data understanding chapter, the columns “id_expl”, “id_planeamento” and “desig_comercial” (the numbers in the beginning) reference the same value, the station number. Therefore, those were checked against each other to make sure that its values were correct. In the majority of the cases, the values were coherent, in the remaining cases where the values were not coherent, the data was corrected having the “desig_comercial” number has a decision maker. For example, as it can be seen in Table 3, the id_expl and
9 id_planeamento are the same but the design_comercial isn’t. As the desig_comercial has prevalence over the others, the records in question were corrected to 103. Table 3 - Incoherence example 1 Id_expl Id_planeamento desig_comercial 1 1 103-Jardim da Água 2) The second case of incoherencies verified is the verification of the “desig_comercial” values. The stations names were analyzed, and some irregularities were noticed under the following cases categorization: a. The id was the same, but the name was slightly different. b. The name was the same, but the id was different (typically sequential, e.g., 224 and 225). c. There was no name, only id. In order to resolve these cases, the website (https://www.gira-bicicletasdelisboa.pt/descobreas-estacoes/ ) where resides the official map with all the stations in Gira’s network was taken under consideration and observation. Regarding case a), the station names were corrected to the official name (the name present in the official website). The cases observed can be seen in Table 4. Table 4 - Incoherence example 2 Desig_comercial-1 Desig_comercial-2 Desig_comercial-decision 488 - Rua Fernando Namora N35 / Rua António Quadro 488 - Rua Fernando Namora n35 / Rua António Quadro 488 – Rua Fernando Namora / Rua António Quadros 410 - Rua da Mesquita / Rua Dr. Júlio Dantas 410 - Rua da Mesquita /Universidade Nova de Lisboa 410 - Rua da Mesquita /Universidade Nova de Lisboa Regarding case b), the two cases identified were correct, meaning that there were two stations with the same name. The cases observed can be seen in Table 5.
10 Table 5 - Incoherence example 3 Desig_comercial-1 Desig_comercial-2 224 - Martim Moniz 225 - Martim Moniz 307 - Marquês de Pombal Rua Dr. Júlio Dantas 308 - Marquês de Pombal Regarding case c), the decision made was simply assigning the official name to the ones that were missing it. The example can be seen in Table 6Error! Reference source not found. Table 6 - Incoherence example 4 Desig_comercial-1 Desig_comercial-2 Desig_comercial-decision 303 303 - Avenida da Liberdade / Rua das Pretas 303 - Avenida da Liberdade / Rua das Pretas Remove noisy data Regarding removing or not considering certain data, the columns “estado” specifies if the station is active, in repair or in stock. Only the records associated with the “estado” in stock or in repair were removed from the dataset. That choice was made, based on the fact that the phenomena under analysis only studies the stations that are active and by consequent have trips associated. 4.2. DATA INTEGRATION Data integration chapter will go through the taken steps in order to get more features that can explain the phenomena under analysis. Through those steps, data from 3 different external sources were used: 1) Portuguese holidays website: from this website, it was possible to gather all the official Portuguese holidays for the 2018 year and further convert those into a python dictionary. 2) Instituto Superior Técnico weather station API: IST has a free API with weather data, based on a weather station located in Alameda. In this case, Alameda was considered representative of the city of Lisbon has a weather proxy. The data collected from this API contains hourly data. 3) Sunrise and sunset API: In order to have the data needed to further understand when it was daylight or not, data regarding the sunset and sunrise time in the city of Lisbon was collected. The data is a datetime with detail until the second.
11 Table 7 - New features information Variable Description Source Sunset time Containing the datetime (until seconds) of sunset and sunrise for each day https://sunrise-sunset.org/api Sunrise time Portuguese holidays Contains all official holidays. https://www.calendarr.com/portugal/calendario- 2018/ Total precipitation How many millimeters of rain http://meteo2-ciist.ist.utl.pt:8080/api Atmospheric pressure Atmospheric pressure in milibars Solar radiation Solar radiation in watts per square Relative humidity Percentage of humidity Temperature Temperature in Celsius degrees Wind direction Degrees of wind direction Wind gust How strong is the wind gust in meters per second Wind speed The wind speed in meters per second 4.3. DATA REDUCTION This chapter will explain what was done in terms of data reduction. As it was explained in Preprocessing, there are three major set of actions that usually are performed, from which only two were used: 1) Feature subset selection: Some features were no longer considered due to the fact that either they didn’t add information that wasn’t already in other variables, or they didn’t have complete information in order to be used. The cases were: a. “id_expl” and “id_planeamento” since their information is already in “desig_comercial” b. “estado” because the dataset will only have records with “estado” to active, so it wouldn’t add new information.
12 c. “tipo_servico_niveis” because in the file that has information from stations, this column has incomplete information, or in other words, the data in this column is not sufficient or conclusive about how many electrical bicycles or normal ones are in the station at each time. Therefore, to assure quality of the data, it can’t be used. d. “bike_rfid”, “geom”, “num_vertices” are geographical variables. Since in this study, the geographical dimension won’t be considered, these variables won’t apply. e. “id”, since it is only a unique number for each trip and won’t add relevant information. f. “distance”, this feature is also incomplete, more than 49% of the dataset has null values. Since it’s not a good approach to interpolate 49% of the data, the feature was removed from the analysis. 2) Feature creation a. A variable called “duracao_min” was created, which is a product of the difference between the date start and the date end. Instead of 2 features we now have 1 with the same information. 4.4. DATA TRANSFORMATION In this chapter all the transformations in the data will be explained. The transformations were made into three major types: a) Binary transformation was used in the case of the holidays and daylight variables. In the holidays case, now that variable has value 1 if it was holiday in Portugal and 0 if it wasn’t. In the daylight case, from the sunset and sunrise datetimes, now the variable has also binary values, 1 if it was daylight and 0 if it wasn’t. b) Aggregation was used for the time dimension. The decision of aggregating the time dimension into bins of 20 minutes was made because of 2 reasons, first the periodicity of the data was inconsistent (1 second, 2 minutes, 5 minutes, etc.), second in terms of the study scope, the bike sharing rebalancing proposal won’t be made every second, so the decision of 20 minutes periodicity was made based on the already mentioned paper. (Regue & Recker, 2014) c) New features created fall into two types: time related and number of bikes related. The time related ones are variables telling (trip wise) the hour, minute and if it was a weekday or not. The number of bikes related ones, are the number of bicycles present in the station 1, 24 and 168 hours before (1 hour, 1 day and 1 week, respectively).
13 5. BIKE STATIONS DIMENSIONALITY REDUCTION 5.1. UNSUPERVISED LEARNING VS SUPERVISED LEARNING Supervised learning and unsupervised learning are two machine learning tasks that are commonly employed for addressing different kinds of problems and have some main differences (Jones, Johnston, & Kruger, 2019) Table 8 - Differences between unsupervised and supervised learning (Jones, Johnston, & Kruger, 2019) Unsupervised learning Supervised learning No labels provided Labels provided Finds structure in unlabeled data Finds patterns in existing structure Uses techniques such as clustering or dimensionality reduction Uses techniques such as regression or classification 5.1.1. Unsupervised learning Unsupervised learning is used when the target value of each observation is unknown and the input data is the only available information. This type of learning task is commonly used for identifying groups of similar observations: this process is particularly helpful when trying to find the meaning in the data, assign the observations to similar groups or reduce dimensionality. 5.1.2. Supervised learning Supervised learning is used to solve problems where the target value of each observation is known, so this information can be used to either classify (e.g. predicting if a person will has tendency to be an alcoholic or not based on theirs brain cells activity) or fit a regression (e.g. predicting the price of a personal computer based on how much memory and processing capacity it has). 5.2. UNSUPERVISED LEARNING APPLIED TO TIME SERIES As outlined in the work of Reddy and Aggarwal, time-series segmentation can have two main formulations, which strongly depend on the problem taken into account (Reddy & Aggarwal, 2013). If the problem consists of finding sets of time series with similar trends, we have a correlation-based online clustering problem. On the other hand, if the problem consists of time series with similar shapes, we have a shape-based off-line clustering problem. Correlation-based online clustering: This formulation is commonly used in cases of financial markets domain for identifying groups of stocks that have similar trends or correlated trends. Shape-based off-line clustering: Conversely to the previous explained formulation, in the shape-based formulation, the time series are evaluated and clustered off-line. This formulation is used in the cases in which the objective is to find time series with similar shapes. The biggest challenge and most
14 determinate aspect of grouping based on shapes is the definition of how to measure similarity in the shapes. Depending on the problem being solved, there are several good similarity functions, such as Euclidean function or dynamic time wrapping. Having both formulation types for time-series segmentation and knowing that the goal with the segmentation with this work is to find groups of time series (stations) that have similar behaviors, the most suitable formulation is the shape-based off-line clustering. 5.3. DISTANCE MEASURE As explained in the work of Reddy and Aggarwal, when the clustering problem is a timeseries problem the similarity concept and how it is measured is very important to have in consideration. In this section we will go through similarity/distance metrics. As it was mentioned in Section 3.2 and as stated by Izakian and coauthors, “Selecting a distance function to evaluate similarities/dissimilarities of time series has a significant impact on the clustering algorithms and their final results produced by them” (Izakian, Pedrycz, & Jamal, 2015). Due to this significant impact, some well-known and commonly used distance functions will be explained and considered: • Euclidean distance: Considering that the datapoints have n dimensions, this metric that takes the difference of the coordinates between two data points p and q, squares it and sums it. The distance between the two points is given by the square of that sum. 𝑑(𝑝,𝑞)= √(𝑞1−𝑝1)2+(𝑞2−𝑝2 )2 +⋯+(𝑞𝑛−𝑝𝑛)2 • Manhathan distance: Considering that the datapoints have n dimensions, this metric returns sum of the absolute difference among the n coordinates of the data points p and q. The Manhathan distance between two data p and q is formalized as follows: 𝑑(𝑝,𝑞)= ∑|𝑝𝑖−𝑞𝑖 | 𝑛 𝑖=1 Besides the distance metrics just mentioned above, there is an important aspect of this study that will affect the choice of the metric, the fact that the type of observations that compose our dataset are time series. Working with time series brings some concerns with respect to their comparison. For example, two time series can be exactly equal but with a time shift of 2 hours, and if the Euclidean distance is used, the two time-series will appear different to each other, which is not in fact true if we consider the time shift of 2 hours. To address that important aspect and commonly faced problem, dynamic time wrapping is the best distance to deal with that. This measure “determines an optimal match between two time series by stretching or compressing some segments of the series. As a result, patterns occurring at different time instances of time series are considered as similar”. (Izakian, Pedrycz, & Jamal, 2015)
15 DTW faculty to address this problem has a lot to do with the ability to consider time sifts by comparing each point belonging to time series a with any point from time series b. (Izakian, Pedrycz, & Jamal, 2015) DTW algorithm pseudo code can be consulted in Table 9. Table 9 - Calculations of the DTW distance between time series a and b (Izakian, Pedrycz, & Jamal, 2015) Calculations of the DTW distance between time series a and b Given: a = 𝑎1,𝑎2,…𝑎𝑛, the first time series with length n b = b1,𝑏2,…𝑏𝑚, the second time series with length m Output: cost: a matrix of size 𝑛×𝑚 containing the cost values costn,m is the DTW distance between a and b path: a matrix of size 𝑛×𝑚 containing a warping path DTW(a, b): Let δbe a distance between coordinates of sequences cost1,1 = δ(a1; b1); path1,1 = (0,0); for i = 2,3,…, n do cost i,1 = cost i-1,1 + δ(ai , b1) end for j = 2,3,…, m do cost 1,j = cost 1,j-1 + δ(a1 , bj) end for I = 2,3,…, n do for j = 2,3,…, m do costi,j = min (cost i-1,j , cost i,j-1 , cost i-1,j-1 ) + δ(ai ,bj ) pathi,j = min _index(( i – 1, j),( i , j – 1),( i -1 , j – 1)); end end 5.4. ALGORITHMS FOR UNSUPERVISED LEARNING In this chapter, we explore the techniques and some parameters used to solve the bicycle stations clustering problem. 5.4.1. Hierarchical Clustering Hierarchical clustering algorithm has two specifications: The Agglomerative and the divisive. Both follow different approaches to achieve the clusters formation. The usage of one or the other depends
16 on the followed approach. Either the clusters are reached by a bottom-up (merging) or by a top-down (splitting) approach. The interested reader is referred to the works of Reddy and coauthors (Reddy & Aggarwal, 2013) and Kamber and coauthors (Kamber, Han, & Pei, 2011) for a comprehensive overview on these clustering techniques. Agglomerative hierarchical clustering approach: This approach uses a bottom-up strategy, which means that the algorithm starts by considering as many clusters as observations and iteratively merges the closer two clusters (based on a similarity /distance measure). This process is iterated until the algorithm reaches one cluster containing all the observations or until some stopping criteria (typically the number of clusters obtained) is met. Divisive hierarchical clustering approach: This approach uses a top-down strategy, which starts by assigning all the observations to one cluster and iteratively divides the clusters into smaller ones. This process is iterated until the algorithm reaches a number of clusters equal to the number of observations or until some stopping criteria (typically the number of clusters obtained) is met. How agglomerative hierarchical clustering measures the closest two clusters to merge are explained below: Single linkage: The single linkage distance between cluster a and b is the minimum of all distances between points of cluster a and cluster b. Complete linkage: The complete linkage distance between cluster a and b is the maximum of all distances between points of cluster a and cluster b. Average linkage: The average linkage distance between cluster a and b is the average of all distances between points of cluster a and cluster b. 5.4.2. Density-based spatial clustering of applications with noise (DBSCAN) DBSCAN is a clustering algorithm that tries to identify clusters of observations using the fact that the inter-cluster density is higher than the density among the observations that do not belong to the same cluster (Kamber, Han, & Pei, 2011). DBSCAN receives two parameters: 1) Eps: This parameter specifies the maximum distance between itself (point A) and its neighborhood. If the distance between itself and a point B is smaller than eps, point B is considered to be a neighbor of point A. 2) minPts: The minimum number of points that constitute a cluster. For example, if minPts is two, means that for a cluster to be formed needs to have at least two points. DBSCAN categorizes observations into 3 different classes: 1) Core points: are the points that have in their neighborhood (eps) at least the minimum number of points a cluster needs to have (minPts), itself included. 2) Not core points/border points: are the points that do not comply with the rules of the core points. However, they include inside their neighborhood at least 1 core point.
17 3) Noise/Outlier: these are the points that do not comply with either rule. In other words, they are far away from any other core point. Therefore, they are considered outliers or noise. In the following sequence of steps is explained how the algorithm performs in order to identify the clusters: 1. The parameters are determined (eps and minPts) 2. A random point A is selected a. The neighborhood of point A is calculated using eps. b. If there are at least minPts number of points in its neighborhood, point A is categorized as a core point and a cluster is formed with point A and its neighbors. If not, point A is categorized as noise. Table 10 - DBSCAN algorithm (Chauhan, 2020) DBSCAN (D, Eps, MinPts) //All objects in D are unvisited Begin For all objects in D, select A: If A is unvisited: Neigh = Calculate A’s neighborhood N = number of points in Neigh If N +1 >= eps: Classify A as core point Consider all of this points to be part of the same cluster Else: Classify A as noise END 5.5. MEASURING CLUSTER QUALITY There comes a point in which several models must be compared so that the best model for the problem under exam is selected. To select the best performer among the existing models, it is necessary to measure their quality and, subsequently, to compare them. There are several methods to assess clustering quality, that fall in two categories: 1) Extrinsic methods: To use this method, the actual label for each observation must be available. The extrinsic methods compare the labels attributed by the clustering model with the actual labels and measure how accurate the classification was. 2) Intrinsic methods: There is not the need to have the actual label for each observation to use intrinsic methods. This category of methods measures how well the clusters are separated. In the problem considered in this work, the actual label for each observation is not known. Thus, only the intrinsic methods were used to address this problem.
24