liveBook · Manning

Recall

As explained in Build AI Drug Discovery Pipelines

True positive rate is the proportion of actual positive instances correctly predicted as positive.

Recall, also called true positive rate or sensitivity, measures the proportion of actual positive instances that a classifier correctly predicts as positive. section 5.1.3

In drug-discovery classification, recall answers how many known inhibitors the model finds. High recall can matter when missing a true inhibitor is costly, but it may increase false positives. section 5.1.2 section 5.1.3

CYP3A4 inhibition

A logistic regressor evaluated on CYP3A4 inhibition data achieves precision of 0.76 and recall of 0.74, showing why accuracy alone is insufficient under class imbalance. A dummy classifier that always predicts the negative class reaches accuracy of 0.55. section 5.1.2

Interpret recall alongside complementary measures:

  • Compare recall with precision to distinguish recovering positives from correctly excluding negatives. section 7.1.3
  • Use precision-recall curves when positive-class performance or minority positives matter. section 5.1.3
  • Treat retrospective recovery of known hits as recall, not proof of supervised predictive performance. section 7.1.3
Listing 5.1 Train and Evaluate Logistic Regressor on the CYP3A4 Inhibition Data Set
from sklearn.metrics import accuracy_score, precision_score, recall_score
from sklearn.linear_model import LogisticRegression
from tdc.single_pred import ADME
from utils import compute_fingerprint
import numpy as np
import pandas as pd
from rdkit.Chem import PandasTools
 
def process_df(df):
  df = df.rename(columns={'Y': 'Inhibitor'})
  PandasTools.AddMoleculeColumnToFrame(df, 'Drug', 'Molecule')
  df = df.dropna()
  df['fingerprints'] = df['Molecule'].apply(
    compute_fingerprint, r=2, nBits=2048   # r = Morgan radius; 2048-bit vector
  )
  fingerprints = np.stack(df.fingerprints.tolist())
 
  return df, fingerprints
 
data = ADME(name='CYP3A4_Veith')
splits = data.get_split('scaffold')
train_df, valid_df, test_df = \
  splits['train'], splits['valid'], splits['test']
train_df, train_fingerprints = process_df(train_df)
val_df, val_fingerprints = process_df(valid_df)
test_df, test_fingerprints = process_df(test_df)
 
lr_model = LogisticRegression()
lr_model.fit(train_fingerprints, train_df.Inhibitor)
 
val_preds = lr_model.predict(val_fingerprints)    #A
val_proba_inhibitor = lr_model.predict_proba(val_fingerprints)[:, 1]    #B
 
print(f"Accuracy: {accuracy_score(val_df.Inhibitor, val_preds):.2f}")
# Output -> Accuracy: 0.78
print(f"Precision: {precision_score(val_df.Inhibitor, val_preds):.2f}")
# Output -> Precision: 0.76
print(f"Recall: {recall_score(val_df.Inhibitor, val_preds):.2f}")
# Output -> Recall: 0.74

Run the logistic-regression workflow to calculate recall alongside accuracy and precision on scaffold-split CYP3A4 data. section 5.1.2

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Explains recall through classifier metrics, threshold trade-offs, curves, and retrospective enrichment, but does not derive its formula.
Examples
Uses CYP3A4 inhibition classification, a negative-class baseline, logistic regression, and SOM-based drug-repurposing hits.
What it assumes
Assumes binary class labels and predictions while reinforcing why accuracy alone can mislead under class imbalance.
What you can do after
Evaluate classifiers with scikit-learn recall, compare recovery against precision, and interpret threshold-dependent positive-class performance.
How it connects
Connects recall to precision, accuracy, sensitivity, specificity, false-positive rate, class imbalance, and precision-recall curves.

Also explained in

Compare how 35 books explain recall →

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.