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
