Does Determination of Initial Cluster Centroids Improve the Performance of K-Means Clustering Algorithm? Comparison of Three Hybrid Methods by Genetic Algorithm, Minimum Spanning Tree, and Hierarchical Clustering in an Applied Study

Random selection of initial centroids (centers) for clusters is a fundamental defect in K-means clustering algorithm as the algorithm's performance depends on initial centroids and may end up in local optimizations. Various hybrid methods have been introduced to resolve this defect in K-means clustering algorithm. As regards, there are no comparative studies comparing these methods in various aspects, the present paper compared three hybrid methods with K-means clustering algorithm using concepts of genetic algorithm, minimum spanning tree, and hierarchical clustering method. Although these three hybrid methods have received more attention in previous researches, fewer studies have compared their results. Hence, seven quantitative datasets with different characteristics in terms of sample size, number of features, and number of different classes are utilized in present study. Eleven indices of external and internal evaluating index were also considered for comparing the methods. Data indicated that the hybrid methods resulted in higher convergence rate in obtaining the final solution than the ordinary K-means method. Furthermore, the hybrid method with hierarchical clustering algorithm converges to the optimal solution with less iteration than the other two hybrid methods. However, hybrid methods with minimal spanning trees and genetic algorithms may not always or often be more effective than the ordinary K-means method. Therefore, despite the computational complexity, these three hybrid methods have not led to much improvement in the K-means method. However, a simulation study is required to compare the methods and complete the conclusion.


