liveBook · Manning

Similarity metric

As explained in Data Without Labels

A similarity measure is a quantitative function that assesses how alike two data points, objects, or representations are.

A similarity metric quantitatively compares objects or representations. In centroid-based clustering, distance provides the comparison: smaller distance from a centroid means greater similarity. section 2.3 section 2.2

Common distance-based similarity choices include:

  • Euclidean distance measures the straight-line path between points. section 2.3
  • Chebyshev distance uses the largest coordinate difference. section 2.3
  • Manhattan distance follows grid-like paths along perpendicular axes and uses the L1 norm. section 2.3
  • Cosine distance compares vectors through their dot product and magnitudes. section 2.3

The selected metric changes similarity scores and can therefore change clustering results. In t-SNE, similarity is measured both in the original high-dimensional space and in the lower-dimensional representation. section 2.2 section 6.4

Figure 2.4 Centroid-based clustering methods create a centroid for the respective clusters, and the similarity is measured based on the distance from the centroid. In this case, we have five centroids; hence, we have five distinct clusters.
figure

Use the centroid diagram to see similarity represented by each point’s distance from its cluster centroid. 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.
figure

Compare how Euclidean, Chebyshev, Manhattan, and cosine metrics assign different distances to the same pair of points. section 2.3

How Data Without Labels covers it

How deep it goes
Defines distance-based similarity and several formulas, but defers centroid, norm, and probability-proof details.
Examples
Uses centroids, two-dimensional point coordinates, four distance paths, and Gaussian neighborhoods in t-SNE.
What you can do after
Evaluate/understand how distance choices alter similarity scores and clustering or embedding behavior.
How it connects
Connects distance metrics with clustering, centroids, hard clustering, soft clustering, t-SNE, and dimensionality reduction.

Also explained in

Compare how 10 books explain similarity metric →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Without Labels. The section links point to the parts of the book it draws on.