liveBook · Manning

Dimensionality reduction

As explained in Graph Neural Networks in Action

Dimensionality reduction is the transformation of data into a representation with fewer numerical dimensions while retaining selected information or structure.

Dimensionality reduction transforms high-dimensional data into fewer numerical dimensions while preserving selected information or structure. It makes graph embeddings easier to visualize and can expose clusters or patterns useful for clustering and classification. section 2.1 section 5.1.2

A practical graph-embedding workflow is:

  • Generate node embeddings with Node2Vec, using random walks to summarize local neighborhoods as vectors. section 2.1
  • Collect the embedding vectors into a NumPy array suitable for transformation. section 2.1.3
  • Use UMAP with two components to project the vectors into a two-dimensional visualization. section 2.1.3
  • Compare the result with embeddings generated directly at two dimensions when the task permits a less expressive representation. section 2.1.3

Dimensionality reduction also appears inside generative models. Autoencoders compress high-dimensional data into a low-dimensional latent space and decode it again; variational autoencoders add a regularizing term that produces a more structured, continuous space. Graph autoencoders and variational graph autoencoders apply the same pattern to graphs and support edge prediction. section 5.6

Political Books graph

Node2Vec embeddings of the Political Books dataset are projected with UMAP and colored by political alignment. The two-dimensional plot reveals clusters corresponding to liberal, conservative, and neutral books. Direct two-dimensional Node2Vec produces similar separation but bunches the books more tightly, showing that the useful representation depends on the task. 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

Run the UMAP projection and scatterplot workflow for converting Node2Vec vectors into a two-dimensional graph visualization. section 2.1.3

How Graph Neural Networks in Action covers it

How deep it goes
Explains projection workflows, direct 2D alternatives, and autoencoder latent spaces, but defers technical theory and mathematical derivations.
Examples
Demonstrates Political Books embeddings, UMAP plots, direct two-dimensional Node2Vec, synthetic data, and graph autoencoder representations.
What it assumes
Assumes familiarity with graph embeddings while introducing compression, latent spaces, and visualization through concrete graph examples.
What you can do after
Apply it via UMAP or Node2Vec to create two-dimensional embedding visualizations and interpret relative clustering.
How it connects
Connects Node2Vec, UMAP, PCA, autoencoders, variational autoencoders, latent spaces, clustering, classification, and edge prediction.

Also explained in

Compare how 11 books explain dimensionality reduction →

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.