Chapter 8
Topology-preserving maps
Replacing Euclidean input distances by graph distances lets a map unfold curved manifolds. This chapter presents the methods that do so: Isomap, which applies classical scaling to geodesic distances; Isotop, a self-organizing map whose neighborhood is measured along a graph; curvilinear component and distance analysis; the online methods OVI-NG and GNLP-NG, which learn a neural gas codebook and its map simultaneously; and the topology representing network map (TRNMap), which maps the graph of a topology representing network by metric or non-metric MDS. Component planes show how the maps carry the original variables.
8.1 Problem and idea
The methods of chapter 7 preserve Euclidean distances or neighborhoods. When the data lie on a curved low-dimensional manifold—a rolled sheet, a bent curve—the Euclidean distance between far-apart samples measures the shortcut through the ambient space, and preserving it forces the map to fold the manifold. Geodesic distances measured along a neighborhood graph (chapter 2) do not have this problem: for a manifold that is isometric to a subset of the plane, the geodesic distances are planar distances, and a distance-preserving map of them unrolls the manifold (fig. 8.1).
The methods of this chapter differ in three choices: which graph (kNN graph of the samples, competitive Hebbian graph of a codebook, topology representing network), which mapping (eigendecomposition, stress minimization, online adaptation), and whether the map is computed for all samples or for a codebook of representatives.
8.2 Theory
8.2.1 Isomap
Isomap [6] builds a kNN or -graph of the samples, computes all geodesic distances (algorithm 2.1), and embeds them by classical scaling eq. (7.1). It is fast, has no local minima, and is exact for manifolds isometric to convex planar regions with dense sampling. Its weaknesses are the cubic cost of the eigendecomposition for large , sensitivity to short circuits, and disconnected graphs for data with several clusters; the package joins components by their shortest connecting edges so that multi-cluster data can still be mapped.
8.2.2 Isotop
Isotop [81] keeps the self-organizing principle of the SOM but replaces the fixed lattice by a graph of the data. It quantizes the data (optionally), links the nodes by a kNN graph, computes geodesic distances with mean edge length , and then adapts the map positions by repeating: draw a point from a Gaussian kernel centered on a randomly chosen map node, find the node whose map position is closest to , and move all nodes,
|
| (8.1) |
Nodes close to along the graph follow , distant ones hardly move, so the map spreads out while the graph neighborhoods stay together. Isotop needs no eigendecomposition and handles non-convex manifolds, but, like all stochastic self-organizing methods, it can be caught in local minima, and its schedules require some care.
8.2.3 Curvilinear component and distance analysis
Curvilinear component analysis (CCA) of Demartines and Hérault [82] minimizes a stress that weighs each distance error by a decreasing function of the map distance,
|
| (8.2) |
for example the step function if and otherwise. Short map distances are enforced, long ones may stretch, so the map can tear a manifold apart where necessary. CCA minimizes eq. (8.2) by a fast stochastic rule: choose a sample and move every other point by , with shrinking over time. With geodesic input distances the method becomes curvilinear distance analysis (CDA) [83], which combines the unfolding power of geodesic distances with the tearing ability of CCA.
8.2.4 OVI-NG and GNLP-NG
Estévez and Figueroa [84] attached a map to the neural gas codebook. In OVI-NG every adaptation step of a topology representing network is followed by an update of the map positions of the nodes towards consistency with the codebook distances around the winner :
|
| (8.3) |
where is the map distance, the codebook distance, and the rank of node by map distance from . Only ranks enter the neighborhood factor, so the method behaves like a neighborhood-preserving, online version of Sammon’s mapping. Because is Euclidean, OVI-NG does not unfold curved manifolds.
GNLP-NG [85] uses geodesic distances instead. It first trains the codebook with neural gas and links nodes by competitive Hebbian learning, connects the graph, and computes geodesic distances ; then it adapts the map positions by eq. (8.3) with replaced by and the neighborhood factor computed from the rank of node by geodesic distance from .
8.2.5 The topology representing network map
TRNMap [4, 5] combines the topology representing network of chapter 3 with multidimensional scaling (algorithm 8.1). Compared with the methods above, it has three properties. Its graph is learned by competitive Hebbian learning and does not depend on a neighborhood size or on the data density. Its mapping is a one-shot MDS of the geodesic distances, without online iterations whose schedules must be tuned. And it lets the user decide what to preserve: metric MDS keeps the geodesic distances (distance-preserving TRNMap, DP-TRNMap), non-metric MDS only their order (neighborhood-preserving TRNMap, NP-TRNMap). The nodes are prototypes with codebook vectors in the original space; drawing the map once per variable with nodes shaded by that variable gives component planes, which show the distribution of each variable over the map and reveal correlated variables by similar shadings.
The number of nodes is the decisive parameter. Too few nodes are spaced farther apart than the gaps of the manifold, and their links bridge the gaps; too many nodes receive too few samples each and may settle in empty space. A few hundred nodes, or about a fifth of the samples for small data sets, work well in practice. The other TRN parameters can stay at their defaults.
In a nutshell: Topology-based maps
- Geodesic input distances let distance-preserving maps unfold manifolds; Euclidean ones (CCA, OVI-NG) keep them folded.
- Isomap: kNN graph and classical scaling, global and exact but sensitive to .
- Isotop, CCA/CDA, OVI-NG, GNLP-NG: stochastic self-organization with decaying schedules; CDA can tear, Isotop can stall in local minima.
- TRNMap: competitive Hebbian graph and one-shot metric or non-metric MDS; nodes double as prototypes and give component planes.
8.3 Using it in graphclust
graphclust.manifold
Isomap(n_components, k=10, eps=None, graph=None); Isotop(n_components, n_nodes=None, k=6, n_iter, alpha, lam); CurvilinearComponentAnalysis(n_components, geodesic=False, k, n_nodes=None, n_epochs, alpha, lam); OnlineVisualizationNG(n_nodes, ...); GeodesicNLPNG(n_nodes, ...); TRNMap(n_nodes, mapping="metric", "nonmetric" or "classical", fine_tune=False, normalize=True, lifetime, prune=True). The node-based maps store nodes_, adjacency_, dist_matrix_, and embedding_ (one row per node); transform(X) places samples at their nearest node. plotting.plot_component_planes(positions, nodes, adjacency).
ovi = OnlineVisualizationNG(n_nodes=n, random_state=0).fit(X) gnlp = GeodesicNLPNG(n_nodes=n, random_state=0).fit(X) dp = TRNMap(n_nodes=n, mapping="metric", random_state=0).fit(X) np_ = TRNMap(n_nodes=n, mapping="nonmetric", random_state=0).fit(X)
8.4 Examples
8.4.1 Isomap, Isotop, CCA, and CDA on the swiss roll
Figure 8.2 maps the swiss roll with the four methods (Isotop, CCA, and CDA on 250 neural gas nodes). Isomap unrolls the sheet into a rectangle colored smoothly by the position along the roll. CDA unrolls it as well, with mild distortions at the ends. CCA with Euclidean distances cannot unroll the sheet and tears it into pieces that are internally consistent but arranged arbitrarily. Isotop unfolds most of the roll but leaves a fold, an example of the local minima of stochastic self-organization.
Open in ColabExample plot_01_isomap_isotop_cda.py in the gallery
8.4.2 OVI-NG, GNLP-NG, and TRNMap on the S curve
All four methods of fig. 8.3 map 120 nodes of the S curve and draw the learned graph. OVI-NG, whose map follows Euclidean codebook distances, reproduces the S shape: the sheet is bent in the plane rather than unrolled. GNLP-NG unrolls it into a slightly distorted strip. DP-TRNMap and NP-TRNMap unroll it into a regular rectangle in which the color, the position along the S, varies monotonically from one end to the other; the non-metric version differs from the metric one only in small local adjustments, because the geodesic distances are nearly Euclidean in the plane.
Open in ColabExample plot_02_ovi_gnlp_trnmap.py in the gallery
8.4.3 Component planes
The component planes of a TRNMap of the S curve (fig. 8.4) show the three coordinates over the unrolled map. The height of the sheet varies across the strip, the two other coordinates along it; the S shape appears as the two coordinates oscillating against each other along the map.
Open in ColabExample plot_03_component_planes.py in the gallery
8.4.4 The number of nodes
Figure 8.5 maps the swiss roll with 50, 150, and 400 nodes and evaluates the node maps against the geodesic distances. With fifty nodes the node spacing exceeds the gap between the windings, competitive Hebbian learning links neighboring windings, and the map folds the roll into a ring; trustworthiness and continuity stay around 0.93. With 150 and 400 nodes the links stay on the sheet, the roll is unrolled, and both measures exceed 0.99 at all neighborhood sizes. Beyond that, more nodes refine the map without changing its shape.
Open in ColabExample plot_04_number_of_nodes.py in the gallery
8.5 Further reading
Lee, Lendasse, and Verleysen [83] compare Isomap and CDA in depth; Lee and Verleysen’s book [29] covers Isotop and CCA. The online methods are described by Estévez and co-authors [84, 85]. TRNMap is introduced in [4]; its relations to other combinations of topology representing networks and mappings are analyzed in [5, 86, 87].