Introduction – What is Data Mining and Clustering?
Various organizations have humungous data at hand and there’s a reason why these organizations choose to store it. They use this data to extract some insights from the data which can help them in increasing their profitability. The process of extracting the insights and underlying patterns from the raw data set is known as Data Mining. One of the ways to extract these insightful patterns is Clustering.
Clustering refers to the grouping of data points that exhibit common characteristics. In other words, it is a process that analyses the data set and create clusters of the data points. A cluster is nothing but a grouping of such similar data points. In the processing of clustering, the data points are first grouped together to form clusters and then labels are assigned to these clusters.
To perform clustering on the data set, we generally use unsupervised learning algorithms as the output labels are not known in the data set. Clustering can be used as a part of exploratory data analysis and can be used for modelling to obtain insightful clusters. The clusters should be optimized in such a manner that the distance between the data points inside a cluster should be minimal and the distance amongst the different clusters should be as far as possible.
Why use Clustering? – Uses of clustering
- The better interpretation of the data – Using clustering, the patterns which are extracted from the data set can be easily understood by the layman people and hence they can be interpreted easily.
- Insights from high dimensional data – The high dimensional data sets are not easy to analyze just by looking at its feature. Using clustering can help in providing some insights and extracting some patterns from the huge data. It can provide some summary which might be useful in solving some questions.
- Discovering arbitrary clusters – With the help of different clustering methods, we can find clusters that can take any random shape. This can help in obtaining the underlying characteristics of the data set.
Real-life use cases of Clustering – Applications
- Your company has launched a new product and you are in charge of ensuring that the product reaches out to the right group of people so that your company can achieve maximum profitability. In this case, identifying the right type of people is the problem at hand. You can perform clustering on the customer database to identify the right group of people by analyzing their purchasing patterns.
- Your company has tons of non-categorized images and your supervisor asks you to group them according to the contents of the images. You can use clustering to perform image segmentation on these images. You can also use clustering if they ask you to extract some patterns from the existing data.
Different types of Clustering methods – Algorithms
1. Hierarchical Clustering Method
This method groups or divides the clusters based upon the selected distance metric like Euclidean distance, Manhattan distance, etc. It is generally represented using a dendrogram. It creates a distance matrix between all the clusters which indicates the distance between them. Using this distance metric, the linkage between the clusters is done based upon the type of linkage.
As there can be many data points in a cluster, the distances between all the points from one cluster to all the ones in another cluster will be different. This makes it difficult to decide which distance should be considered which will decide the merging of the clusters. To tackle this, we use the linkage criteria to determine which clusters should be linked. There are three common types of linkages: –
- Single Linkage – The distance between the two clusters is represented by the shortest distance between points in those two clusters.
- Complete Linkage – The distance between the two clusters is represented by the maximum distance between points in those two clusters.
- Average Linkage – The distance between the two clusters is represented by calculating the average distance between points in those two clusters.
Agglomerative Approach – It is also called the Bottom-Up approach. Here, every data point is considered to be a cluster at the initial phase and then it merges these clusters one by one.
Divisive Approach – It is also called a Top-Down approach. Here, all the data points are considered as one cluster at the initial phase and then these data points are divided to create more clusters.
2. Partitioning Clustering Method
This method creates clusters based on the characteristics and similarities among the data points. The algorithms using this methodology requires the number of clusters to be created as input. These algorithms then follow an iterative approach to create those number of clusters. Some of the algorithms following this methodology are as follows: –
- K-Means Clustering
K-Means uses distance metrics like Manhattan distance, Euclidean distance, etc to create the number of clusters specified. It calculates the distance between the data points and the centroid of the clusters. The data points are then assigned to the closest clusters and the centroid of the cluster is re-computed. Such iterations are repeated until the pre-defined number of iterations are completed or the centroids of the clusters do not change after the iteration.
- PAM (Partitioning Around Medoids)
Also known as the K-Medoid algorithm, this working of this algorithm is similar to that of K-Means. It differs from the K-Means in terms of how the centre of the cluster is assigned. In PAM, the medoid of the cluster is an actual data point whereas in K-Means it computes the centroid of the data points which may not be the co-ordinates of an actual data point. In PAM, k data points are randomly selected as the medoids of the clusters and the distance is computed between all the data points and the medoids of the clusters.
3. Density-Based Clustering Method
This method creates clusters based upon the density of the data points. The regions become dense as more and more data points lie in the same region and these regions are considered clusters. The data points which lie far from the dense regions or the areas where the data points are very less in numbers are considered outliers or noise. Following algorithms are based upon this methodology: –
- DBSCAN (Density-Based Spatial Clustering of Applications with Noise): – DBSCAN creates clusters based upon the distance of the data points. It groups together the data points which are in the same neighbourhood. To be considered as a cluster, a specific number of data points must reside in that region. It takes two parameters – eps and minimum points – eps indicate how close the data points should be to be considered as neighbours and minimum points are the number of data points that must reside within that region to be considered as a cluster.
- OPTICS (Ordering Points to Identify Clustering Structure): – It is a modification of the DBSCAN algorithm. One of the limitations of the DBSCAN algorithm is its inability to create meaningful clusters when the data points are equally spread in the data space. To overcome this limitation, the OPTICS algorithm takes in two more parameters – core distance and reachability distance. Core distance indicates whether the data point is a core point by defining a value for it. Reachability distance is defined as the maximum of core distance and the value of distance metric used for calculating the distance between two data points.
4. Grid-Based Clustering Method
The ideology of this method is different from the rest of the commonly used methods. This method represents the entire data space as a grid structure, and it comprises multiple grids or cells. It follows more of a space driven approach rather than a data-driven approach. In other words, it is more concerned about the space surrounding the data points rather than the data points themselves.
Due to this the algorithm converges faster and provides a huge reduction in the computational complexity. In general, the algorithms initialize clustering by dividing the data space into the number of cells thereby creating a grid structure. Then it calculates the density of these cells and sorts them according to their densities. Algorithms like STING (Statistical Information Grid Approach), WaveCluster, CLIQUE (Clustering in Quest) come under this category.
5. Model-Based Clustering Method
This method assumes that the data is generated by a mixture of probability distributions. Each of these distributions can be considered as a cluster. It tries to optimize the fit between the data and the model. The parameters of the models can be estimated by using algorithms like Expectation-Maximization, Conceptual Clustering, etc.
6. Constraint-Based Clustering Method
This method tries to find clusters that satisfy user-oriented constraints. It comes under the class of semi-supervised methodology. This methodology allows users to create clusters based on their preferences. This comes in handy when we are looking for some clusters with specific characteristics.
But during this process, as the clusters formed are focused on the user preferences, some underlying characteristics and insightful clusters may not be formed. The algorithms that follow this approach are COP K-Means, PCKMeans (Pairwise Constrained K-Means), and CMWK-Means (Constrained Minkowski Weighted K-Means).
Also Read: Data Science Project Ideas
Clustering algorithms have proved to be very effective in providing insights from the data for business productivity. The common algorithms used in the various organizations may provide you with expected results, but the unorthodox ones are also worth a try. This article focused on what clustering is and how can it be used as a part of data mining. It also enlisted a few of the uses of clustering, how clustering can be used in real life, and the different types of methods in clustering.
If you are curious to learn about data science, check out IIIT-B & upGrad’s PG Diploma in Data Science which is created for working professionals and offers 10+ case studies & projects, practical hands-on workshops, mentorship with industry experts, 1-on-1 with industry mentors, 400+ hours of learning and job assistance with top firms.