Random initialization trap is a problem that occurs in the K-means algorithm. In random initialization trap when the centroids of the clusters to be generated are explicitly defined by the User then inconsistency may be created and this may sometimes lead to generating wrong clusters in the dataset. So random initialization trap may sometimes prevent us from developing the correct clusters.
Suppose you have a dataset with the following points shown in the picture and you want to generate three clusters in this dataset according to their attributes by performing K-means clustering. From the figure, we can get the intuition what are the clusters that are required to be generated. K-means will perform clustering on the basis of the centroids fed into the algorithm and generate the required clusters according to these centroids.
Suppose we choose 3 sets of centroids according to the figure shown below. The clusters that are generated corresponding to these centroids are shown in the figure below.
Consider another case in which we choose another set of centroids for the dataset as shown. Now the set of clusters generated will be different from the clusters generated in the previous practice.
Similarly we may get different model outputs on the same dataset. This condition where a different set of clusters is generated when a different set of centroids are provided to the K-means algorithm making it inconsistent and unreliable is called the Random initialization trap.
- Elbow Method for optimal value of k in KMeans
- ML | Dummy variable trap in Regression Models
- Random sampling in numpy | random() function
- random.random() function in Python
- Random Numbers in Python
- Secrets | Python module to Generate secure random numbers
- rand vs normal in Numpy.random in Python
- Random Walk (Implementation in Python)
- Python | Generate random numbers within a given range and store in a list
- Python implementation of automatic Tic Tac Toe game using random number
- Generating random Id's in Python
- Generating Random id's using UUID in Python
- Generating random strings until a given string is generated
- Python | Select random value from a list
- Python | Random Password Generator using Tkinter
- Python | random.sample() function
- Generating random number list in Python
- Python | Generate random string of given length
- Random sampling in numpy | ranf() function
- Random sampling in numpy | random_sample() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.