Overview

5 Classification: Cytochrome P450 Inhibition

Metabolism is a central concern in drug discovery because many drugs are cleared by the body through enzymatic breakdown, and inhibition of these enzymes can strongly alter drug exposure, efficacy, and safety. The chapter focuses on cytochrome P450 inhibition, especially CYP3A4, as a practical classification task for high-throughput screening. Using molecular fingerprints and a curated inhibition data set, it frames the problem as predicting whether a compound should be filtered out as a likely inhibitor, with an emphasis on the importance of calibration, thresholding, and uncertainty in decision-making.

The chapter begins with logistic regression as a foundational binary classifier, explaining how the sigmoid function turns linear scores into probabilities and how binary cross-entropy guides training. It then moves beyond raw accuracy to metrics better suited to imbalanced data, such as precision, recall, PR AUC, and ROC AUC, while also showing how to select operating thresholds and interpret model outputs through log-odds and odds ratios. To make probabilistic predictions more trustworthy, it introduces calibration diagnostics like reliability plots and summary measures such as RMSCE, ECE, MCE, and Brier score, along with post-hoc fixes like Platt scaling and isotonic regression.

To improve performance and flexibility, the chapter next covers decision trees and then ensemble methods, especially random forests, which reduce variance through bagging and feature subsampling. It discusses how to address class imbalance through sampling, class weighting, and augmentation, and shows how to interpret models using feature importance and similarity maps. Finally, it expands the problem to multiclass and multilabel settings for multiple CYP targets, using appropriate metrics for ranking and coverage, and closes by emphasizing applicability-domain checks so predictions are only trusted when the model has enough support from the input space.

Comparing the difference in use cases between linear classifiers, linear regressors, and logistic regressors.
Reliability diagram with error bars for logistic regressor trained on CYP 3A4 data set. Probability estimates, RMSCE, and BS derived from predictions on validation set.
Reliability diagram for the logistic regressor after undergoing calibration via platt scaling or isotonic regression.
Decreasing the decision threshold will capture more true positives, but could also result in more false positives.
PR and ROC curves for the logistic regressor and the random baseline.
Visualizing a depth 2 decision tree constructed with consideration of molecular weight and logP.
Example of how 5 of the validation set molecules would traverse the decision tree from figure 5.6 during inference time.
Comparison of downsampling and upsampling on the training data set’s class composition.
How a Random Forest is constructed via a decision tree ensemble and applied at inference time.
Example of a similarity map with a validation set molecule and our Random Forest classifier.
Comparison of bag-wrapper and instance-wrapper variants of multiple-instance learning.
PR curves and AUC performance on our custom multilabel classification task.

Summary

  • In drug discovery, metabolism refers to the body’s ability to break down foreign molecules called xenobiotics, which includes drugs. Drugs are metabolized so that the molecules and their effects may be eliminated from the body. The duration and intensity of a drug’s action are dependent on how the drug is metabolized.
  • The Cytochrome P450 (CYP) superfamily of 57 enzymes aids in the elimination of over 40% of drugs and CYPs 1A2, 2C9, 2C19, 2D6, 3A4 account for almost 90% of CYP-mediated metabolism. Inhibition, or blockage, of a CYP or another metabolic enzyme could significantly shift the pharmaceutical effect of other drugs or chemicals in the body, resulting in a drug-drug interaction (DDI).
  • Logistic regression helps us make predictions for binary outcomes by transforming inputs into a range of values from 0 to 1, inclusive. Logistic regression is typically used for classification by defining a decision boundary or threshold to binarize its probability estimates into class predictions. We can assess model performance over a range of possible decision thresholds via precision-recall (PR) and receiver operating characteristic (ROC) curves.
  • Calibrated models build trust in their predictions and increase transparency for users, leading to increased acceptance and adoption. We can diagnose miscalibration with reliability diagrams, root mean squared calibration error, and Brier score. We can correct miscalibration with post-training calibration methods such as platt scaling and isotonic regression or by computing an optimal decision threshold with Youden’s index.
  • Decision trees are like flowcharts – breaking down a complex problem into a series of simpler decisions. Imagine that the model is playing a guessing game, asking questions to help it narrow down the possibilities until it arrives at an answer. Each node in a decision tree represents a decision based on a specific feature. Starting from the root node, the tree branches out, with each branch representing a decision. The goal of the decision process is to reach a leaf node in the tree, which will provide the final prediction.
  • Random Forest ensembles sample different subsets of data to train multiple decision trees, introducing an extra layer of randomness by considering only a random subset of features at each split in the tree-building process. This feature subsampling helps decorrelate the trees, making the ensemble even more diverse. Random Forests greatly reduce decision tree variance while holding on to their ability to achieve low bias.
  • Binary classification only models two possible classes. Multiclass classification is a type of ML task where the algorithm’s goal is to learn to categorize data points into more than two distinct classes or categories. Each class represents a different possible outcome, and the model is trained to make predictions that assign a new input to one of these classes. In contrast, multilabel classification predicts a set of labels for each instance and is applicable when an instance can simultaneously belong to multiple classes. Multilabel performance can be summarized with ranking metrics such as coverage error and ranking loss and, when aggregating per-class metrics like F1, with micro- or macro-averaging depending on whether frequent or rare labels should dominate.

FAQ

What is Cytochrome P450 inhibition and why does it matter in drug discovery?Cytochrome P450 inhibition refers to blocking CYP enzymes that help metabolize drugs and other xenobiotics. It matters because CYP inhibition can raise or lower drug concentrations in the body, causing drug-drug interactions, altered efficacy, and potential toxicity.
Which Cytochrome P450 enzymes are most important in this chapter?The chapter focuses on CYP3A4 inhibition, and it also notes that CYP1A2, CYP2C9, CYP2C19, CYP2D6, and CYP3A4 account for most CYP-mediated metabolism in drug discovery applications.
Why is logistic regression used for CYP3A4 inhibition prediction?Logistic regression is a simple binary classification model that maps features to probabilities between 0 and 1. It is useful for predicting whether a molecule is an inhibitor or noninhibitor of CYP3A4.
What loss function is used to train logistic regression in this chapter?The model is trained using binary cross-entropy (BCE) loss, which measures how close the predicted probability is to the true binary label. Lower BCE loss means better predictions.
Why is accuracy not enough to evaluate a CYP inhibition classifier?Accuracy can be misleading when classes are imbalanced. In this chapter, a dummy classifier could achieve decent accuracy by predicting the majority class, so precision, recall, PR AUC, and ROC AUC provide a more informative picture.
What is calibration, and why is it important for probability estimates?Calibration checks whether predicted probabilities match observed frequencies. A well-calibrated model that predicts 0.8 should be correct about 80% of the time for similar cases, which is important when probabilities guide decision-making.
How do Platt scaling and isotonic regression improve model calibration?Platt scaling fits a logistic regression model on the original model’s scores to produce calibrated probabilities, while isotonic regression fits a monotonic non-parametric function. Both can improve calibration, with isotonic regression often being more flexible but also more prone to overfitting.
How are decision trees used for CYP inhibition classification?Decision trees split compounds using feature thresholds, such as molecular weight or logP, until they reach leaf nodes that assign a class prediction. They are easy to interpret and can also output probability estimates based on training samples in a leaf.
What is the difference between bagging and random forests?Bagging trains many models on bootstrap samples and combines their predictions, while random forests add feature subsampling at each split to further decorrelate the trees. This usually reduces variance and improves generalization.
How does the chapter handle multiclass versus multilabel CYP inhibition problems?The chapter explains that CYP inhibition across several enzymes is better framed as multilabel classification, because a molecule may inhibit none, one, or multiple CYPs. Multilabel models predict each label independently, unlike multiclass models that assume exactly one class per instance.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Build AI Drug Discovery Pipelines ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Build AI Drug Discovery Pipelines ebook for free