Euclidean distance measures the straight-line distance between two points. In clustering, a smaller distance can indicate greater similarity: a point close to a cluster centroid is more similar to that centroid than a point farther away. section 2.3
For P₁ = (x₁, y₁) and P₂ = (x₂, y₂), distance = √[(x₂ − x₁)² + (y₂ − y₁)²]. Subtract corresponding coordinates, square the differences, add them, and take the square root. section 2.3
Figure 2.5 Euclidean distance, Chebyshev distance, Manhattan distance, and cosine distance are the primary distance metrics used. Note how the distance is different for two points using these metrics. In Euclidean distance, the direct distance is measured between two points, as shown by the first figure on the left.
Compare the direct path measured by Euclidean distance with the paths or measurements used by other distance metrics. section 2.3
Choose the metric for the data and clustering task, rather than treating the common default as automatic:
- In centroid-based clustering, distances between points and centroids guide similarity; k-means most often uses Euclidean distance. section 2.3 section 2.3.4
- In hierarchical clustering, the distance metric and linkage criterion are separate choices. Single, complete, and group-average linkage use different point-to-point distances to define distance between clusters. section 2.4.2
- With many dimensions, Euclidean distance can become less useful or harder to compute; Manhattan distance is suggested as an alternative. Different metrics can also produce different clusters. section 2.3 section 2.7
Checking distances in a DBSCAN workflow
Standardize the data, calculate each point’s nearest-neighbor distance, then sort and plot those distances to help choose ε. Inspect the resulting clusters after fitting DBSCAN: its distance metric matters, and changing ε or minPts can substantially change the result. The shown workflow does not explicitly set a distance metric. section 2.5.2







