umap-learn

Applies UMAP dimensionality reduction for visualization, clustering preprocessing, and supervised embeddings.

Updated Oct 7, 2022
One-click install
npx skills add https://github.com/tamagusko/linux-cfg --skill umap-learn-tamagusko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: umap-learn
Source: https://github.com/tamagusko/linux-cfg/tree/main/dotfiles/claude/skills/umap-learn
Command: npx skills add https://github.com/tamagusko/linux-cfg --skill umap-learn-tamagusko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires umap-learn, and includes references (resource) components.

What problem does it solve? High-dimensional data is hard to visualize, cluster, and feed into machine learning models. This Skill guides the correct use of the umap-learn library to produce nonlinear embeddings that preserve local and global structure, avoiding common pitfalls like poor parameter choices and missing preprocessing. ## Core Features & Use Cases - Visualization Embeddings: Generate 2D/3D embeddings with tuned n_neighbors, min_dist, and metric parameters for scatter-plot exploration. - Clustering Preprocessing: Configure UMAP (n_neighbors=30, min_dist=0.0, n_components=5-10) as input to HDBSCAN for density-based clustering. - Supervised and Parametric UMAP: Use labels for class-separated embeddings, transform new data with trained models, and build neural-network encoders with ParametricUMAP. - Use Case: Given a matrix of standardized single-cell or document features, produce a 2D UMAP scatter plot colored by cluster labels, then reuse the fitted reducer to project new samples into the same space. ## Quick Start Ask the AI to reduce your standardized dataset to a 2D UMAP embedding with umap-learn and plot it colored by label.

Frequently Asked Questions about umap-learn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use UMAP for dimensionality reduction in Python?

Install umap-learn, standardize your data with StandardScaler, then call umap.UMAP().fit_transform(scaled_data) to get a 2D embedding. UMAP follows scikit-learn conventions, so it works as a drop-in replacement for t-SNE or PCA.

What UMAP parameters should I use for clustering with HDBSCAN?

For clustering preprocessing, set n_neighbors=30, min_dist=0.0, and n_components=5-10 before running HDBSCAN. These values preserve density better than visualization defaults and produce clearer cluster boundaries.

UMAP vs t-SNE: which is better for visualization?

UMAP scales well in embedding dimension and supports transforming new data after fitting, unlike t-SNE. It also preserves more global structure and runs faster on large datasets, making it suitable beyond 2D visualization.

Can UMAP transform new data after training?

Yes, a fitted UMAP model's transform() method projects new data into the learned embedding space. This assumes the test distribution matches training; for differing distributions or faster inference, use ParametricUMAP instead.

Why does my UMAP embedding show fragmented or disconnected clusters?

Fragmented clusters usually mean n_neighbors is too low, overemphasizing local structure. Increase n_neighbors toward 50-100 to capture more global structure, and verify your features are properly standardized first.

How do I make UMAP results reproducible?

Set the random_state parameter, for example umap.UMAP(random_state=42). UMAP uses stochastic optimization, so without a fixed seed the embedding will vary slightly between runs.