## 3 Material and Methods
### Data Clustering Using the Self-Organizing Map  
SOM is a generic methodology, which has been applied in many classical modeling tasks such as clustering, visualization of high-dimensional space, classification, prediction, and many other tasks. Compared with the classic clustering algorithm such as K-means, the nature of SOM makes it less affected by noises, more flexible in case retrieval and has better continuous visualization as a spectrum in a 2D space. K-mans is a linear method, and  
Figure 5: The scatterplots for visualizing the percentage of the segments from all the samples.  
Figure 6: Semantic segmentation for the SVIs, coloring according to the segments.  
a K value should be defined as the number of clusters that are discrete. SOM is optimized based on a 2D network, where each node has a weight value and a coordinate to keep the topology of the network while optimizing. The cases can be retrieved according to one closest node, nodes within a certain radius, or even the furthest nodes because the nodes are topologically connected. Therefore, flexible case retrieval for the search engine can be applied according to various criteria set by users.  
SOM is a general-purpose nonlinear data transformation method that offers solutions for data clustering and 2D visualization as it creates continuous visual patterns on top of high-dimensional data [1]. The node weight value is a high-dimensional number whose dimension is the same as the input feature vectors and is updated by reducing the distance between the node and input data. For calculating the distance between the node and the sample, we use Euclidean distance because it is the most commonly used method, which is the most common metric to calculate the distance between node weights and sample vector. After several iterations, each node is associated with a set of input objects that are closer to this node than the other nodes. This method serves as the clustering process. During the optimization of SOM, the network would be stretched to cover the high-dimensional data space as much as possible. Therefore, the coordinates of the nodes help visualize the SOM in a 2D plane, serving as a dimension-reduction technique that transforms objects with high-dimensional features to a low-dimensional plane while the neighboring relationship remains.  
Two simultaneous processes explain the SOM algorithm. The training data set can be considered as X = \(x_{1}\),..., \(x_{N}\), as a set of \(N\) points in an n-dimensional space. An SOM can be considered as a grid with K nodes, with a set of indices \(y_{j}\), each attached with a high-dimensional weight vector, \(w_{j}\). During the training process, an index \(y_{j}\) can be assigned for each data xi. The index is also called the best-matching unit (BMU). \(s(w_{j},x)\) is a similarity function which is calculated by the inverse of the distance between the input sample feature vectors x and the weight vectors of the SOM node \(j\), \(w_{j}\).  
\[BMU(x)=arg\,max_{j}(f(y_{j}|x)) \tag{1}\]  
\[f(y_{j}|x)=\frac{\exp{s(w_{j},x)}}{\sum_{j=1}^{k}\exp{s(w_{j},x)}} \tag{2}\]  
The weight vectors of the indices, \(w_{j}\), start with an initial value and will be adapted to become similar to their assigned input data and further to be similar in weight vectors to their topological neighborhoodsThe final output of an SOM can be visualized in different ways. One is to represent the pattern among different dimensions, rendering each dimension of the weight vectors in parallel in a new coordinate system. Another common way is to visualize one of the input data that is assigned in the node, since a set of input data is assigned to each node. The assigned data's feature vectors are similar to the weight vectors of the node. We visualize the ray SOM and mask SOM in a 2D plane where each node is shown by a sample that is closest to the node (Figure 8).