



Uniform Manifold Approximation and Projection - a non-linear dimensionality reduction technique that preserves both local and global data structure. More scalable than t-SNE while maintaining superior visualization quality and cluster separation for high-dimensional embeddings.
Loading more......
UMAP (Uniform Manifold Approximation and Projection) is a manifold learning technique for dimensionality reduction that seeks to learn the manifold structure of data and find a low-dimensional embedding that preserves the essential topological structure.
Construct Fuzzy Topological Representation:
Optimize Low-Dimensional Layout:
Output Embedding:
n_neighbors:
min_dist:
n_components:
metric:
pip install umap-learn
import umap
import numpy as np
# High-dimensional embeddings
embeddings = np.random.randn(1000, 768)
# Reduce to 2D
reducer = umap.UMAP(
n_neighbors=15,
min_dist=0.1,
n_components=2,
metric='cosine'
)
embedding_2d = reducer.fit_transform(embeddings)
# Visualize
import matplotlib.pyplot as plt
plt.scatter(embedding_2d[:, 0], embedding_2d[:, 1])
plt.show()
# Supervised dimension reduction
reducer = umap.UMAP(n_components=2)
embedding_2d = reducer.fit_transform(X, y=labels)
# Transform new data
new_embedding = reducer.transform(new_data)
# Save and load model
import pickle
with open('umap_model.pkl', 'wb') as f:
pickle.dump(reducer, f)
Recent research explores UMAP's supervised extensions, particularly for regression settings, which remain underexplored compared to classification.
Free and open-source under BSD-3-Clause license.