My UMAP plot shows one big blob (or many tiny fragments). Which parameters should I change?
What the parameters do
n_neighbors (default 15) controls the balance between local and global structure. Small values focus on fine local detail and can break the data into many small pieces. Large values show broader structure but can blur small groups.
min_dist (default 0.1) controls how tightly points are packed in the output. Small values make dense, compact clusters. Larger values spread points out, which can make the overall shape easier to see.
metric (default "euclidean") defines how distances are measured in the input space.
Answer 1: Adjust n_neighbors based on what you see
If you see many tiny fragments, increase n_neighbors (e.g. 30–100). If everything merges into one blob, decrease it (e.g. 5–10). A grid of plots makes the effect clear:
fig, axes = plt.subplots(2, 3, figsize=(18, 10))
for ax, (nn, md) in zip(axes.ravel(), [(5, 0.1), (15, 0.1), (50,
0.1),
(15, 0.0), (15, 0.5), (15,
0.99)]):
emb = umap.UMAP(n_neighbors=nn, min_dist=md,
random_state=42).fit_transform(X_scaled)
ax.scatter(emb[:, 0], emb[:, 1], c=y, s=3, cmap="tab10")
ax.set_title(f"n_neighbors={nn}, min_dist={md}")
plt.show()
