MathIsimple
Article
14 min read

Manifold Learning: How to Unfold a Crumpled Map

ISOMAP and LLE explained through the art of unfolding without tearing

2026-01-22
Manifold Learning
ISOMAP
LLE
Dimensionality Reduction
Nonlinear Methods

The Hook: Unfolding a Crumpled Map

Imagine you're lost in an unfamiliar city. You finally dig out a map from your backpack, only to find it's been crumpled into a ball. You carefully unfold it, trying not to tear it — because once it rips, the relative positions of streets and subway stations are toast.

That's exactly what Manifold Learning solves.

In data science, high-dimensional data often resembles a "crumpled map": it appears to float around in 100-dimensional space, but the useful information might actually live on a curved 2-dimensional surface (like the "Swiss Roll"). The brilliance of manifold learning is this: it unfolds the high-dimensional manifold into a lower dimension gently, without breaking the real relationships between data points — just like unfolding that crumpled paper.

The Core Problem: When Straight Lines Lie

Picture a classic scenario: the Swiss Roll.

This is a rolled-up surface in 3D space, like taking a 2D sheet of paper and rolling it into a cylinder. Now there are two points on it, A and B:

  • Walking along the surface: A and B are just 2 steps apart (like crawling along the paper surface).
  • Straight-line Euclidean distance: They might be 10 steps away (like measuring the 3D straight-line distance through the roll's core).

Here's the problem: If you want to "reduce" this 3D roll to a 2D plane, what do you do?

  • Wrong approach: Place A and B according to the 3D straight-line distance (10 steps) — result: points that should be neighbors (2 steps on the surface) get pulled apart, and the roll's structure falls apart.
  • Right approach: Place them according to the "true distance on the surface" (2 steps) — result: A and B stay close, and the roll naturally unfolds into a flat sheet.

The Core Insight

The real structure of high-dimensional data often lives on a low-dimensional manifold — for instance, the Swiss Roll is a 2D manifold embedded in 3D space. What we care about isn't the high-dimensional Euclidean distance, but the true distance on the manifold surface (called the "geodesic distance").

What is a "Manifold"? Think of Earth

The word "manifold" sounds abstract, but here's an intuitive way to think about it:

A manifold is a curved low-dimensional surface embedded in high-dimensional space. The relationships among points on that surface depend only on the surface itself, not the surrounding space.

The best example is Earth:

  • Earth is a 3D sphere, but the ground we live on is a 2D spherical manifold.
  • When you fly from Beijing to Shanghai, the real flight distance is an arc along the sphere's surface, not a straight line through the Earth's core (that would be the 3D Euclidean distance).
  • If you tried to draw a map using "through-the-core distances," Beijing and Shanghai would be misplaced.

The Swiss Roll is the same: it's a 2D manifold in 3D space. The true distance between points on the roll is "the path along the surface," not a straight line.

The goal of manifold learning: Find the manifold's true geometric structure, then "unfold" it into a flat low-dimensional space, restoring its most natural form.

Algorithm 1: ISOMAP — Using Geodesic Distance Instead of Straight Lines

ISOMAP (Isometric Mapping) has a simple core idea: Since high-dimensional Euclidean distance is unreliable, let's compute the true manifold distance (geodesic distance) first, then use that for dimensionality reduction.

How do we compute geodesic distance? ISOMAP does it in three steps:

Step 1: Connect Each Point to Its Neighbors

Imagine you're standing at point A on the Swiss Roll surface. You look around and find the k nearest neighbors (say, k=7), then draw lines only to those neighbors.

After doing this for all points, the entire Swiss Roll surface is covered by a network (called a "neighborhood graph"):

  • Neighbors have edges: For example, A is connected to its 7 neighbors.
  • Non-neighbors don't: For instance, A and point Z on the far end of the roll might be close in 3D straight-line distance (through the core), but they're far apart on the manifold, so they're not connected.

Step 2: Find the Shortest Path on the Network

Now, how do you compute the geodesic distance between any two points (say, A and Z)?

Answer: Find the shortest path on that network — just like checking "the shortest route from Beijing to Shanghai" on a map.

For example:

  • A is directly connected to B, C, D (neighbors).
  • B is connected to E, F.
  • Following the chain, eventually E connects to Z.
  • So the geodesic distance from A to Z is the total path length: d(A,B)+d(B,E)+cdots+d(E,Z)d(A,B) + d(B,E) + cdots + d(E,Z).

Using classic shortest-path algorithms like Dijkstra or Floyd-Warshall, you can compute geodesic distances for all pairs of points, forming a new "distance matrix."

Step 3: Use MDS for Dimensionality Reduction

Now you have a "geodesic distance matrix" — it reflects true distances on the manifold.

Next, it's simple: Feed this distance matrix to MDS, which will rearrange points in low-dimensional space to make low-dimensional distances match geodesic distances as closely as possible.

Result: The Swiss Roll gets "unfolded" into a flat 2D sheet. Points that were neighbors on the roll stay neighbors after reduction — the manifold's structure is perfectly preserved.

Algorithm 2: LLE — Rebuilding the Manifold via Local Reconstruction Weights

LLE (Locally Linear Embedding) takes a different approach. Instead of computing geodesic distances, it relies on a clever observation:

Locally, a manifold is approximately flat.

What does that mean?

Imagine zooming in on a small patch of the Swiss Roll. That tiny patch looks almost flat. So each point can be linearly reconstructed (linear combination) by a few of its nearby neighbors — for example:

A0.3B+0.5C+0.2DA \approx 0.3 \cdot B + 0.5 \cdot C + 0.2 \cdot D

These "reconstruction weights" (0.3, 0.5, 0.2) capture the local geometric relationship between A and its neighbors, and this relationship is intrinsic — even if you rotate, translate, or unfold that patch, the weights stay the same.

LLE's core logic: After dimensionality reduction, as long as we keep these reconstruction weights unchanged, the manifold's structure will be preserved.

Specifically, LLE works in three steps:

Step 1: Find k Neighbors for Each Point

Like ISOMAP, first find the k nearest neighbors for each point to determine "who can reconstruct whom."

Step 2: Compute Reconstruction Weights

For each point A, compute a set of weights wB,wC,wD,w_B, w_C, w_D, \ldots such that:

AwBB+wCC+wDDA \approx w_B \cdot B + w_C \cdot C + w_D \cdot D

Requirements:

  • Weights sum to 1: wB+wC+wD=1w_B + w_C + w_D = 1
  • The reconstruction minimizes the error between the reconstructed A and the real A.

This can be solved using least squares.

Step 3: Reconstruct in Low-Dimensional Space

Now you have reconstruction weights for all points (e.g., for point A: wB=0.3,wC=0.5,wD=0.2w_B = 0.3, w_C = 0.5, w_D = 0.2).

Next, LLE finds a new set of low-dimensional coordinates A,B,C,D,A', B', C', D', \ldots such that:

A0.3B+0.5C+0.2DA' \approx 0.3 \cdot B' + 0.5 \cdot C' + 0.2 \cdot D'

All points satisfy this rule.

Ultimately, LLE finds a set of low-dimensional coordinates that preserve all points' reconstruction relationships — the Swiss Roll naturally unfolds into a plane, without explicitly computing geodesic distances.

Formula Intuition: The Math Behind ISOMAP vs LLE

ISOMAP's Mathematical Core

ISOMAP is about isometric mapping:

dgeodesic(i,j)dlow-dim(i,j)d_{\text{geodesic}}(i,j) \approx d_{\text{low-dim}}(i',j')
  • Left side: Geodesic distance on the high-dimensional manifold (computed via shortest paths on the neighborhood graph).
  • Right side: Euclidean distance in low-dimensional space.
  • Goal: Make them as close as possible.

In practice, ISOMAP uses MDS's core formula (eigenvalue decomposition on the distance matrix) to perform dimensionality reduction.

LLE's Mathematical Core

LLE is about preserving local reconstruction weights:

Step 1: Find Weights

minwixijN(i)wijxj2\min_{\mathbf{w}_i} \left\| \mathbf{x}_i - \sum_{j \in N(i)} w_{ij} \mathbf{x}_j \right\|^2
  • xi\mathbf{x}_i: High-dimensional point A.
  • N(i)N(i): A's neighbor set.
  • wijw_{ij}: Reconstruction weight of neighbor j for A.
  • Goal: Minimize reconstruction error.

Step 2: Reduce Dimensionality

minyiiyijN(i)wijyj2\min_{\mathbf{y}_i} \sum_i \left\| \mathbf{y}_i - \sum_{j \in N(i)} w_{ij} \mathbf{y}_j \right\|^2
  • yi\mathbf{y}_i: Low-dimensional point A'.
  • Weights wijw_{ij} are fixed (from Step 1).
  • Goal: Find low-dimensional coordinates that preserve all reconstruction relationships.

This problem can be converted to solving for the eigenvectors of a sparse matrix (eigenvalue problem).

Supplement: MDS vs Manifold Learning — Why Straight Lines Aren't Enough

At this point, you might be thinking: didn't we already learn about MDS (Multidimensional Scaling)? It also does dimensionality reduction. What's the difference with manifold learning?

MDS's Logic

MDS takes high-dimensional data, computes Euclidean distances (straight-line distances) between all points, then rearranges them in low-dimensional space to match those distances as closely as possible.

  • Strength: Works great for "linear data" — e.g., a rotated plane. MDS can easily rotate it back.
  • Weakness: Fails on "nonlinear data" (like the Swiss Roll) — it uses high-dimensional Euclidean distances (straight lines through the core), causing points that should be neighbors on the surface to get pulled apart. The structure collapses.

Manifold Learning's Advantage

Manifold learning methods (like ISOMAP and LLE) have a core principle: Don't trust high-dimensional Euclidean distances. Use true manifold distances instead.

  • ISOMAP: Uses "neighborhood graph + shortest paths" to compute geodesic distances, then feeds MDS — essentially "giving MDS the right distance matrix."
  • LLE: Doesn't compute distances at all. It only preserves "local reconstruction weights" — essentially "only cares about each point's relationship with its neighbors, letting the manifold unfold itself."

Result: MDS squashes the Swiss Roll (distortion). Manifold learning unfolds the Swiss Roll (restoration).

Why Manifold Learning Matters: Helping kNN Find the Right Neighbors

The ultimate goal of manifold learning is to serve downstream machine learning algorithms (like kNN, clustering).

The Problem:

  • In high-dimensional nonlinear data, Euclidean distances mislead algorithms — for instance, two samples of the same class on the Swiss Roll might have a large Euclidean distance (because of the rolling), causing kNN to misclassify them.

Manifold Learning's Solution:

  • First, use ISOMAP or LLE to reduce dimensionality while preserving the true geometric structure.
  • After reduction, points that were neighbors on the manifold remain neighbors in low-dimensional space.
  • When kNN searches for neighbors, it's no longer misled by high-dimensional Euclidean distances, leading to more accurate classifications.

Classic Use Cases:

  • Face Recognition: Different expressions and angles of the same face lie on a "face manifold" in high-dimensional pixel space. Manifold learning unfolds them for easier recognition.
  • Text Classification: High-dimensional word vectors often live on a low-dimensional "semantic manifold." Manifold learning uncovers hidden semantic structure.

Key Takeaways

  1. The core problem manifold learning solves: Useful information in high-dimensional data often lives on a "curved low-dimensional manifold" (like the Swiss Roll). Directly using Euclidean distances causes distortion. Manifold learning finds and unfolds the manifold's true geometric structure.
  2. ISOMAP's approach: Use "neighborhood graph + shortest paths" to compute geodesic distances on the manifold, then apply MDS for reduction — the core is "isometric mapping" (preserving distances before and after reduction).
  3. LLE's approach: Leverage the fact that "manifolds are locally flat." Each point is reconstructed by its neighbors, and reduction preserves those reconstruction weights — the core is "preserving local geometry."
  4. Formula behavior: ISOMAP cares about "global distance" (geodesic distances between any two points). LLE only cares about "local weights" (each point's reconstruction relationship with neighbors) — both lead to the same goal of restoring the manifold.
  5. Practical use: Manifold learning helps kNN, clustering, and other algorithms find the right neighbors on reduced data, improving classification and clustering accuracy — especially for high-dimensional nonlinear data (e.g., images, text).

One-Liner

Manifold learning is like carefully unfolding a crumpled map: not by ironing it flat (MDS), but by gently smoothing along the paper's creases (ISOMAP/LLE), returning cities and streets to their true relative positions — for data, lossless reduction is the real skill.

Ready to master machine learning fundamentals?

Explore our comprehensive course on machine learning techniques, from dimensionality reduction to advanced algorithms. Build a solid foundation in understanding complex data structures and transformations.

Ask AI ✨
Manifold Learning: How to Unfold a Crumpled Map | MathIsimple