Skip to content
gmumPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Molecular Uncertainty Gradients: Exact Decomposition of Predictive Variance Onto Molecular Substructures

Molecular Uncertainty Gradients workflow

Most explainability methods for molecular property prediction target predictions rather than uncertainty. Techniques for localizing predictive uncertainty to specific substructures remain comparatively underdeveloped, limiting our ability to identify which substructures drive uncertainty and which chemical patterns the model has not learned reliably. We present Molecular Uncertainty Gradients (MUG), a method that distributes a model's epistemic uncertainty, estimated as the variance across ensemble predictions, over the atoms of a molecule. By differentiating this variance with respect to intermediate atom representations, MUG computes signed atom-level contributions. Under the assumptions stated in the paper, multiplying these contributions by T/2 gives an exact decomposition of the predictive variance, where T is the number of stochastic forward passes. These attributions can be aggregated over any group of atoms using a single backward pass. MUG requires no retraining and works with the dropout-based uncertainty estimates already standard in practice. We show that MUG localizes uncertainty to molecular substructures absent from the training data. Across six molecular property prediction benchmarks, MUG achieves the highest mean occlusion-controlled fidelity in both the regression and classification comparisons. Crucially, masking the features of its highest-ranked atoms reduces model uncertainty substantially more than masking other fragments. We further demonstrate that MUG’s fragment-level uncertainty attributions can guide iterative library design toward compounds with favorable docking scores. Together, these results establish MUG as a complete and faithful approach to localizing predictive uncertainty, with practical applications in uncertainty-guided molecular design.

Setup

Use Python 3.11.5 and run the commands from the repository root.

python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

Reproducing the Results

Prepare the data

python -m src.data.generate_data

This command prepares all six datasets. To prepare just one, pass its name with --datasets (for example, --datasets CYP3A4_Veith).

Occlusion fidelity

After preparing all six datasets, train the models and run the evaluation.

python -m src.training.train_models
python -m experiments.occlusion_fidelity.run
python -m experiments.occlusion_fidelity.aggregate

The summary is written to results/occlusion_fidelity/table1_mug.csv.

Fluorine exclusion on CYP3A4

python -m experiments.element_withholding.run_experiment
python -m experiments.element_withholding.run_localization

Results are written to results/element_withholding/.

License

This project is released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages