Model agnostic generation of counterfactual explanations for molecules

16 August 2021, Version 1
This content is a preprint and has not undergone peer review at the time of posting.


An outstanding challenge in deep learning is its lack of interpretability. The inability of both designers and users of neural networks to explain why a prediction is made is a major drawback. This not only dissuades chemists from using deep learning predictions, but also has led to neural networks learning spurious correlations that are difficult to notice. Counterfactuals are a category of prediction explanations that provide a rationale behind the prediction value. Counterfactuals have satisfying properties like being in the same space as the features and require no deep learning expertise to understand. Counterfactuals are generated via optimization, which makes them complex to use when the features are chemical structures. Here we present an algorithm built on the "Superfast Traversal, Optimization, Novelty, Exploration and Discovery" method (Nigam et. al, 2021) that is efficient and model-agnostic for generating counterfactuals. We show this method is applicable in random forest models, sequence models, and graph neural networks in both classification and regression. Our method requires no additional training, data, or model gradients.


deep learning
machine learning

Supplementary weblinks


Comments are not moderated before they are posted, but they can be removed by the site moderators if they are found to be in contravention of our Commenting Policy [opens in a new tab] - please read this policy before you post. Comments should be used for scholarly discussion of the content in question. You can find more information about how to use the commenting feature here [opens in a new tab] .
This site is protected by reCAPTCHA and the Google Privacy Policy [opens in a new tab] and Terms of Service [opens in a new tab] apply.