In clustering we group points that are "close" to each other. How do we measure closeness with the Euclidean (straight-line) distance, and what is it between the points (1,2) and (4,6)?

Unsupervised learning, Clustering
Level L1 Beginner. Length Short. Nature Th+Mat Both.

What's being asked

Whether you know that clustering needs a distance, and can compute the straight-line distance with the Pythagoras rule.

Key idea

Clustering has no labels, so "similar" has to mean "close". Each data point is a list of feature values, which we can plot as a point. The Euclidean distance is the straight-line distance you would measure with a ruler: d(p,q)=(p1−q1)2+(p2−q2)2. This is just Pythagoras' theorem.

Steps

  1. Say why a distance is needed: a clustering method must decide which points belong together, and it does so by checking which points are near each other.
  2. Find the gaps along each axis: 4−1=3 and 6−2=4.
  3. Use Pythagoras: d=32+42=9+16=25=5.
  4. Read it: the two points are 5 units apart. A pair whose distance is smaller than this would be considered closer.
  5. Add one warning: if one feature is in big units (such as salary in rupees) and another in small units (such as age in years), the big one decides the distance. That is why features are often rescaled first.

Common mistakes

How long your answer should be

About 1 minute; one calculation and a sentence on why closeness matters.

Read this

Previous in Unsupervised learning: none
Next in Unsupervised learning: How does the k-means clustering algorithm group unlabelled data points into k clusters, and what happens in one full iteration on the 1-D (one-dimensional) points {0,2,8,10} with k=2 starting from initial centres 2 and 6?