# Territorial Development as an Innovation Driver: A Complex Network Approach
## 2 Materials and Methods
### Benchmarking Community Detection against Clustering Methods  
In the previous sections, we have described the data and the complex network methods we used to obtain groups of similar countries in an unsupervised way. Nonetheless, one might question the use of complex networks to model elements, such as countries in the StartupBlink ranking, represented by numerical features (WDIs) that do not describe proper interactions among them. In fact, clustering methods have been developed to find groups (or _clusters_) of similar objects in a set, representing data associated with each object as points in a multidimensional space. In order to show the advantage of the network model even with this kind of data, we applied different classical clustering algorithms, comparing their performances to those of the network methods based on community detection. We considered three of the most relevant algorithms in clustering problems: K-means, K-medoids and hierarchical clustering. K-means is one of the most popular clustering algorithms and is widely used in both academic and industrial settings [58]. This algorithm can be seen as an optimization problem, in which the target is minimization, through an iterative process, of the _sum of squared errors (SSE)_, determined by using the Euclidean distance among points:  
\[SSE=\sum_{j=1}^{k}\sum_{i\in S_{j}}\|x_{i}-\mu_{j}\|^{2}; \tag{2}\]  
where \(i=1,\ldots,n\) identifies the objects, \(k\) is the number of clusters, \(S_{j}\) is the \(j\)-th cluster, \(x_{i}\) is the data vector corresponding to the \(i\)-th object, \(\mu_{j}\) is the centroid of the \(j\)-th cluster and \(\|\ldots\|\) denotes the Euclidean norm. It should be noted that K-means has two drawbacks:  
* It is a stochastic algorithm, in which different runs generally provide different clustering results;
* The number of clusters, \(k\), should be fixed a priori. To tackle the first issue, we performed 100 different runs of K-means to check the statistical robustness of the minimization process. Concerning the second issue, the optimal number of clusters can be determined by considering the SSE and the _mean Silhouette score_[59] together. The latter is a measure of the clustering quality based on averaging over all objects the _Silhouette score_, defined for a given data vector \(x_{i}\) as  
\[s_{i}=\frac{b_{i}-a_{i}}{max(b_{i},a_{i})}, \tag{3}\]where \(a_{i}\) is the average distance between \(x_{i}\) and all other points in the same cluster (_cluster cohesion_), while \(b_{i}\) is the average distance between \(x_{i}\) and all points in the nearest cluster (_cluster separation_). The optimal number of clusters should coincide with the _elbow point_ of the SSE vs \(k\) curve [60] and, at the same time, with the maximum of the mean Silhouette score. If these two conditions are not satisfied together, one can conclude that K-means is not well suited for clustering the considered data. The same reasoning on the clustering quality applies to K-medoids, an algorithm similar to K-means, in which actual data points, instead of centroids, are chosen as cluster centers. K-medoids can be used with arbitrary distances [61]; hence, we considered three common metrics to calculate SSE and mean Silhouette score: Euclidean, Cosine and Manhattan. Hierarchical clustering algorithms take an alternative approach to group similar items [62], which entails the advantage of not needing to fix the number of clusters. In this work, we implemented an algorithm that starts with each data point considered as an individual cluster and iteratively merges the closest pairs of clusters until it ends up with a single cluster encompassing all data points. In order to avoid the effect of outliers and putting all points in clusters on a same ground, average linkage was applied: namely, cluster pairs were merged based on the minimum average distances between all group members in the two clusters. Additionally, in this case, we considered three metrics to calculate distances among clusters: Euclidean, Cosine and Manhattan.