Is K-Means Clustering Really The Best Unsupervised Learning Algorithm?

Unsupervised learning has emerged as the most effective technique for discovering patterns in data. It is also being used to develop labels on top of the supervised models. This is one of the most widely used techniques for market or customer segmentation wherein the company’s data can be segregated into clusters and used to identify certain patterns which leads to a more customised approach. This technique comprises machine learning algorithms through which data analysts can draw inferences from datasets without labelled responses. Cluster analysis is also widely used for exploratory data analysis to find hidden patterns or grouping in data.

Unsupervised Learning Algorithms Can Be Divided Into Two Wide Categories:

Clustering: A clustering problem is where one can find the inherent groupings in the data, such as grouping customers by purchasing behaviour.

Association: An association rule learning problem is where you want to discover rules that describe large portions of your data, such as people that buy X also tend to buy Y. Some of the common clustering algorithms are hierarchical clustering, Gaussian mixture models and K-means clustering. The last one is considered one of the simplest unsupervised learning algorithms, wherein data is split into k distinct clusters based on distance to the centroid of a cluster.


Sign up for your weekly dose of what's up in emerging technology.

Why K-Means Clustering Is So Popular

K-Means for Clustering is one of the popular algorithms for this approach. Where K means the number of clustering and means implies the statistics mean a problem. It is used to calculate code-vectors (the centroids of different clusters). According to a tutorial, for any word/value/key that needs to be ‘vector quantized’, it is by calculating the distance from all the code vectors and assign the index of the code vector with the minimum distance to this value. For example, clustering can be applied to MP3 files, cellular phones are the general areas that use this technique.

Is K-Means Really Used In Production?

K-means has been around since the 1970s and fares better than other clustering algorithms like density-based, expectation-maximisation. It is one of the most robust methods, especially for image segmentation and image annotation projects.

According to some users, K-means is very simple and easy to implement. However, it is unlikely to be the state-of-the-art, but for straightforward clustering, it is also a part of a larger data-processing pipeline, K-means is a reasonable default choice, at least until you figure out that the clustering step is your bottleneck in terms of overall performance.

Strengths Of K-Means Clustering Algorithm

According to this paper, (Learning Feature Representations With K-means) K-means is used to learn feature representations for images (use k-means to cluster small patches of pixels from natural images, then represent images in the basis of cluster centres; repeat this several times to form a “deep” network of feature representations) gives image classification results that are competitive with much more complex / intimidating deep neural network models. In fact, a lot of k-means applications are now done using support vector machines.

  • It gives good results
  • It is already implemented in the software
  • Number of clusters has to be fixed before
  • Dependent of the initialisation parameters and the chosen distance


  • The results given are usually dependent on the initial values for the means.
  • And the way to initialise the means is not specified, one can start by randomly choosing K of the samples.

How K-Means Algorithm Functions:

The algorithm clusters into k groups and here k is the input parameter. In this procedure, a dataset is classified through a certain number of clusters, commonly known as k clusters and the main idea is to define k centres, one for each cluster.

These centers should be placed in a way since different location causes different results. So, the better choice is to place them as much as possible far away from each other. The next step is to take each point belonging to a given data set and associate it to the nearest centre. When no point is pending, the first step is completed and an early group age is done. However, the main disadvantage is one has to specify the number of clusters as an input in the algorithm.


Many argue that in the field of data science, one should primarily use simple, self-learning algorithms. And clustering algorithm, the most commonly used unsupervised learning algorithm is self-improving and one doesn’t need to set parameters. In fact, most data science teams rely on simple algorithms like regression and completely because they solved all normal business problems with simple algorithms like XG Boost.

Another key upside of K-means, the standard data mining tool is that as opposed to conventional statistical methods, the clustering algorithms do not depend on statistical distributions of data and can be used with little prior knowledge exists, a paper on data mining using K-means discussed.

More Great AIM Stories

Richa Bhatia
Richa Bhatia is a seasoned journalist with six-years experience in reportage and news coverage and has had stints at Times of India and The Indian Express. She is an avid reader, mum to a feisty two-year-old and loves writing about the next-gen technology that is shaping our world.

Our Upcoming Events

Conference, in-person (Bangalore)
Machine Learning Developers Summit (MLDS) 2023
19-20th Jan, 2023

Conference, in-person (Bangalore)
Rising 2023 | Women in Tech Conference
16-17th Mar, 2023

Conference, in-person (Bangalore)
Data Engineering Summit (DES) 2023
27-28th Apr, 2023

Conference, in-person (Bangalore)
MachineCon 2023
23rd Jun, 2023

Conference, in-person (Bangalore)
Cypher 2023
20-22nd Sep, 2023

3 Ways to Join our Community

Whatsapp group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our newsletter

Get the latest updates from AIM