Normalization rescales features so their magnitudes behave consistently during model training. In molecular graphs, atom feature vectors are divided by their sums, producing vectors that sum to 1 and improving numerical stability. section 11.2.2
Protein residue features use a different strategy: continuous biochemical properties are linearly scaled to [0, 1]. This prevents larger-valued properties from dominating learned representations, while categorical one-hot features remain unsummed. section 11.3.2
Choose normalization according to the representation:
- Normalize each atom vector by its feature sum; mostly one-hot vectors therefore become quasi-probability distributions. section 11.2.2
- Scale continuous residue properties between the observed minimum and maximum; encode an unknown residue at the midpoint. section 11.3.2
Atom-vector normalization
For each atom, compute its feature array and divide by sum(feature) plus a small epsilon. The resulting vector sums approximately to 1 without risking division by zero. section 11.2.2
Listing 11.1 Convert SMILES String to Graph Representation
def smile_to_graph(smiles: str) -> Tuple[int, List, List]:
mol = Chem.MolFromSmiles(smiles)
if mol is None:
raise ValueError(f"Invalid SMILES: {smiles}")
num_atoms = mol.GetNumAtoms()
features = []
for atom in mol.GetAtoms(): #A
feature = atom_features(atom)
features.append(feature / (sum(feature) + 1e-10))
# Extract bonds
edges = []
for bond in mol.GetBonds(): #B
edges.append([bond.GetBeginAtomIdx(), bond.GetEndAtomIdx()])
g = nx.Graph(edges).to_directed()
edge_index = []
mol_adj = np.zeros((num_atoms, num_atoms)) #C
for e1, e2 in g.edges:
mol_adj[e1, e2] = 1
mol_adj += np.matrix( #D
np.eye(mol_adj.shape[0]) #D
) #D
index_row, index_col = np.where(mol_adj >= 0.5)
for i, j in zip(index_row, index_col): #E
edge_index.append([i, j])
return num_atoms, features, edge_indexInspect the graph-construction listing to see normalization applied while converting atom features into a molecular graph. section 11.2.2























