liveBook · Manning

UMAP

As explained in Graph Neural Networks in Action

UMAP is a nonlinear dimensionality-reduction technique that projects high-dimensional data into a lower-dimensional space while attempting to preserve local and global structure.

UMAP reduces high-dimensional embeddings to two or three dimensions for visual analysis, keeping similar nodes near one another while retaining broader structural relationships. section 2.1.3

A practical graph-embedding workflow uses UMAP as a visualization stage:

  • Generate node embeddings with Node2Vec, convert them to a numerical array, and fit UMAP with a chosen number of components. section 2.1 section 2.1.3
  • Tune n_neighbors to balance local detail against broader structure, and use min_dist to influence how closely points can cluster. section 2.1.3
  • Plot the resulting two-dimensional coordinates and use node colors or shapes to inspect possible clusters and relationships. section 2.1.3

Political Books graph

Applying UMAP to Node2Vec embeddings of 105 political books and 441 co-purchase edges reveals potential clusters associated with liberal, conservative, and neutral political leanings. section 2.1 section 2.1.3

Listing 2.2 Visualizing the embeddings using UMAP
node_embeddings = [embeddings[str(node)] \
for node in gml_graph.nodes()]   #1
node_embeddings_array = np.array(node_embeddings)  

umap_model = umap.UMAP(n_neighbors=15, min_dist=0.1, n_components=2, \
random_state=42)
umap_features = umap_model.fit_transform\
(node_embeddings_array)  #2

plt.scatter(umap_features[:, 0], \
umap_features[:, 1], color=node_colors, alpha=0.7)  #3

The implementation initializes UMAP with 15 neighbors, a 0.1 minimum distance, two components, and a fixed random state before plotting the transformed coordinates. section 2.1.3

How Graph Neural Networks in Action covers it

How deep it goes
Explains projection goals and tuning parameters, then demonstrates Python usage; stops short of mathematical derivation.
Examples
Visualizes Political Books Node2Vec embeddings and compares UMAP with direct two-dimensional Node2Vec visualization and t-SNE.
What it assumes
Assumes Node2Vec embeddings and numerical-array handling, while introducing dimensionality reduction through a graph-visualization workflow.
What you can do after
Apply it via Python to project embeddings into two dimensions and plot interpretable graph-structure visualizations.
How it connects
Connects UMAP to dimensionality reduction, Node2Vec, graph embeddings, t-SNE, clustering, and graph topology.

Also explained in

Compare how 3 books explain UMAP →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Neural Networks in Action. The section links point to the parts of the book it draws on.