liveBook · Manning

Feature engineering

As explained in Build AI Drug Discovery Pipelines

Feature engineering is the manual design or selection of input representations intended to expose task-relevant patterns to a predictive model.

Feature engineering manually designs or selects input representations that expose task-relevant patterns to predictive models. In drug discovery, features can include molecular weight, atom and bond counts, rotatable bonds, or enumerated molecular substructures. These representations help models learn relationships between chemical patterns and properties such as druglikeness, toxicity, or solubility. section 1.3.2

A practical molecular feature workflow can:

  • Represent a molecule as a graph whose nodes are atoms and whose edges are chemical bonds. section 11.2.2
  • Encode each atom with a multi-hot vector containing its element, degree, hydrogen count, implicit valence, and aromaticity. section 11.2.2
  • Add reverse bond edges and self-loops so graph models can aggregate neighboring information while retaining each atom’s own features. section 11.2.2

A 78-dimensional atomic representation

An atom feature function concatenates one-hot encodings for element symbol, degree, total hydrogen count, and implicit valence, then appends an aromaticity indicator. The resulting vector supplies a graph neural network with informative chemical inputs before it learns more complex derived features. section 11.2.2 section 11.8

Listing 11.2 Generate 78-dimensional Feature Vector for a Single Atom
def atom_features(atom):
    features = []
    features += one_of_k_encoding_unk(
        atom.GetSymbol(), ATOM_SYMBOLS
    )
    features += one_of_k_encoding_unk(
        atom.GetDegree(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    )
    features += one_of_k_encoding_unk(
        atom.GetTotalNumHs(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    )
    features += one_of_k_encoding_unk(
        atom.GetImplicitValence(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    )
    features += [int(atom.GetIsAromatic())]
 
    return np.array(features, dtype=np.float32)

Inspect the complete atom_features implementation, including unknown-category handling and the five encoded atomic properties. section 11.2.2

Manual features are useful but intrinsically limited: they include only relationships researchers already know to be relevant. Deep learning can learn task-specific features whose relevance is unknown, potentially reducing bias from established substructures and human-derived rules. section 1.3.2

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Explains feature choices and graph encoding through implementation details, while deferring exhaustive chemistry rules and learned-feature design.
Examples
Uses molecular weight, atom counts, rotatable bonds, substructures, and 78-dimensional atom vectors as concrete representations.
What it assumes
Assumes basic molecules and predictive models, while defining chemical graph structure and atomic encodings through concrete code.
What you can do after
Build it from scratch by converting SMILES into molecular graphs and constructing normalized atomic feature vectors.
How it connects
Connects molecular graphs, graph neural networks, deep learning, virtual screening, and de novo drug design.

Also explained in

Compare how 24 books explain feature engineering →

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.