Isomap A Nonlinear Dimensionality Reduction Technique (original) (raw)

Last Updated : 2 May, 2026

Isomap (Isometric Mapping) is a non-linear dimensionality reduction method that reduces features while keeping the structure of the data intact. It works well when the data lies on a curved or complex surface.

working_of_isomap

Working of Isomap

Manifold Learning

Manifold learning assumes that high-dimensional data actually lies on a lower-dimensional surface called a manifold. Example: A 2D sheet of paper twisted into a 3D spiral. Even though it appears 3D, its true structure is still 2D. Manifold learning methods aim to unfold such shapes and find their simpler representation.

In manifold learning we distinguish between two types of distances:

Isomap focuses on preserving geodesic distances because they show the true relationships in curved and non-linear datasets.

**Working

Now that we understand the basics, let’s look at how Isomap works one step at a time.

**Implementation

So far we have discussed about the introduction and working of Isomap, now lets understand its implementation to better understand it with the help of the visualization.

**1. Applying Isomap to S-Curve Data

This part generates a 3D S-curve dataset and applies Isomap to reduce it to 2D for visualization. It highlights how Isomap preserves the non-linear structure by flattening the curve while keeping the relationships between points intact.

from sklearn.datasets import make_s_curve from sklearn.manifold import Isomap import matplotlib.pyplot as plt

X, color = make_s_curve(n_samples=1000, random_state=42)

isomap = Isomap(n_neighbors=10, n_components=2) X_isomap = isomap.fit_transform(X)

fig, ax = plt.subplots(1, 2, figsize=(12, 5))

ax[0].scatter(X[:, 0], X[:, 2], c=color, cmap=plt.cm.Spectral) ax[0].set_title('Original 3D Data')

ax[1].scatter(X_isomap[:, 0], X_isomap[:, 1], c=color, cmap=plt.cm.Spectral) ax[1].set_title('Isomap Reduced 2D Data')

plt.show()

`

**Output:

Screenshot-(1391)

Output of the above code

Scatter plot shows how Isomap clusters S shaped dataset together while preserving the dataset’s inherent structure.

**2. Applying Isomap to Digits Dataset

Here Isomap is applied to the handwritten digits dataset that has 64 features per sample and reduces it to 2D. The scatter plot visually shows how Isomap groups similar digits together making patterns and clusters easier to identify in lower dimensions.

Python `

from sklearn.datasets import load_digits from sklearn.manifold import Isomap import matplotlib.pyplot as plt

digits = load_digits()

isomap = Isomap(n_neighbors=30, n_components=2) digits_isomap = isomap.fit_transform(digits.data)

fig, ax = plt.subplots(1, 2, figsize=(12, 5))

ax[0].scatter(digits.data[:, 0], digits.data[:, 1], c=digits.target, cmap=plt.cm.tab10) ax[0].set_title('Original 2D Data (First Two Features)')

ax[1].scatter(digits_isomap[:, 0], digits_isomap[:, 1], c=digits.target, cmap=plt.cm.tab10) ax[1].set_title('Isomap Reduced 2D Data')

plt.show()

`

**Output:

Screenshot-(1392)

Output of the above code

The scatter plot shows how Isomap clusters similar digits together in the 2D space, preserving the dataset’s inherent structure.

Applications

Advantages

Limitations