# Clustering Algorithm with a Greedy Agglomerative Heuristic and Special Distance Measures
## 1 Introduction
[11], a heuristic-based algorithm to improve the initial seeding of the k-means clustering described is implemented, where a hybrid approach with a genetic algorithm and the differential evolution heuristic is used. Detailed overviews of the existing initialization approaches may be found in Refs. [12; 13; 14]. The Kohonen neural network [15] of the vector quantization type is an autoassociation closely related to k-means. This competitive network can be related to unsupervised learning. The Kohonen learning law is an algorithm that finds the centroid (called \"codebook vector\") closest to each training case and moves the winning centroid closer to the training case. Another type of Kohonen network is the self-organizing map competitive network that provides a topological mapping from the input space to the clusters. Kohonen networks are used in many fields of interest, such as speech recognition [16; 17], image compression [18; 19], image segmentation [20], face recognition [21; 22; 23], classification of weather patterns [24], malware detection [25], seasonal sales planning [26], medical decision-making [27; 28], e-learning recommendations [29], denial of service attack defense detection [30], groundwater quality assessment [31], exploration of the investment patterns [32] and others. Greedy agglomerative heuristic procedures [33; 34] are tools to improve a result in a certain neighborhood of the solution. An agglomerative procedure starts with some solution \(S\) containing an excessive number of centroids and sequentially removes them. The elements of the clusters, related to the removed centroids, are redistributed among the remaining clusters. The greedy strategies are used to decide which clusters are most similar to be merged together at each iteration of the agglomerative procedure. For subsequent iterations, the chosen method is that which gave the best increase in the objective function in the previous iterations. The practice of solving NP-hard problems shows the efficiency of the transition from randomized recombination procedures to the search for the best recombination method [35]. The authors in Ref. [36] proposed methods of greedy agglomerative heuristics based on the location theory models. Algorithms using these methods are often randomized, but the results are quite stable. The method of greedy agglomerative heuristics uses evolutionary algorithms as one of the ways to organize a global search. To date, the vast majority of the algorithms developed for continuous location problems use the most common distance measures (Euclidean, Manhattan). However, taking into account the characteristics of the feature space of a specific practical problem, the choice of a distance measure can lead to an increase in the accuracy of clustering. For instance, Itakura-Saito distance was used to build the learning vector quantization algorithm. In Ref. [19], a method is proposed for using the Mahalanobis distance as the basis for grouping. The Mahalanobis distance was also used to cluster incoming data into neural nodes in a self-organizing incremental neural network [22]. Kohonen networks with graph-based augmented metrics are presented in Ref. [37]. In Ref. [38], a distance measure for a self-organizing map is defined based on data distribution, and it is calculated with the use of an energy function. A distance metric learning method is often applied. For instance, in Ref. [22], the Mahalanobis matrix is computed, which assures small distances between the nearest neighbor points from the same class and the separation of points belonging to different classes by a large margin. Metric learning for the SOM based on the adaptive subspaces is represented in Ref. [39]. [PERSON] [40] offers a nonlinear metrics learning method. The authors in Ref. [41] use an ensemble approach to metric learning with objective function generalization. [PERSON] and [PERSON] [42] propose a co-training approach, which collapses the objective function, thereby avoiding undesirable local optima.