Model agnostic generation of counterfactual explanations for molecules



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.


Supplementary weblinks

Associated code for paper packaged as library