liveBook · Manning

Graph pooling

As explained in Build AI Drug Discovery Pipelines

A readout, or global pooling operation, aggregates node representations into a fixed-size graph-level representation.

Graph pooling, also called readout or global pooling, combines node representations into one fixed-size graph vector. This lets graph neural networks represent molecules and proteins of different sizes with equal-length embeddings before fusing drug and protein branches for drug-target affinity prediction. section 11.4

Common pooling choices differ in how they summarize node information:

  • Mean pooling averages every node vector, producing a size-normalized aggregate that is less sensitive to outliers. section 11.5.2
  • Sum pooling adds node vectors, while maximum pooling selects feature-wise maxima. section 11.4 section 11.5.2
  • Pooling is permutation-invariant, so reordering nodes does not change the graph representation. section 11.4

Pooling a batched molecular graph

After three GCN layers expand molecular node features from 78 to 312 dimensions, `global_mean_pool(x, mol_batch)` computes one 312-dimensional vector per molecule. The batch vector preserves graph boundaries while PyTorch Geometric stores all nodes together; fully connected layers can then compress each vector to a 128-dimensional embedding. section 11.5.2

x = global_mean_pool(x, mol_batch)

Inspect the PyTorch Geometric operation that performs global mean pooling over batched molecular graphs. section 11.5.2

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Defines mean, sum, and maximum pooling, then works through batched mean pooling and its role before fully connected layers.
Examples
Uses global mean pooling on batched molecular graphs after three GCN layers, followed by compression to a 128-dimensional embedding.
What it assumes
Assumes graph nodes, node features, GCN layers, and mini-batches; defines pooling's graph-size normalization role.
What you can do after
Apply it via PyTorch Geometric to aggregate batched node features into fixed-size graph embeddings.
How it connects
Connects node representations, graph neural networks, GCN layers, graph embeddings, and drug-target affinity prediction.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.