Introduction
Clustering is a branch of unsupervised learning. This method is widely used as a first step to interpret the data. In this method, samples are divided into groups whose members are similar to each other [1]. A good clustering algorithm should be efficient, reliable, and capable to determine relevant clusters [2]. From the four famous crisp clustering branches including distribution-based, density-based, connection-based, and partition-based methods, EM (expectationmaximization) algorithm; DBScan (density-based spatial clustering of applications with noise), hierarchichal, and K-means clustering methods can be pointed out, respectively [1]. Of course, there are other categories in clustering methods such as fuzzy clustering algorithms (such as fuzzy C-means) which are not in the scope of the present research.
K-means clustering is an important and popular technique in data mining. This method is a partition-based clustering algorithm which works with randomly selected points as the initial centroids (centers) at first and then updates these centroids in an iteratively process until some convergence criteria were met. The simplicity of K-means clustering method makes it as a basic and popular method in different fields of research. The most important function of this method is that it works better when the clusters overlap [3]. This method also works with high-volume data. However, the more clusters there are, the more K-means may fail to find all clusters correctly [3]. In addition, the clusters created in this method are spherical and convex. Its performance also depends on the initial centroids of clusters and often ends in the local optimization [3,4]. To solve these problems, different hybrid methods have been proposed . Some of them try to solve K-means problems by different methods [5][6][7][8][9][10][12][13][14][15][16][17][18][19][20], and some others use the simplicity of K -means method to improve the performance of other clustering methods [11,[21][22][23][24]. The present paper evaluated the results of three well-known hybrid K-means methods with minimum spanning tree (MST) [5], genetic algorithm (GA) [6], and hierarchical clustering [7] in different datasets. Genetic algorithm is a good option to solve the local optimization of K-means and will give a proper initial cluster center [25]. Clustering based on MST is known for deriving disordered boundaries and outlier detection [23]. The MST-based clustering techniques have widely been used for efficient clustering [23,24]. The combination of partition-based and hierarchical clustering methods may also strengthen both approaches and discard their disadvantages [7]. Meanwhile, an important task in cluster analysis is evaluating the results of a clustering method or comparing it to another clustering result. Lots of different validity measures have been proposed in the literature [26]. Among these evaluating methods, we applied eleven validity indices (internal, external, and relative) to judge or compare the results of clustering methods. Therefore, the analysis was performed in two phases. In phase I, to investigate whether K-means is a proper clustering method for each dataset, EM, DBScan, hierarchical, and K-means clustering methods were applied at first. Then, three hybrid methods were tested on each data in phase II and compared with the results of phase I.
Accordingly, the organization of this paper is as follows. Ordinary K-means algorithm is briefly reviewed along with three hybrid methods in Section 2. Also, seven internet datasets utilized in present study are introduced there. On Section 3, four ordinary clustering algorithms including K-means, hierarchical, DBScan, and EM algorithms accompanied with three hybrid methods including MST-based, GA-based, and hierarchical-based K-means methods are applied on each dataset, and the results of eleven different external and internal evaluation indices are reported for comparison. Section 4 contains some discussion on comparing these methods.

Materials and Methods
2.1. Materials. All hybrid methods introduced with K-means algorithm in the present paper with different underlying theories help improve this method by eliminating the random selection defects of initial centroids in the K-means clustering method. The nature of these hybrid methods can be influenced by various factors such as number of variables (features) in the dataset, sample size, and even number of labels (number of classes) in the data and exhibit quite different results. Since these hybrid methods in a dataset have not been compared yet, seven web datasets with different features were used in order to investigate the performance of these methods in the present paper. The data consisted of three gene expression datasets relating to leukemia, prostate, and colon cancers, and they were considered as highdimensional data with an expression of more than 20,000 genes and were downloaded from the Gene Expression Omnibus (GEO) database (Table 1). Another four datasets were also well-known standard and appropriate Internet data for clustering methods and have been used in most applied papers to measure the performance of clustering methods (for instances [5,6]). These data are available to all researchers for scientific research in the UCI database (University of California Irvine (UCI): Center for Machine Learning and Intelligent System) ( Table 1).

K-Means
Clustering Method. The basic idea in K -means clustering includes the definition of clusters in a way that total within-cluster variation is minimized. There are many algorithms for K-means clustering method. Mac-Queen algorithm was used in the present paper [27] that defined the total within-cluster variations as the sum of squares of the Euclidean distance between objects and centroids. Let X = fx i g, i = 1, 2, ⋯:, n be the set of nd-dimensional observations (points) to be clustered into a set of K clusters, C = fc k , k = 1, 2, ⋯, Kg. K-means algorithm finds a partition such that the squared error between the center  Computational and Mathematical Methods in Medicine (empirical mean) of a cluster and the points in the cluster is minimized. Let μ k be the mean of clusterc k . The sum of squared error (SSE) between μ k and the points in cluster c k is defined as [28] SSE c k ð Þ = 〠 The goal of K-means is to minimize the sum of the squared error over all K clusters, In general, the algorithmic steps of this method are summarized as follows ( Figure 1): (1) Initial K cluster centroids are selected randomly from the observations (2) Distance between each observation and clusters' centroid is calculated and the observation is assigned to a cluster with minimal distance from the centroid of that cluster 3 Computational and Mathematical Methods in Medicine (MSTs) have been applied in data mining, pattern recognition, and machine learning for a long time [3]. The MSTbased clustering techniques usually lead to efficient clustering [23,24]. Indeed, these hybrid clustering methods can identify clusters of arbitrary shape by removing inconsistent edges and detect clusters of heterogeneous nature. MST-based clustering algorithm was proposed by Zahn [23]. Since then, some studies have been conducted to improve it (such as [5,23,24]). MST is utilized as the preanalysis method to find the initial centroids for K-means algorithm [5].
In graph theory, a dataset can be shown by a complete graph G, so that number of vertices of graph indicates number of points in a dataset. The weight between two vertices is the Euclidean distance between points based on the features (variables) vector.
Tree is an undirected connected graph that does not contain any distance. The spanning tree is a subset of a complete weighted graph in a way that it has all features of a tree and also contains all vertices of a complete weighted graph.
For a complete weighted graph, the minimum spanning tree has the least weight among all spanning trees of that graph. In present study, we followed the idea introduced by Yang et al. [5] and used MST for initializing the K-means clustering algorithm.
Accordingly, the MST-based K-means clustering algorithm applied in present study is as follows [5]: (1) Number of points (n observations) and number of clusters (K) are entered as the input parameters (2) MST is generated using Prim's algorithm  Computational and Mathematical Methods in Medicine (4) Distances between any two skeleton points of S set are calculated (Equation (3)) where v i and v j are the degree of s i and s j , respectively.
(5) The skeleton point s i with the highest degree is selected and entered to the set of initial centroids denoted by C = fs i g Step 6 is repeated until the number of initial cluster centroids is equal to K. Figure 2 describes this process in a flowchart.

Combination of K-Means
Clustering with Genetic Algorithm. The genetic algorithms (GAs) in clustering analysis are usually used to determine the number of clusters automatically and to find initial centroids for K-means clustering  5 Computational and Mathematical Methods in Medicine [16]. Indeed, genetic algorithm is a good option to solve the local minimum problem of K-means [25]. Usually, the simplicity of the K-means algorithm and the ability of the genetic algorithm are combined to provide a GA-based clustering algorithm which has even attracted the attention of researchers in health sciences ( [17][18][19][20][21] for instances).
The genetic algorithm is inspired by the genetic science and Darwin's theory of evolution and is based on the survival of the superiors or natural selection. A common application of genetic algorithms is its use as an optimizer function. Inspired by the evolutionary process of nature, these algorithms solve problems. In other words, they create a population of beings like nature, and reach an optimal set or being by acting on this set. The hybrid method used in the present paper provided a hybrid version of the K-means algorithm with genetic algorithm that effectively solved the problem of random selection of initial centroids. Results of simulation tests confirmed this claim [11]. This algorithm preserved all important properties of the K-means method and is also stronger in data contains outlier. In general, the steps of GA-based K-means clustering algorithm are as follows (see ref. [6] for details): (1) The input parameters are determined including M initial population size (number of chromosomes) and T number of iterations (number of generations) and K number of clusters and operator rates P C , P m , ⋯ (2) M chromosomes are randomly selected to generate the initial population where each chromosome is a set of initial centroids of clusters considering the notion that centroids of each chromosome should not be similarly selected (3) A target function is calculated for each chromosome. Based on the target function, the fitness value is calculated (4) Crossover, selection, and mutation operators are used to generate the next generation (5) If the number of produced generations is less than number of generations that is determined by user, it goes to stage 3 otherwise, it goes to stage 6 (6) The amount of fit is calculated for the last generation per chromosome and compares the optimal amount of fit in this generation with the best fit obtained from previous generations and selects the largest one based on the estimator function (7) Finally, the initial centroids obtained from the best chromosome are used according to stage 2 as the initial centroids in the K-means clustering method (Figure 3)  Compute the centroid of each cluster and set them as initial centers (C)

Combination of K-Means
Apply C set in K-means clustering algorithm Figure 4: Hierarchical-based K-means clustering algoritm. 6 Computational and Mathematical Methods in Medicine determined by the users based on the height that the clusters merge. The weak point of hierarchical clustering is its termination, and the most important problem of K-means is its initiation [7]. Therefore, the combination of these two methods leads to a hybrid method with interesting characteristics. In present study, we apply agglomerative hierarchical clustering algorithm on a dataset at first to get initial information (initial centroids of clusters). Then K-means algorithm is applied.
Steps of hierarchical-based K-means method are summarized as follows [7]: (1) An agglomerative hierarchical clustering method is applied to data and the resulting tree is divided by K cluster (2) Centroid of each cluster (mean clusters) is calculated and set C is created (3) K-means algorithm is performed for the set C as the initial centroids obtained in step 2 Figure 4 summarizes this algorithm through a flowchart.

Validation of Clustering Methods.
To evaluate the results of clustering algorithms, some cluster validation methods are used. These methods prevent the occurrence of random patterns in data and also allow the comparison of different clustering algorithms. A good validity measure should be invariant to the changes of sample size, cluster size, and number of clusters [26]. In general, clustering evaluation indices are classified into three categories: internal, external, and relative. Internal validity indices measure compactness, connectedness, and separation of each cluster while external validity indices measure matching the results of a clustering to the truth (if available) or another clustering method [26]. Relative validity methods in comparison are used to determine the optimal input parameter by changing the values such as the number of clusters in K-means for an instance and also comparing the clustering methods.
Silhouette criterion (Si), Dunn index, and the hybrid index robustness-performance trade-off (RPT) were applied in the present study for internal evaluation. External validity methods can be categorized into pair-counting, information theoretic, and set matching measures. Pair-counting measures (such as rand index (RI) and adjusted rand index (ARI) used in our research) are based on counting the pairs of objects in a dataset on which two different partitions agree or disagree. For instance, if two objects in one cluster in the first partition place also in the same cluster in the second partition, it is considered an agreement [26].
Information theoretic indices such as mutual information (MI) measures the information that two clustering methods share and variation of information (VI) as a simple linear  It should be noted that the optimal number of clusters in the present paper was determined by the majority rule and using three methods including the average silhouette criteria, gap statistics, and elbow; data were standardized prior to any clustering analysis.

Results
To compare the performance of three hybrid methods and ordinary K-means method, seven free downloadable datasets on Internet including "leukemia cancer," "prostate cancer," and "colon cancer" from GEO site and "haberman," "iris," "wine," and "glass" datasets from UCI: Center for Machine Learning and Intelligent System were applied. Table 1 summarizes the description of these datasets.

Computational and Mathematical Methods in Medicine
To decrease the dimension of gene expression datasets and find the important genes (attributes), the result of the article by Ram et al. [29] was used. They selected a subset of three or four genes as the important ones by a feature selection method based on the random forest model. The clustering methods (ordinary or hybrid) were applied to the selected subsets for these four datasets.
It is necessary to mention that these datasets already contain some classes (labels). Ignoring these classes, we obtain the optimal number of clusters (among 2-15 clusters) for each dataset based on the majority rule according to the mean value of silhouette, elbow criterion, and gap statistics.
Then, the data analysis was organized in two phases: 3.1. Phase I. To investigate whether K-means is an appropriate clustering method for each dataset, four ordinary clustering methods including K-means, DBScan, hierarchical, and EM algorithms were applied on datasets at first. The mean value of silhouette and RPT criterion were then used to determine the best method for each data set ( Table 2). The mean value of silhouette near to one and the high value of RPT reveal good clustering. Accordingly, K-means clustering method was the best method for just two out of seven data sets discussed in present study, leukemia and colon cancer datasets. Hierarchal clustering method was the best for prostate and haberman, the DBScan method was the best for iris and glass datasets and EM algorithm was the best method for the wine dataset.
3.2. Phase II. The hybrid K-means methods were then applied on each dataset, and the results were summarized in Table 3. The higher the value of these evaluation criteria, the better is the clustering algorithm; except for SSE and VI indices (their fewer values are desirable). Figure 5 detects that all hybrid methods are faster in convergence than K-means method in terms of the number of iterations (the line belongs to K-means dominates the others).
Obviously, based on all evaluation criteria, one superior clustering method could not be achieved. But, depending on the purpose of the study, internal or external validity indices may be important. Therefore, according to internal validity indices, the MST-based clustering method was the best for all datasets except for the leukemia, wine, and glass datasets. For the former, GA-based and for the two latter, hierarchalbased methods are the best hybrid method (Table 3). However, the internal validity indices for the best hybrid method could not reach the values for the best ordinary clustering method determined in phase I (Tables 2 and 3), except for those two dat sets (leukemia and olon cancer) which Kmeans was the best ordinary method. According to external validity indices, MST-based clustering method for leukemia and haberman, GA-based method for prostate and hierarchal-based method for iris and glass were the best hybrid clustering methods. For colon cancer and wine datasets, all three hybrid methods have the same performance.
Totally, the hybrid methods could not greatly improve the performance of K-means clustering method in the present study. Meanwhile, although the results do not reveal any regular relationship between sample sizes, number of variables, and number of classes with the best hybrid method, but it seems hierarchal-based method works better in larger sample size with more variables (in wine and glass datasets).

Discussion
We have conducted a comparison study on three hybrid clustering methods which try to solve the random centroids problem in K-means clustering [5][6][7]. Seven existing datasets on Internet were applied to compare the methods. Eleven indices from different clusters' validation methods were the criteria for comparison. The hybrid methods including MST-based [5], GA-based [6], and hierarchical-based [7] K -means clustering are three popular hybrid methods for modifying random centroids problems in K-means. However, there are other methods which try to improve the K -means performance such as principal component analysis [8], different rules for updating the new centroids [9][10][11][12] and machine learning online algorithm [13]. Meanwhile, some previous studies report the improvements occurred by K-means in other clustering methods [11,[21][22][23][24].
To the best of our knowledge, MST-, GA-, and hierarchical-based K-means methods utilized in the present study have not been compared in any simulation or experimental study before. Seven datasets used here were different   Computational and Mathematical Methods in Medicine in terms of sample size, numbers of variables, and natural classes. Hence, these three methods compared here from different aspects.
Results of this research indicated that the hybrid methods did not necessarily improve the ordinary K-means method; and they even sometimes had poorer performance in some indices than the ordinary K-means method ( Table 3). The performance of ordinary K-means method is improved in hybrid methods only in the number of iterations to reach the final solution. In this regard, hierarchical-based, MSTbased, and GA-based clustering methods are in the first to third ranks of convergence rate (Figure 1).
Totally, the hybrid methods could not greatly improve the performance of K-means clustering methods in internal validity indices. However, in external validity indices, these methods outperformed the K-means clustering method (Table 3).
Finally, since some previous studies reported better performance for these three hybrid methods than the ordinary K-means clustering algorithm [5][6][7] simulation studies are recommended to compare these hybrid methods with K-means clustering in terms of initial centroids.

Data Availability
The data used to support the findings of this study have been deposited in the Gene Expression Omnibus repository for Leukemia, Prostate, and colon cancers (https://www.ncbi .nlm.nih.gov/gds) and in University of California Irvine (UCI) repository for Haberman, Iris, Wine and Glass data sets (https://archive.ics.uci.edu/ml/datasets.php).

Disclosure
This article was extracted from Atefeh Bassirat's Master of Science Thesis.

Conflicts of Interest
The authors declare that they have no conflicts of interest.