Manifold Learning and Nonlinear Dimensionality Reduction
Imagine photographing a single face from thousands of angles, under varying light, at different scales. Each image is a point in a pixel space with tens of thousands of dimensions. Yet the true number of underlying causes — pose, illumination, expression — is small, perhaps a dozen. Principal Component Analysis would fit a flat subspace through this cloud of images. But the data actually curves through pixel space like a sheet bent in a high-dimensional room. A straight ruler cannot measure a bent sheet correctly. Neither can a linear projection. This is the manifold hypothesis: high-dimensional data generated by real-world processes often lies near a low-dimensional, possibly curved, surface embedded in the ambient space. Manifold learning is the collection of algorithms designed to discover and unfold this surface. It recovers coordinates that reflect the data's intrinsic geometry rather than its incidental embedding. This matters enormously in practice. Genomic data, sensor readings, word embeddings, and images all exhibit strong nonlinear structure. Treating them as linear collapses distinct signals into an indistinguishable blur. This article develops the core geometric idea shared by nonlinear embedding methods. First, build a graph that captures local neighborhood structure. This structure is well approximated by Euclidean distance even on a curved manifold. Then find a low-dimensional coordinate system that best preserves this local structure globally. We derive and compare the two foundational algorithms of this family, Isomap and Locally Linear Embedding (LLE). We trace exactly how each turns a neighborhood graph into an eigenvalue problem. We also explain why that problem is solvable exactly (no local minima, unlike neural embeddings). By the end, you will understand why linear methods fail on curved data. You will see how graph-based geodesic and reconstruction-based approaches recover intrinsic coordinates. You will learn what guarantees (and what fails) in the underlying mathematics. Finally, you will see how this classical machinery sets up later ideas. These include probabilistic neighborhood preservation and force-directed layouts. Together they culminate in t-SNE and UMAP.
- The manifold hypothesis: real high-dimensional data often lies near a low-dimensional curved surface embedded in a higher-dimensional space.
- Linear methods like PCA preserve global variance but destroy structure when the data manifold is curved (e.g., a Swiss roll).
- Manifold learning methods build a k-nearest-neighbor graph to capture local geometry, which is reliably Euclidean even when the whole manifold is not.
- Isomap replaces Euclidean distances with graph geodesic distances and applies classical Multidimensional Scaling to recover global structure.
- Locally Linear Embedding reconstructs each point as a linear combination of neighbors and finds low-dimensional coordinates preserving those weights.
- Both reduce to an eigenvalue/eigenvector problem — globally optimal, deterministic, but sensitive to neighborhood-graph parameters and short-circuit errors; this motivates the probabilistic relaxations used in t-SNE and UMAP.
Nonlinear dimensionality reduction recovers a data manifold's intrinsic coordinates by trusting local distances completely and letting global structure emerge from how local neighborhoods are stitched together.
The idea
A manifold is a topological space that locally resembles Euclidean space — near any point, it looks flat, even if globally it is curved or twisted, like the surface of a sphere or a rolled-up sheet of paper. The manifold hypothesis states that many real, high-dimensional datasets are not scattered arbitrarily through their ambient space but concentrate near such a low-dimensional manifold, with the ambient dimensions filled by redundant or noisy coordinates (pixels, sensor channels, one-hot codes). If this hypothesis holds, then the data has a much smaller intrinsic dimensionality than its ambient dimensionality , and the goal of manifold learning is to recover a faithful -dimensional coordinate chart. The canonical illustration is the Swiss roll: a two-dimensional sheet rolled into a spiral and embedded in three-dimensional space. Two points that are close in ambient (straight-line) Euclidean distance can be far apart along the sheet — they might sit on adjacent windings of the roll — while two points that are far apart in Euclidean distance can be close along the sheet's surface. Any method relying purely on ambient Euclidean distance, including PCA and classical Multidimensional Scaling, will therefore confuse "wound-up" and "unrolled" distances. Manifold learning methods explicitly correct for this by trusting Euclidean distance only locally, in small neighborhoods where the manifold really is approximately flat, and inferring global structure from how these local neighborhoods chain together. This yields the shared algorithmic template of the classical nonlinear embedding methods: (1) build a neighborhood graph from the data, typically via -nearest-neighbors or an -ball; (2) define a notion of "structure to preserve" using this graph — either geodesic distances (Isomap) or local linear reconstruction weights (LLE); (3) solve a global optimization problem, always reducible to an eigenvalue decomposition, that finds low-dimensional coordinates best preserving that structure. Because these problems are convex quadratic forms constrained to orthonormal coordinates, they have a unique, globally optimal, closed-form solution — a major theoretical advantage over gradient-based neural embeddings, at the cost of being more brittle to the neighborhood graph's quality.
How it works
Step 1 — Build the neighborhood graph
Both algorithms begin identically. For each point in the dataset , find its nearest neighbors under the Euclidean distance metric, and connect to each neighbor with an edge weighted by their Euclidean distance. The resulting weighted graph encodes only short-range distances, which are trustworthy because the manifold is locally flat (a first-order Taylor approximation of any smooth surface is a tangent plane).
Step 2a — Isomap: geodesics via shortest paths
Isomap's insight is that the geodesic distance — the distance measured while walking along the manifold's surface — is what should be preserved globally, not the straight-line ambient distance. It estimates this geodesic distance by the shortest path through the neighborhood graph, since a chain of short local hops approximates a walk along the curved surface. Formally, define
computed with Dijkstra's Algorithm from every node, or the all-pairs Floyd–Warshall algorithm. This produces an matrix of estimated geodesic distances, which Isomap then feeds into classical multidimensional scaling (MDS) — the same eigenvalue machinery underlying PCA, applied to a distance matrix instead of a covariance matrix — to find coordinates in whose pairwise Euclidean distances best match . Classical MDS proceeds by double-centering the squared distance matrix to form the Gram-like matrix , then eigendecomposing it:
where is the matrix of squared geodesic distances. The top eigenvectors of , scaled by the square roots of their eigenvalues, are the output embedding coordinates.
Step 2b — LLE: local linear reconstruction
LLE takes a different but related view: instead of distances, it preserves the linear relationships among each point and its neighbors. Each point is assumed to be well-approximated by a linear (affine, weights summing to 1) combination of its nearest neighbors — true to first order on a smooth manifold. LLE first solves, for each , a constrained least-squares problem for weights :
These weights are invariant to rotation, scaling, and translation of the neighborhood, so they capture purely the local geometric relationship, independent of ambient orientation. LLE then finds low-dimensional coordinates that are reconstructed by the same weights:
This is solved by finding the bottom eigenvectors of the sparse matrix and discarding the trivial constant eigenvector. ``` ALGORITHM Isomap(X, k, d) Input: data X = {x_1,...,x_n} in R^D, neighbors k, target dim d Output: embedding Y in R^{n x d} 1. Build k-NN graph G: for each x_i: N(i) = k nearest neighbors of x_i by Euclidean distance for each x_j in N(i): add edge (i,j) with weight ||x_i - x_j|| 2. Compute geodesic distances: D_G = all-pairs shortest paths on G # Dijkstra or Floyd-Warshall if G is disconnected: raise error or process largest component only 3. Classical MDS on D_G: S = elementwise square of D_G H = I - (1/n) ones(n,n) B = -0.5 H @ S @ H (lambda_1 >= ... >= lambda_n, v_1,...,v_n) = eigendecomposition(B) Y[:, a] = sqrt(lambda_a) * v_a for a = 1..d 4. return Y
ALGORITHM LLE(X, k, d) Input: data X = {x_1,...,x_n} in R^D, neighbors k, target dim d Output: embedding Y in R^{n x d} 1. for each x_i: N(i) = k nearest neighbors of x_i solve for w_i (indexed over N(i)) minimizing || x_i - sum_j w_ij * x_j ||^2 s.t. sum_j w_ij = 1
# closed form: build local Gram matrix C_jk = (x_i - x_j).(x_i - x_k)
# solve C w = 1 (ones vector), then normalize w to sum to 1 set W[i, N(i)] = w_i ; W[i, others] = 0 2. M = (I - W)^T @ (I - W) 3. Find eigenvectors of M with the d+1 SMALLEST eigenvalues discard the eigenvector with eigenvalue ~0 (the constant vector) Y = remaining d eigenvectors, stacked as columns 4. return Y ```
Complexity & correctness
Isomap complexity. Building the -NN graph over points in dimensions costs with a naive scan, or with tree-based structures in low-to-moderate (KD-trees degrade toward per query in high dimensions, so the naive bound is the honest worst case). Computing all-pairs shortest paths with Dijkstra's algorithm from each of sources, using a binary heap, costs where edges, i.e. total (Floyd–Warshall is a simpler but slower alternative). The final eigendecomposition of the matrix for the top eigenvectors costs using iterative methods (Lanczos), or for a full eigendecomposition. The dominant cost is the all-pairs shortest path step, , making Isomap's overall complexity roughly for typical .
LLE complexity. The -NN search costs the same (or better with trees). For each point, solving the local weight regression involves inverting or solving a linear system, costing per point and total — cheap since is a small constant (typically 5–50), independent of or . The matrix is but extremely sparse (each row has at most nonzeros before the product, afterward), so its bottom eigenvectors can be found with sparse iterative eigensolvers (e.g., Lanczos/ARPACK) in roughly to depending on conditioning, far cheaper in practice than Isomap's dense shortest-path step. LLE's dominant true bottleneck is usually the neighbor search, not the eigenproblem.
Why classical MDS is correct (Isomap's core guarantee). If the geodesic distance matrix were exactly the pairwise Euclidean distances of some true low-dimensional configuration , then double-centering recovers this configuration exactly, because for centered points, the squared distance matrix satisfies
and the double-centering operation exactly cancels the norm terms, leaving , the Gram matrix. This is a rank- positive semidefinite matrix, and its eigendecomposition recovers up to rotation — the same identity that underlies PCA acting on a covariance matrix. Isomap's correctness therefore rests on a separate geometric claim: that graph shortest-path distances converge to true geodesic distances as and shrinks appropriately, which holds under sampling-density and curvature conditions (Bernstein, de Silva, Langford 2000 give explicit bounds). In finite samples this is an approximation, not an exact identity — the eigen-machinery is exact, but its input (the geodesic estimate) is not.
Why LLE's optimization is correct. The local weight-fitting step is an exact constrained least-squares problem with a closed-form solution (solve a small linear system, then renormalize), so no approximation error is introduced there beyond the linearity assumption itself. The embedding step is a Rayleigh–Ritz problem: minimizing subject to (with the mean constraint removing the trivial null-space direction) is solved exactly by the eigenvectors of with smallest eigenvalues — this is the standard variational characterization of eigenvalues, the same principle used to justify PCA's optimality for reconstruction error. The one eigenvalue that is exactly zero corresponds to the all-ones (constant) eigenvector, which must be discarded because it embeds every point at the same location; keeping the next smallest nonzero eigenvectors gives the reconstruction-preserving coordinates with the least "distortion energy."
Tradeoffs, honestly stated. Both methods find the global optimum of their respective objectives — there is no local-minimum risk, unlike gradient descent in neural embeddings — but this global optimum can still be a poor answer if the input graph is wrong. Isomap fails catastrophically if the -NN graph contains a "short-circuit" edge connecting two distant, unrelated regions of the manifold (e.g., through a hole, or across nearby-but-unconnected windings), because a single erroneous edge can corrupt many shortest-path distances. LLE is more locally robust to such edges (an error contaminates only nearby reconstruction weights) but is known to struggle when neighborhoods are sparse relative to curvature, or when exceeds (making the local reconstruction underdetermined, requiring regularization). Neither method extends naturally to new, unseen points without retraining (both are inherently transductive), and neither provides an inverse mapping back to the ambient space by default.
Worked example
Consider points sampled along a quarter-circle arc of radius 1 in (a toy manifold curving in its ambient space), at angles :
| point | θ (°) | ||
|---|---|---|---|
| 0 | 1.000 | 0.000 | |
| 18 | 0.951 | 0.309 | |
| 36 | 0.809 | 0.588 | |
| 54 | 0.588 | 0.809 | |
| 72 | 0.309 | 0.951 | |
| 90 | 0.000 | 1.000 |
The true intrinsic coordinate is arc length: , ranging from to . A straight-line (chord) distance from to is , while the true geodesic (arc) distance is — a 10% underestimate that grows worse for larger arcs, exactly the distortion PCA/MDS on raw Euclidean distance would suffer.
Isomap step-by-step (using nearest neighbors, connecting each point to its immediate arc-neighbors): 1. Graph edges connect consecutive letters: –, –, –, –, –, each with Euclidean weight (chord length for of arc). 2. Shortest path sums five such hops: — matching the true arc length almost exactly, because chords over small angles closely approximate arc length. Compare to the raw chord distance : the graph geodesic has already corrected the curvature-induced underestimate. 3. Feeding the full geodesic distance matrix into classical MDS and keeping dimension recovers coordinates that are, up to a sign and additive constant, linear in — i.e., Isomap linearizes the arc into a 1-D coordinate, recovering exactly the arc-length parameterization that generated the data.
LLE step-by-step on the same data with : for point (neighbors and ), solve for weights with minimizing . By the arc's local symmetry around , the least-squares solution gives (locally the arc looks like a straight segment through , symmetric about it). Repeating for all interior points and assembling , the second-smallest eigenvector of (the first is discarded as constant) yields embedding coordinates that again vary monotonically along the arc — LLE unrolls the same curve into an ordered 1-D line, using only local symmetry rather than any global shortest-path computation. Both methods agree on the qualitative answer for this simple example — recovering as the intrinsic coordinate — illustrating that they solve the same underlying problem (unroll a curved manifold) via distinct mechanisms (global geodesics vs. local linear reconstruction).
Common pitfalls & traps
| Pitfall | Why it happens | Consequence |
|---|---|---|
| Choosing too large | Neighborhood no longer locally linear/flat | "Short-circuit" edges corrupt geodesics (Isomap) or over-smooth reconstruction (LLE) |
| Choosing too small | Graph becomes disconnected | Isomap has no path between components; undefined geodesic distances |
| Ignoring disconnected components | Real datasets often cluster | Must embed each connected component separately or discard small ones |
| Applying PCA-style variance interpretation to output axes | Eigenvector ordering ≠ variance explained in the same sense as PCA | Misreading "component 1" as the dominant global factor when it may be an artifact of graph topology |
| Using LLE with without regularization | Local reconstruction becomes underdetermined (infinite solutions) | Numerically unstable weights; requires ridge-regularized least squares |
| Treating embeddings as metric-preserving for new points | Both methods are transductive, fit only to training points | No natural out-of-sample extension without additional heuristics (e.g., Nyström) |
| Comparing Isomap/LLE distances across different runs or datasets | Embedding scale and orientation are arbitrary (defined only up to rotation/scaling) | Invalid quantitative comparisons of "distance in embedding space" across experiments |
Pioneers & history
Origins · 1 minJoshua B. Tenenbaum and how this was discovered
Tenenbaum, together with Vin de Silva and John C. Langford, introduced Isomap in 2000 as a bridge between classical Multidimensional Scaling and graph-theoretic shortest-path algorithms, framing dimensionality reduction as a problem of recovering the intrinsic geometry a learner (biological or artificial) must infer from sensory data.
:::physicist[Sam T. Roweis and Lawrence K. Saul|Roweis 1972–2010|Saul active researcher|Machine learning, NYU and UCSD|Published Locally Linear Embedding in the same 2000 issue of Science as Isomap| Roweis and Saul proposed LLE as a strikingly different route to the same destination: rather than global shortest paths, they showed that preserving purely local linear reconstruction weights, combined with a sparse eigenproblem, recovers global nonlinear structure — a template later echoed in graph-based semi-supervised learning and spectral clustering.
Origins · 1 minhow this was discovered
Where this matters
Manifold learning underlies exploratory data analysis across the sciences: single-cell genomics pipelines use nonlinear embeddings to visualize cell-type continuums that PCA smears together; computer vision researchers use manifold structure to model pose and viewpoint manifolds in face and object recognition; robotics and motion-planning systems exploit low-dimensional configuration-space manifolds to plan efficiently in what is nominally a high-dimensional joint-angle space. The conceptual apparatus here — trust local distances, infer global structure — is the direct ancestor of the neighbor-graph constructions inside t-SNE and UMAP, both of which replace Isomap's rigid geodesic distances and LLE's linear reconstruction weights with softer, probabilistic neighborhood models, trading exact global optimality for scalability and better handling of noisy real-world neighborhoods. Spectral clustering, graph-based semi-supervised learning, and even certain graph neural network architectures inherit the same "build a graph, extract eigenvectors" template introduced by this generation of algorithms.
Ask the tutor: How does the choice of the neighborhood size concretely change the shape of an Isomap or LLE embedding on a dataset with varying sampling density?
Why can't I just run PCA and call it a day?
PCA finds the best-fitting linear (flat) subspace, minimizing squared reconstruction error under a rigid, straight-line notion of distance. If your data truly lies near a flat subspace, PCA is not just adequate but provably optimal, and far cheaper than manifold learning. The trouble arises when data lies on a curved manifold: PCA's straight lines cut through empty regions of space that the data never occupies, conflating points that are actually far apart along the true surface (like two arms of a spiral that happen to pass close to each other in ambient coordinates). Manifold learning methods explicitly model this curvature by trusting only short-range distances and inferring long-range structure through the manifold itself, which PCA has no mechanism to do.
Is Isomap or LLE "better"?
Neither dominates universally. Isomap tends to preserve global structure well (relative distances between far-apart regions) because it explicitly models geodesic paths, but this makes it fragile to short-circuit edges and requires expensive all-pairs shortest-path computation. LLE is cheaper, more locally robust (an error stays local rather than propagating globally), and handles some non-convex manifold shapes gracefully, but can distort large-scale distances since it never directly models them — two well-separated regions might end up implausibly close if their local reconstructions happen to align. In practice, both have been largely superseded for visualization by t-SNE and UMAP, but they remain the cleanest pedagogical and mathematical foundation for understanding what "manifold learning" means.
What does "intrinsic dimensionality" actually mean, and how would I estimate it?
Intrinsic dimensionality is the smallest number of coordinates needed to describe the data's true degrees of freedom, ignoring the ambient space's redundant dimensions. For a Swiss roll embedded in 3-D, the intrinsic dimension is 2, since every point can be described by its position along the roll and across its width. Estimating it in practice uses techniques like inspecting the eigenvalue spectrum from classical MDS or PCA (looking for a sharp elbow), fractal correlation-dimension estimators, or nearest-neighbor distance scaling laws (e.g., the ratio of distances to first and second nearest neighbors, which behaves predictably as a function of dimension). No estimator is perfectly reliable, especially with noise, so intrinsic dimension is often chosen partly by domain knowledge.
Why do these methods reduce to eigenvalue problems instead of iterative optimization?
Both Isomap's and LLE's objectives are quadratic forms subject to orthonormality (or centering) constraints on the output coordinates — exactly the setting where the Rayleigh–Ritz variational principle applies, guaranteeing that the constrained optimum is achieved exactly by the top or bottom eigenvectors of a specific matrix. This is the same principle that makes PCA solvable in closed form via Singular Value Decomposition. Because the underlying problem is convex in this restricted sense (a quadratic form over an orthogonality constraint, not a general nonconvex landscape), there are no spurious local optima to worry about, unlike training a neural network embedding, where gradient descent can get stuck or require careful tuning.
What happens if my data has multiple disconnected clusters rather than one continuous manifold?
Isomap requires a connected neighborhood graph, since it needs a finite shortest-path distance between every pair of points; if the true data forms disconnected clusters, the graph will have multiple components and geodesic distances between components are undefined (infinite). Practical implementations either restrict Isomap to the largest connected component, discarding smaller clusters, or increase until connectivity is achieved (risking short-circuit errors as a side effect). LLE has a related but distinct issue: it can still produce an embedding since its optimization only involves each point's own local neighborhood, but the between-cluster arrangement in the output is essentially arbitrary, since no term in the objective constrains relative cluster placement.
How do these classical methods relate to t-SNE and UMAP?
Isomap and LLE established the core recipe — build a neighbor graph, define a structure-preservation objective, solve for low-dimensional coordinates — that later methods refined rather than replaced. t-SNE keeps the "neighbor graph" idea but replaces rigid geodesic distances or linear-reconstruction weights with probability distributions over neighbors, matching a Gaussian-based neighbor distribution in high dimensions to a heavier-tailed Student-t distribution in low dimensions, optimized by gradient descent rather than a closed-form eigenproblem. UMAP replaces the probabilistic model with a fuzzy topological one, aiming for both faster computation and better preservation of both local and global structure. Both trade the deterministic global optimum of Isomap/LLE for greater flexibility, scalability, and visual quality, especially in noisy, real-world high-dimensional data.
Can manifold learning be used for tasks beyond visualization, like preprocessing for a classifier?
Yes, though this use is less common than visualization because most classical manifold methods are transductive — they compute an embedding only for the training points and don't naturally generalize to new data without extra machinery (e.g., Nyström extension approximates out-of-sample embedding by interpolating from the training kernel). When usable, manifold learning as preprocessing can dramatically simplify downstream classification or clustering by "unrolling" nonlinear structure into a space where linear classifiers or distance-based clustering (like -means) work far better, since these downstream methods implicitly assume Euclidean, roughly convex cluster shapes that curved manifolds violate.