Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Scikit-Learn · Class

Isomap

Isomap is a nonlinear dimensionality-reduction estimator that embeds data while preserving geodesic distances. It constructs shortest-path distances on a neighborhood graph and converts them into lower-dimensional coordinates.

Since
1.1

How it works

Isomap builds a neighborhood graph for the training data, estimates shortest-path geodesic distances between points, and uses those distances to construct an embedding through an eigenvalue decomposition. New inputs are connected to training points through their nearest neighbors before their geodesic distances are computed.

Syntax

class sklearn.manifold.Isomap(*, n_neighbors=5, radius=None, n_components=2, eigen_solver='auto', tol=0, max_iter=None, path_method='auto', neighbors_algorithm='auto', n_jobs=None, metric='minkowski', p=2, metric_params=None)

Parameters

NameTypeDescription
n_neighborsint, default=5Number of neighbors used for each point; default 5.
radiusfloat, default=NoneMaximum radius of neighborhoods; default None.
n_componentsint, default=2Number of output coordinates; default 2.
eigen_solver{'auto', 'arpack', 'dense'}, default='auto'Eigenvalue solver selection; default 'auto'.
tolfloat, default=0Tolerance for the eigenvalue solver; default 0.
max_iterint, default=NoneMaximum number of eigenvalue-solver iterations; default None.
path_method{'auto', 'FW', 'D'}, default='auto'Shortest-path algorithm selection; default 'auto'.
neighbors_algorithm{'auto', 'brute', 'kd_tree', 'ball_tree'}, default='auto'Algorithm used for nearest-neighbor search; default 'auto'.
n_jobsint, default=NoneNumber of parallel jobs; default None.
metricstr or callable, default='minkowski'Distance metric for neighbors; default 'minkowski'.
pint, default=2Minkowski power parameter; default 2.
metric_paramsdict, default=NoneAdditional parameters for the distance metric; default None.

Returns

fit_transform returns an array of shape (n_samples, n_components) containing the transformed coordinates.

Key points

  • Isomap is a nonlinear manifold-learning method whose name abbreviates Isometric Mapping.
  • Its objective is a lower-dimensional representation that retains distances measured along the neighborhood manifold.
  • During transformation, each input is connected to its nearest training neighbors before distances are calculated.
  • The estimator obtains shortest-path geodesic distances from each input to the fitted training samples.
  • The output coordinates come from eigenvectors associated with the largest eigenvalues of the Isomap kernel.

Common mistakes

  • Increasing n_components increases the dimensionality of the returned embedding and can raise the cost of the eigenvalue decomposition.

Example: Embed Swiss-roll data

from sklearn.datasets import make_swiss_roll
from sklearn.manifold import Isomap

X, _ = make_swiss_roll(n_samples=300, noise=0.05, random_state=0)
embedding = Isomap(n_neighbors=10, n_components=2).fit_transform(X)
print(embedding.shape)

Generates Swiss-roll data and computes a two-dimensional Isomap embedding.

When to use it

Nonlinear visualization

Visualizing data whose intrinsic structure is curved rather than linearly separable.

Manifold-aware feature reduction

Creating compact features while retaining neighborhood-manifold geometry.

Embedding analysis

Comparing nonlinear embedding methods on synthetic or real datasets.

Interview questions

QWhat does Isomap preserve, and how does it work?

Isomap is a nonlinear dimensionality-reduction estimator that aims to preserve geodesic rather than straight-line distances. It first forms nearest-neighbor relationships, computes shortest paths on that graph, and derives coordinates from the resulting kernel.

Follow-up: How does path_method affect the computation? It selects the shortest-path algorithm, such as Dijkstra or Floyd-Warshall, used for graph distances.

QWhat are the roles of n_neighbors and n_components?

n_neighbors controls how many training neighbors define the graph around each sample. n_components controls the number of coordinates in the final manifold representation.

Follow-up: What can happen with an unsuitable neighborhood size? A graph that is too sparse may not connect the data sufficiently for meaningful global geodesic distances.

QHow are new samples transformed after fitting?

fit_transform learns the Isomap representation from X and returns the transformed coordinates. transform maps new samples using their nearest training neighbors and shortest geodesic distances to the training set.

Follow-up: Why are training points needed during transform? The estimator uses the fitted neighborhood structure and training-derived geodesic information to connect new samples to the learned manifold.

  • sklearn.manifold.ClassicalMDS
  • sklearn.manifold.LocallyLinearEmbedding
  • sklearn.manifold.SpectralEmbedding
  • sklearn.manifold.TSNE
  • sklearn.manifold.MDS

Source: Isomap — scikit-learn 1.9.1 documentation. Checked 2026-10-15.