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 and ?
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: . This is just Pythagoras' theorem.
Steps
- 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.
- Find the gaps along each axis: and .
- Use Pythagoras: .
- Read it: the two points are units apart. A pair whose distance is smaller than this would be considered closer.
- 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
- Adding the gaps instead of squaring them first. is the walking distance along a grid (Manhattan distance), not the straight-line distance.
- Forgetting the square root and answering .
- Using features of very different scales without noticing. The distance then mostly reflects the largest feature.
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 clusters, and what happens in one full iteration on the 1-D (one-dimensional) points with starting from initial centres and ?