# Data Analysis, Simulation and Visualization for Environmentally Safe Maritime Data
## 5 Experimental Evaluation
### Measuring Clustering Validation  
Clustering is used for the analysis of data because knowing how many and which of the areas are dangerous in advance is not feasible. Moreover, allowing for human intervention for the classification of danger in each area is not practical due to the tremendous laboring effort it would require. It is the task of clustering to organize a set of objects in such a way that objects in the same group (called a cluster) are more similar to each other than to those in other groups. In order to find the most appropriate clustering method, three well known and theoretically different algorithms were benchmarked, such as k-Means [21], Expectation Maximization (EM) [22]  
Figure 12: A fragment of the trained Bayesian network. and DBSCAN [23]. The first algorithm is based on clustering by using the most representative object of a cluster, that is a centroid, the second algorithm uses data distributions in an iterative manner for the separation of clusters, while the latter makes use of the density of the data set. In density-based clustering, clusters are defined as areas of higher density than the remainder of the data set. Objects in these sparse areas - that are required to separate clusters - are usually considered to be noise. The first issue we had to deal with is the optimal number of clusters to be concerned. In solutions such as K-means and EM, this parameter is needed as input. A good way to find that number, is to consider various values and then for each clustering solution returned by each algorithm to estimate the sum of squared error (SSE), given by the following formula:  
\[SSE=\sum_{i=1}^{k}\sum_{x\in C_{i}}dist(c_{i},x)^{2}\]  
where \(C_{i}\) is the \(i\)-th cluster and \(c_{i}\) (in lower case) represents the centroid of \(C_{i}\). By plotting the SSE of the k-Means algorithm against different values for k (k = number of clusters to be found) the optimal k lies at the point where the curve makes an immediate slope. As one could notice by examining Figure 13, this phenomenon occurred for k = 10, therefore this was the initial solution. However, when discussing with two domain experts from the Greek Ports Association, it was decided that this should change to a lower value, since having so many danger level intervals is not user-friendly, especially at the visualization phase. Similar behavior was observed for the EM as well. Given that the ground truth labels are not known, evaluation must be performed using the model itself. The criteria for comparing the results of all three algorithms are the density of each cluster and the Silhouette Coefficient [24; 25]. For density, the Euclidean distance was used as distance metric. The lower the value of density is, the more similar the components to each other are and thus, the more compact a cluster is. \[Performance_{of_{clustering}}=\frac{\sum_{j=1}^{n}\sqrt{\sum_{i=1}^{m}p_{j|a_{i}}-p_{( j+1)_{ai}}}}{n*(n-1)}\]  
where \(n\) denotes the number of points of a dataset, \(m\) is the number of clusters and \(p_{j|a_{i}}\) is a specific point \(j\) from the total points \(n\) belonging to a given cluster \(ai\) from the total number of clusters \(m\). Figure 13: Sum of squared error (SSE) versus number of clusters. According to the above formula, the Euclidean distance is calculated between points using all of their features and the average of all of distances is returned. Afterwards, it is multiplied by the number of elements of the cluster minus one and the resulting number represents the performance of each clustering method. To calculate the total performance of an algorithm the performance of each cluster is summed by weighting the number of components that are contained in each cluster and divided by the total number of components. \[Total\_Performance=\frac{\sum_{i=1}^{n}Performance\_of\_cluster_{i}*components\_of \_cluster_{i}}{total\_number\_of\_components}\]  
As regards to the latter performance metric, a higher Silhouette Coefficient score relates to a model with better-defined clusters.