Chapter 7
Distance- and neighborhood-preserving maps
This chapter presents the classical mapping methods that later chapters build on or compare against. Principal component analysis and multidimensional scaling preserve variance or distances; Sammon’s mapping emphasizes small distances; non-metric MDS keeps only their order. Locality preserving projections, the self-organizing map, and incremental grid growing preserve neighborhoods instead. All of them use Euclidean input distances—replacing these by graph distances is the subject of chapter 8.
7.1 Problem and idea
A map assigns every sample a position , usually . Since a -dimensional configuration rarely fits into the plane, every method decides what to sacrifice. Distance-preserving methods try to make the map distances equal to the input dissimilarities and differ in how they weigh the errors: equally (metric MDS), relative to the dissimilarity (Sammon), or not at all, as long as the order is kept (non-metric MDS). Neighborhood-preserving methods only ask that neighbors stay neighbors and leave large distances free; the self-organizing map even replaces the continuous plane by a fixed lattice of prototypes (fig. 7.1).
7.2 Theory
7.2.1 Principal component analysis and classical scaling
PCA [74] projects the centered data onto the directions of largest variance, the leading eigenvectors of the covariance matrix. Classical (Torgerson) scaling [75] obtains a map from a dissimilarity matrix alone: it double-centers the squared dissimilarities,
|
| (7.1) |
and uses the leading eigenvectors of , scaled by the square roots of their eigenvalues, as coordinates. For Euclidean distances is the Gram matrix of the centered data and classical scaling coincides with PCA; for other dissimilarities, such as geodesic distances, it gives the best low-rank approximation of and is the core of Isomap.
7.2.2 Metric MDS and Sammon’s mapping
Metric MDS minimizes the raw stress directly. The SMACOF algorithm of de Leeuw [76, 77] majorizes the stress by a quadratic function and minimizes it by a simple update that never increases the stress; started from classical scaling, it converges in a few dozen iterations. Because large distances contribute most to the raw stress, metric MDS favors the global arrangement.
Sammon [68] weighs every error by the inverse of the dissimilarity,
|
| (7.2) |
so that the small distances, which describe local structure, receive large weights. His minimization uses pseudo-Newton steps: the gradient of with respect to each coordinate is divided by the absolute value of the corresponding diagonal element of the Hessian. The package halves the step whenever the stress would increase.
7.2.3 Non-metric MDS
Often only the order of the dissimilarities is reliable. Kruskal’s non-metric MDS [78] fits the map distances to disparities , an arbitrary monotone transformation of the dissimilarities obtained by isotonic regression, and minimizes stress-1, . The result preserves the rank order of the dissimilarities as well as possible; its scale is arbitrary, and the package rescales it to fit the dissimilarities in least squares so that stress values remain comparable with metric maps.
7.2.4 Locality preserving projections
He and Niyogi [79] seek a linear map that keeps neighbors close. With heat-kernel weights on the kNN graph, degree matrix , and Laplacian , minimizing under the constraint leads to the generalized eigenproblem
|
| (7.3) |
whose eigenvectors with the smallest eigenvalues are the projection directions. LPP is the linear counterpart of the Laplacian eigenmaps of chapter 9; being linear, it maps new samples directly.
7.2.5 The self-organizing map
Kohonen’s self-organizing map [52] places prototype vectors on the nodes of a fixed two-dimensional lattice with positions . In the batch version used here, every epoch assigns each sample to its best matching unit (BMU) and replaces each prototype by the average of the samples, weighted by a Gaussian neighborhood on the lattice,
|
| (7.4) |
where is the BMU of and shrinks over the epochs. Nodes close on the lattice thus represent similar data; the lattice is the map. The U-matrix, the mean distance of each prototype to its lattice neighbors, shows cluster borders as ridges. The fixed lattice is also the main limitation: its size and shape must be chosen in advance, and data whose topology does not match the lattice are folded.
7.2.6 Incremental grid growing
Blackmore and Miikkulainen [80] let the lattice grow. Training starts on a grid; after a few epochs the boundary node with the largest accumulated error receives new nodes in its free lattice positions, initialized by extrapolation from its neighbors. Links between lattice neighbors are deleted when their prototypes drift far apart and restored when they come close again, so the grid can tear along cluster borders and its shape reflects the cluster structure (algorithm 7.1).
In a nutshell: Classical maps
- PCA and classical scaling are exact, fast, and global; metric MDS (SMACOF) fits all distances, Sammon’s mapping favors small ones, non-metric MDS only their order.
- LPP is a linear map that preserves kNN neighborhoods and projects new data.
- The SOM maps data to a fixed lattice; incremental grid growing adapts the lattice to the cluster structure.
- With Euclidean input distances, none of these methods unfolds a curved manifold.
7.3 Using it in graphclust
graphclust.manifold
classical_mds(D, n_components); MetricMDS(n_components, method="smacof" or "classical", dissimilarity="euclidean" or "precomputed"); NonMetricMDS(n_components, dissimilarity); SammonMapping(n_components, dissimilarity, init="pca"); LocalityPreservingProjection(n_components, k, t) with transform; SelfOrganizingMap(grid=(rows, cols), topology="hexagonal", n_epochs) with nodes_, grid_positions_, umatrix(); IncrementalGridGrowing(max_nodes, ...). All mappings store embedding_ and have fit_transform.
maps = { "PCA": PCA(2).fit_transform(X), "metric MDS": MetricMDS(random_state=0).fit_transform(X), "Sammon mapping": SammonMapping().fit_transform(X), "non-metric MDS": NonMetricMDS(random_state=0).fit_transform(X), }
7.4 Examples
7.4.1 Distance-based maps of the Wine data
Figure 7.2 maps the standardized Wine data with PCA, metric MDS, Sammon’s mapping, and non-metric MDS. All four show the three cultivars as overlapping groups. Metric MDS and Sammon’s mapping reach the lowest Sammon stress (about 0.06, against 0.15 for PCA) and the highest trustworthiness; non-metric MDS gives the best residual variance, as it optimizes the order of the distances rather than their values.
Open in ColabExample plot_01_distance_maps.py in the gallery
7.4.2 Neighborhood-based maps
LPP projects the Wine data so that the cultivars form three groups along a curve (fig. 7.3). The hexagonal SOM places the cultivars in different regions of the lattice, and its U-matrix shows the borders between them as lighter and darker bands. Incremental grid growing builds an irregular grid of forty nodes whose branches are dominated by single cultivars.
Open in ColabExample plot_02_neighborhood_maps.py in the gallery
7.5 Further reading
Borg and Groenen [77] treat all variants of MDS, including SMACOF and non-metric scaling. Jolliffe [74] is the standard reference for PCA. Kohonen [52] describes the SOM and its variants. Lee and Verleysen [29] compare distance- and neighborhood-preserving methods systematically.