# Chemprop

**Chemprop** 是一个基于 PyTorch 构建的开源 Python 包，用于训练和评估消息传递神经网络（MPNN），从分子和反应的结构预测其性质。<sup>[1](https://chemprop.readthedocs.io/en/main/)</sup> 该包最初为麻省理工学院的凯文·杨（Kevin Yang）、凯尔·斯旺森（Kyle Swanson）、金文刚（Wengong Jin）、康纳·科利（Connor Coley）及其同事 2019 年的研究而开发，后来在麻省理工学院与维也纳工业大学化学工程研究员埃斯特·海德（Esther Heid）及其同事 2024 年的一篇应用简报中作了介绍。<sup>[1](https://chemprop.readthedocs.io/en/main/)</sup><sup> • </sup><sup>[2](https://pubs.acs.org/doi/10.1021/acs.jcim.3c01250)</sup> 它实现了一种有向消息传递神经网络（D-MPNN）架构，从分子图端到端地学习分子表示，无需手工设计的描述符或指纹。<sup>[3](https://pubs.acs.org/doi/10.1021/acs.jcim.5c02332)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | 基于 PyTorch 的框架，用于训练和评估消息传递神经网络以预测分子性质<sup>[1](https://chemprop.readthedocs.io/en/main/)</sup> |
| 架构 | 有向消息传递神经网络（D-MPNN）；消息沿有向键传递，而非在原子之间传递<sup>[3](https://pubs.acs.org/doi/10.1021/acs.jcim.5c02332)</sup><sup> • </sup><sup>[4](https://chemprop.readthedocs.io/en/latest/tutorial/python/models/message_passing.html)</sup> |
| 输入 | SMILES 字符串或 RDKit 对象；分子表示为图，原子为顶点，键为边<sup>[5](https://chemprop.com/)</sup><sup> • </sup><sup>[6](https://doi.org/10.1016/j.compchemeng.2025.109253)</sup> |
| 关键论文 | 凯文·杨（Kevin Yang）等（2019）；埃斯特·海德（Esther Heid）等，*J. Chem. Inf. Model.* 64(1):9–17（2024）；大卫·E·格拉夫（David E. Graff）等（v2），*J. Chem. Inf. Model.* 66(1):28–33（2025）<sup>[1](https://chemprop.readthedocs.io/en/main/)</sup><sup> • </sup><sup>[2](https://pubs.acs.org/doi/10.1021/acs.jcim.3c01250)</sup><sup> • </sup><sup>[3](https://pubs.acs.org/doi/10.1021/acs.jcim.5c02332)</sup> |
| 许可证 | 自由开源，采用 MIT 许可证<sup>[7](https://pypi.org/project/chemprop/)</sup> |
| 当前版本 | v2.3.1，文档撰写时的最新版本<sup>[8](https://github.com/chemprop/chemprop/releases)</sup> |
| 著名应用 | 预测对大肠杆菌的抗生素活性，由此发现了抗生素候选物海利霉素<sup>[7](https://pypi.org/project/chemprop/)</sup> |

## 架构

Chemprop 将每个分子表示为一个图，节点为原子，边为键，每条键被视为两条有向边以捕捉方向性。<sup>[6](https://doi.org/10.1016/j.compchemeng.2025.109253)</sup> 该包由四个模块组成：局部特征编码函数、从局部特征学习原子嵌入的有向消息传递神经网络、将原子嵌入合成为分子嵌入的聚合函数，以及将分子嵌入转换为目标性质的标准前馈神经网络。<sup>[9](https://bioinformatica-iib.github.io/quimioinformatica/practicos/TP03/material/Heid%282024%29.pdf)</sup>

**有向消息传递。** Chemprop 倾向于采用 [D-MPNN](https://www.edgepedia.org/zh/d-mpnn) 方案，实现为 `BondMessagePassing`，其中消息在有向边（键）之间传递，而非像传统 MPNN 那样在节点（原子）之间传递——该包也以 `AtomMessagePassing` 的形式提供传统方案。<sup>[4](https://chemprop.readthedocs.io/en/latest/tutorial/python/models/message_passing.html)</sup> 在键方案中，每条有向键维护一个隐藏表示，对来自相邻键的消息求和，在最终迭代后将每个原子的消息通过学习到的权重矩阵和激活函数聚合为原子表示。<sup>[10](https://chemprop.readthedocs.io/en/main/autoapi/chemprop/nn/message_passing/index.html)</sup>

消息传递层的超参数可自定义：隐藏维度（默认 300）、是否使用偏置项（默认否）、消息传递迭代次数（默认 3）、消息是否在无向边上传递（默认否）、丢弃概率（默认 0.0，即不丢弃）以及激活函数（默认 ReLU）。<sup>[4](https://chemprop.readthedocs.io/en/latest/tutorial/python/models/message_passing.html)</sup> 消息传递的输出是一个形状为（批次中原子数）×（隐藏表示长度）的张量。<sup>[4](https://chemprop.readthedocs.io/en/latest/tutorial/python/models/message_passing.html)</sup>

## 使用

Chemprop 主要通过命令行界面操作，包含五个子命令：`train` 用于拟合模型，`predict` 用于应用预训练模型，`convert` 用于转换模型，`fingerprint` 用于编码学习到的潜在表示，`hpopt` 用于超参数优化。<sup>[11](https://chemprop.readthedocs.io/en/main/cmd.html)</sup> 训练和预测接受 SMILES 列和反应列、批次大小、加速器和设备设置、反应模式（如 `REAC_DIFF`）以及原子特征化模式（包括 `V1`、`V2`、`ORGANIC` 和 `RIGR`）。<sup>[11](https://chemprop.readthedocs.io/en/main/cmd.html)</sup> Python API 提供相同的组件，包括数据集、数据加载器、特征化器、聚合、预测器和多组分模型。<sup>[1](https://chemprop.readthedocs.io/en/main/)</sup>

安装可通过 PyPI 或 conda、从源码用 pip 或 `environment.yml` 文件、或通过 Docker 进行；开发者建议使用虚拟环境，并在 Python 3.11 和 3.12 上测试。<sup>[12](https://chemprop.readthedocs.io/en/main/installation.html)</sup> Docker 镜像仅在 CPU 上运行，不过使用 NVIDIA GPU 的 Linux 用户可修改 Dockerfile 以启用 GPU。<sup>[12](https://chemprop.readthedocs.io/en/main/installation.html)</sup>

## 第二版重写

最初的 Chemprop 版本主要面向命令行使用，而非通过 Python API 进行编程调用。一次从头开始的重写以 v2.0.0 发布，由麻省理工学院化学工程研究员大卫·E·格拉夫（David E. Graff）及其同事描述，满足了 Python 工作流对模块化的需求，并在速度、可扩展性和用户体验方面有所改进。<sup>[1](https://chemprop.readthedocs.io/en/main/)</sup><sup> • </sup><sup>[3](https://pubs.acs.org/doi/10.1021/acs.jcim.5c02332)</sup> 一份迁移指南记录了 v1 与 v2 之间 CLI 参数的逐项对比及默认超参数的变化。<sup>[1](https://chemprop.readthedocs.io/en/main/)</sup>

随后的 v2 版本增加了大量功能。2.1.0 版引入了不确定性量化模块，涵盖估计、校准和评估，包括集成和丢弃预测器、保形和保序校准器，以及证据、MVE 和狄利克雷不确定性预测器；它还将损失函数和指标切换为 `torchmetrics`，并以重复实验取代交叉验证。<sup>[8](https://github.com/chemprop/chemprop/releases)</sup> 2.2.0 版完成了 v1 功能的重实现，增加了原子和键性质预测，并支持通过 `--from-foundation` 参数和 `CheMeleon` 模型对基础模型进行微调。<sup>[8](https://github.com/chemprop/chemprop/releases)</sup> 2.3.0 版增加了 Myerson 值可解释性方法。<sup>[8](https://github.com/chemprop/chemprop/releases)</sup>

**特征化速度。** Chemprop 可使用 cuik-molmaker——一个加速原子和键特征化的 C++/Python 包；使用它可将训练加速 1.6 倍、推理加速 2.4 倍，同时减少约 80% 的内存占用，且在所有安装选项中默认安装。<sup>[8](https://github.com/chemprop/chemprop/releases)</sup><sup> • </sup><sup>[12](https://chemprop.readthedocs.io/en/main/installation.html)</sup> v2.3.1 版将 cuik-molmaker 的支持扩展到反应，据报道在反应数据上训练可加速 3 倍。<sup>[8](https://github.com/chemprop/chemprop/releases)</sup>

## 应用与基准测试

2024 年的应用简报在多种示例任务和数据集上展示并基准测试了 Chemprop，发现其在分子性质预测方面与公共排行榜上的其他方法相比具有竞争力。<sup>[2](https://pubs.acs.org/doi/10.1021/acs.jcim.3c01250)</sup> 该研究的基准测试脚本和数据可在配套仓库中获取，数据集托管在 Zenodo 上。<sup>[13](https://github.com/chemprop/chemprop_benchmark/blob/main/README.md)</sup>

Chemprop 已被用于其开发者列出的多项已发表应用。在 2020 年《细胞》杂志一篇关于抗生素发现深度学习方法的论文中，Chemprop 预测了对大肠杆菌的抗生素活性，由此发现了海利霉素——一种新型抗生素候选物，模型检查点已发布在 Zenodo 上。<sup>[7](https://pypi.org/project/chemprop/)</sup> 2023 年《自然》杂志一篇论文使用 Chemprop 模型集成识别出一类对耐甲氧西林金黄色葡萄球菌和耐万古霉素肠球菌具有选择性的抗生素结构类别，并用 Chemprop 的可解释方法解释了结果。<sup>[7](https://pypi.org/project/chemprop/)</sup> 在 ADMET-AI 平台中，Chemprop 模型在治疗数据共享平台的 41 个吸收、分布、代谢、排泄和毒性（ADMET）数据集上进行了训练。<sup>[7](https://pypi.org/project/chemprop/)</sup> 独立研究还将该包应用于工业药物发现中的[保留时间预测](https://www.edgepedia.org/zh/retention-time-prediction)——Chemprop 表现优于 XGBoost 和常规神经网络——以及使用反应凝聚图预测反应活化能垒。<sup>[14](https://pmc.ncbi.nlm.nih.gov/articles/PMC11021461/)</sup><sup> • </sup><sup>[15](https://pubs.rsc.org/en/content/articlepdf/2024/dd/d3dd00175j)</sup>

## References

1. [Welcome to Chemprop's documentation, Chemprop 2.3.1 documentation](https://chemprop.readthedocs.io/en/main/)
2. [Esther Heid et al. (2024). Chemprop: A Machine Learning Package for Chemical Property Prediction. Journal of Chemical Information and Modeling 64(1):9–17.](https://pubs.acs.org/doi/10.1021/acs.jcim.3c01250)
3. [David E. Graff et al. (2025). Chemprop v2: An Efficient, Modular Machine Learning Package for Chemical Property Prediction. Journal of Chemical Information and Modeling 66(1):28–33.](https://pubs.acs.org/doi/10.1021/acs.jcim.5c02332)
4. [Message passing, Chemprop 2.3.1 documentation](https://chemprop.readthedocs.io/en/latest/tutorial/python/models/message_passing.html)
5. [Chemprop: Deep Learning for Molecular Property Prediction, chemprop.com](https://chemprop.com/)
6. [Exploring data augmentation: Multi-task methods for molecular property prediction, Computers & Chemical Engineering (2025)](https://doi.org/10.1016/j.compchemeng.2025.109253)
7. [chemprop on PyPI](https://pypi.org/project/chemprop/)
8. [Releases, chemprop/chemprop on GitHub](https://github.com/chemprop/chemprop/releases)
9. [Heid et al. (2024) preprint PDF, Chemprop: A Machine Learning Package for Chemical Property Prediction](https://bioinformatica-iib.github.io/quimioinformatica/practicos/TP03/material/Heid%282024%29.pdf)
10. [chemprop.nn.message_passing, Chemprop 2.3.1 API documentation](https://chemprop.readthedocs.io/en/main/autoapi/chemprop/nn/message_passing/index.html)
11. [CLI Reference, Chemprop 2.3.1 documentation](https://chemprop.readthedocs.io/en/main/cmd.html)
12. [Installation, Chemprop 2.3.1 documentation](https://chemprop.readthedocs.io/en/main/installation.html)
13. [chemprop_benchmark README, GitHub](https://github.com/chemprop/chemprop_benchmark/blob/main/README.md)
14. [Vik et al. (2024). Performance and robustness of small molecule retention time prediction with molecular graph neural networks in industrial drug discovery campaigns. Scientific Reports 14:8733.](https://pmc.ncbi.nlm.nih.gov/articles/PMC11021461/)
15. [Benchmarking reaction representations for activation barrier prediction, Digital Discovery (2024)](https://pubs.rsc.org/en/content/articlepdf/2024/dd/d3dd00175j)

---
*Initially written Oct 22, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Deep learning software and hardware › Deep learning frameworks and libraries

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/chemprop

English original: https://www.edgepedia.org/chemprop
