liveBook · Manning

MaxMin

As explained in Build AI Drug Discovery Pipelines

The MaxMin algorithm iteratively selects points that are maximally distant from points already selected.

MaxMin is a diversity-selection technique that builds a compound subset by repeatedly choosing the molecule whose nearest already-selected molecule is as distant as possible. It helps explore chemical space instead of reproducing overrepresented scaffolds or functional groups. section 7.2.4 section 9.2.4

A typical MaxMin workflow is:

  • Represent compounds with molecular fingerprints or descriptors. section 7.2.4
  • Select one compound at random or choose one near the distribution center. section 9.2.4
  • Iteratively select the compound that maximizes its minimum dissimilarity to the selected subset. section 7.2.4 section 9.2.4

Diverse docking initialization

For an imbalanced chemical library, MaxMin can initialize an active-learning pool before expensive molecular docking. By avoiding highly similar molecules, the initial surrogate model sees more molecular features and scaffolds, potentially increasing information gain and the chance of including rare active compounds. section 9.2.4

Listing 9.7 Initial Sampling – Random or Diverse
def initialize_samples(
    X_pool, initialization: str, n_samples: int
) -> np.ndarray:
    """Initialize samples either randomly or using diversity picking."""
    if initialization == 'random':
        print("Selecting initial samples randomly...")
        return np.random.choice(len(X_pool), size=n_samples, replace=False)
    elif initialization == 'diverse':
        print("Selecting initial samples following MaxMin diversity...")
        picker = rdSimDivPickers.MaxMinPicker()    #A
        fps_for_diversity = [
            list(fp) for fp in X_pool
        ]    #B
        picked = list(picker.LazyBitVectorPick(    #C
            fps_for_diversity, 
            len(fps_for_diversity),
            n_samples
        ))
        return np.array(picked)
    else:
        raise ValueError(f"Unknown initialization method: {initialization}")

Use RDKit’s MaxMinPicker to select diverse compounds from fingerprint vectors without implementing the picker from scratch. section 9.2.4

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Defines the selection rule and workflow, then demonstrates RDKit usage without detailing the picker’s internal implementation.
Examples
Uses fingerprint-based initial sampling to expose a surrogate model to varied scaffolds before docking.
What you can do after
Apply it via RDKit’s MaxMinPicker to select a diverse molecular subset.
How it connects
Connects molecular fingerprints, dissimilarity metrics, MaxSum, Kennard-Stone, clustering, molecular docking, and active learning.

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.