Can some one explain k-means algorithm with examples?

0 votes
I am basically looking for Python implementation of k-means algorithm with examples to cluster and cache my database of coordinates. Any help would be appreciated.
Sep 9 in Python by Neel
• 3,010 points

1 answer to this question.

0 votes

What is K-means Clustering?

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.

K-means Clustering – Example 1:

A pizza chain wants to open its delivery centers across a city. What do you think would be the possible challenges?

  • They need to analyze the areas from where the pizza is being ordered frequently.
  • They need to understand how many pizza stores has to be opened to cover delivery in the area.
  • They need to figure out the locations for the pizza stores within all these areas in order to keep the distance between the store and delivery points minimum.

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.

K-means Clustering Method:

If k is given, the K-means algorithm can be executed in the following steps:

  • Partition of objects into k non-empty subsets
  • Identifying the cluster centroids (mean point) of the current partition.
  • Assigning each point to a specific cluster
  • Compute the distances from each point and allot points to the cluster where the distance from the centroid is minimum.
  • After re-allotting the points, find the centroid of the new cluster formed.

The step by step process:

k-means clustering with example

answered Sep 9 by Arvind
• 2,960 points

Related Questions In Python

0 votes
1 answer

Explain OOPs concept in python with programatic examples

OOPS concept in Python is huge. I ...READ MORE

answered Mar 19 in Python by Srinesh
0 votes
1 answer

How can I deal with python eggs for multiple platforms in one location?

Try virtualenv : This helps you create isolated ...READ MORE

answered May 28 in Python by SDeb
• 13,180 points
+2 votes
2 answers

How can I replace values with 'none' in a dataframe using pandas

Actually in later versions of pandas this ...READ MORE

answered Aug 13, 2018 in Python by bug_seeker
• 15,350 points
+2 votes
2 answers

How can I plot a k-dsitance graph using python?

Hi there, instead of sklearn you could ...READ MORE

answered Apr 10, 2018 in Python by charlie_brown
• 7,720 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 346 views
+4 votes
6 answers
0 votes
1 answer

Is it possible to call one python script from another Python Script?

Yes it is possible. Suppose your script ...READ MORE

answered Jul 2 in Python by Arvind
• 2,960 points
0 votes
1 answer

What are some good web crawlers in Python?

Following are the libraries that can help ...READ MORE

answered Jul 22 in Python by Arvind
• 2,960 points