k-means clustering and its real use-case

What is k-means clustering?

What is unsupervised learning?

Distance Measure

  • Euclidean distance measure
  • Manhattan distance measure
  • A squared Euclidean distance measure
  • Cosine distance measure

Euclidean Distance Measure

  • Get each characteristic from your dataset;
  • Subtract each one, example, (line 1, column 5) — (line1,column5) = X …(line 1, column 13) — (line1,column13) = Z;
  • After get the subtract of all columns, you will get all the results and sum it X+Y +Z… ;
  • So you will get the sum’s square root ;

Squared Euclidean Distance Measure

Manhattan Distance Measure

Cosine Distance Measure

How Does K-Means Clustering Work?

Step 1:

Step 2:

Step 3:

Step 4:

Step 5:

Step 6:

Step 7:

Step 8:


1. Spam filter

2. Classifying network traffic



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store