Data Science and Machine Learning Internship ...
- 22k Enrolled Learners
- Weekend/Weekday
- Live Class
K-Means is one of the most important algorithms when it comes to Machine learning Certification Training. In this blog, we will understand the K-Means clustering algorithm with the help of examples.
A Hospital Care chain wants to open a series of Emergency-Care wards within a region. We assume that the hospital knows the location of all the maximum accident-prone areas in the region. They have to decide the number of the Emergency Units to be opened and the location of these Emergency Units, so that all the accident-prone areas are covered in the vicinity of these Emergency Units.
The challenge is to decide the location of these Emergency Units so that the whole region is covered. Here is when K-means Clustering comes to rescue!
Before getting to K-means Clustering, let us first understand what Clustering is.
A cluster refers to a small group of objects. Clustering is grouping those objects into clusters. In order to learn clustering, it is important to understand the scenarios that lead to cluster different objects. Let us identify a few of them.
Clustering is dividing data points into homogeneous classes or clusters:
When a collection of objects is given, we put objects into group based on similarity.
Clustering is used in almost all the fields. You can infer some ideas from Example 1 to come up with lot of clustering applications that you would have come across.
Listed here are few more applications, which would add to what you have learnt.
A Clustering Algorithm tries to analyse natural groups of data on the basis of some similarity. It locates the centroid of the group of data points. To carry out effective clustering, the algorithm evaluates the distance between each point from the centroid of the cluster.
The goal of clustering is to determine the intrinsic grouping in a set of unlabelled data.
K-means (Macqueen, 1967) is one of the simplest unsupervised learning algorithms that solve the well-known clustering problem. K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining.
A pizza chain wants to open its delivery centres across a city. What do you think would be the possible challenges?
Resolving these challenges includes a lot of analysis and mathematics. We would now learn about how clustering can provide a meaningful and easy method of sorting out such real life challenges. Before that let’s see what clustering is.
If k is given, the K-means algorithm can be executed in the following steps:
The step by step process:
Now, let’s consider the problem in Example 1 and see how we can help the pizza chain to come up with centres based on K-means algorithm.
Within the video you will learn the concepts of K-Means clustering and its implementation using python.
Similarly, for opening Hospital Care Wards:
K-means Clustering will group these locations of maximum prone areas into clusters and define a cluster center for each cluster, which will be the locations where the Emergency Units will open. These Clusters centers are the centroids of each cluster and are at a minimum distance from all the points of a particular cluster, henceforth, the Emergency Units will be at minimum distance from all the accident prone areas within a cluster.
Here is another example for you, try and come up with the solution based on your understanding of K-means clustering.
Let’s consider the data on drug-related crimes in Canada. The data consists of crimes due to various drugs that include, Heroin, Cocaine to prescription drugs, especially by underage people. The crimes resulted due to these substance abuse can be brought down by starting de-addiction centres in areas most afflicted by this kind of crime. With the available data, different objectives can be set. They are:
The K-means algorithm can be used to determine any of the above scenarios by analyzing the available data.
Following the K-means Clustering method used in the previous example, we can start off with a given k, following by the execution of the K-means algorithm.
D= {x1,x2,…,xi,…,xm} à data set of m records
xi= (xi1,xi2,…,xin) à each record is an n-dimensional vector
Solution can be found by setting the partial derivative of Distortion w.r.t. each cluster center to zero.
For any k clusters, the value of k should be such that even if we increase the value of k from after several levels of clustering the distortion remains constant. The achieved point is called the “Elbow”.
This is the ideal value of k, for the clusters created.
Related Post:
Application of Clustering in Data Science Using real-time examples.
edureka.co
Hi everyone, I have an eyetracking dataset and want to use it to predict group membership. So given x and y coordinates, can I predict whether someone is a male or female. I haven’t used K-Cluster algorithm before and was wondering if it can be used and how, to answer my question. Thank you for your response.
Toc
Sir wil u please provide me kmean mapreduce in r
what is the difference between plain and iterative mapreduce?
“If k is given, the K-means algorithm can be executed in the following steps” but you don’t say where “k” in ‘if k is given’ comes from.
but k is the number of clusters how can u say in data set
thanks
You are welcome, Rahul!! Please check out other posts as well.
nice one