Skip to content

Latest commit

 

History

History
102 lines (77 loc) · 7.14 KB

threedgraph.rst

File metadata and controls

102 lines (77 loc) · 7.14 KB

Tutorial for 3D Graphs

In this tutorial, we will show how to predict properties of 3D graphs using our DIG library1. Specifically, we show how to use SphereNet2 to do prediction on molecules.

Deep Learning on 3D Graphs

Molecular property prediction is of great importance in many applications, such as chemistry, drug discovery, and material science. Recently, graph deep learning methods have been developed for molecular property prediction345. However most of the methods only focus on 2D molecular graphs without explicitly consider 3D information, which is crucial for determining quantum chemical properties.

We consider representation learning of 3D molecular graphs in which each atom is associated with a spatial position in 3D. In order to yield predictions that are invariant to translation and rotation of input molecules, current methods use relative 3D information like distance6, angle7 and torsion8 as input features. Specifically, the SchNet9 incorporates the distance information during the information aggregation stage by using continuous-filter convolutional layers, the DimeNet10 explicitly considers distances between atoms and angles between edges, the SphereNet11 uses distance, angle, and torsion for completely determining structures of 3D molecular graphs. Generally, the use of 3D position information usually results in improved performance.

Code Example

We use QM912 dataset as an example to show how to use SphereNet method in our DIG library. QM9 consists of about 130,000 equilibrium molecules with 12 regression targets: mu, alpha, homo, lumo, gap, r2, zpve, U0, U, H, G, Cv.

Firstly, we load QM9 data. We train a separate model for each target except for gap, which was predicted by taking homo-lumo.

Next, we load SphereNet model and evaluation function.

Finally, we train the model and print test results.

Output:

=====Epoch 1 {'Train': 0.7765793317604924, 'Validation': 0.829788088798523, 'Test': 0.8256096243858337} =====Epoch 2 {'Train': 0.3513736664000606, 'Validation': 0.4852057099342346, 'Test': 0.4807925820350647} =====Epoch 3 {'Train': 0.2866970902528785, 'Validation': 0.3925183415412903, 'Test': 0.3926387131214142} =====Epoch 4 {'Train': 0.22851779905254582, 'Validation': 0.24750158190727234, 'Test': 0.24735336005687714} =====Epoch 5 {'Train': 0.1882370650733606, 'Validation': 0.24951410293579102, 'Test': 0.2485261708498001} =====Epoch 6 {'Train': 0.1729215220388387, 'Validation': 0.25098657608032227, 'Test': 0.2510414719581604} =====Epoch 7 {'Train': 0.16714775081184313, 'Validation': 0.08707749098539352, 'Test': 0.08680126070976257} =====Epoch 8 {'Train': 0.14790155550919, 'Validation': 0.22142618894577026, 'Test': 0.2184610813856125} =====Epoch 9 {'Train': 0.14341841166521518, 'Validation': 0.08781412988901138, 'Test': 0.08708161860704422} =====Epoch 10 {'Train': 0.13320978917723272, 'Validation': 0.09562557935714722, 'Test': 0.09474394470453262} =====Epoch 11 {'Train': 0.12690318433471445, 'Validation': 0.10588052868843079, 'Test': 0.10465845465660095} =====Epoch 12 {'Train': 0.11995585791554265, 'Validation': 0.1758851855993271, 'Test': 0.17593063414096832} =====Epoch 13 {'Train': 0.11456177215925686, 'Validation': 0.0706050917506218, 'Test': 0.06988751143217087} =====Epoch 14 {'Train': 0.10681104086179107, 'Validation': 0.057960350066423416, 'Test': 0.05731089040637016} =====Epoch 15 {'Train': 0.11122639218064642, 'Validation': 0.12124070525169373, 'Test': 0.11959604173898697} =====Epoch 16 {'Train': 0.05462940768005544, 'Validation': 0.04387890547513962, 'Test': 0.04229748249053955} =====Epoch 17 {'Train': 0.057066445401964525, 'Validation': 0.07098211348056793, 'Test': 0.07055927067995071} =====Epoch 18 {'Train': 0.05782321078129603, 'Validation': 0.04337486997246742, 'Test': 0.041813842952251434} =====Epoch 19 {'Train': 0.05424516140513118, 'Validation': 0.040363702923059464, 'Test': 0.03920820727944374} =====Epoch 20 {'Train': 0.0552880891001176, 'Validation': 0.040168143808841705, 'Test': 0.039053723216056824}

Best validation MAE so far: 0.040168143808841705 Test MAE when got best validation result: 0.039053723216056824


  1. Liu, M., Luo, Y., Wang, L., Xie, Y., Yuan, H., Gui, S., Yu, H., Xu, Z., Zhang, J., Liu, Y. and Yan, K., 2021. DIG: A Turnkey Library for Diving into Graph Deep Learning Research. arXiv preprint arXiv:2103.12608.

  2. Liu, Y., Wang, L., Liu, M., Zhang, X., Oztekin, B. and Ji, S., 2021. Spherical message passing for 3D graph networks. arXiv preprint arXiv:2102.05013.

  3. Gilmer, J., Schoenholz, S.S., Riley, P.F., Vinyals, O. and Dahl, G.E., 2017, July. Neural message passing for quantum chemistry. In International conference on machine learning (pp. 1263-1272). PMLR.

  4. Wu, Z., Ramsundar, B., Feinberg, E.N., Gomes, J., Geniesse, C., Pappu, A.S., Leswing, K. and Pande, V., 2018. MoleculeNet: a benchmark for molecular machine learning. Chemical science, 9(2), pp.513-530.

  5. Wang, Z., Liu, M., Luo, Y., Xu, Z., Xie, Y., Wang, L., Cai, L. and Ji, S., 2020. Advanced graph and sequence neural networks for molecular property prediction and drug discovery. arXiv preprint arXiv:2012.01981.

  6. Schütt, K.T., Sauceda, H.E., Kindermans, P.J., Tkatchenko, A. and Müller, K.R., 2018. Schnet–a deep learning architecture for molecules and materials. The Journal of Chemical Physics, 148(24), p.241722.

  7. Klicpera, J., Groß, J. and Günnemann, S., 2020. Directional message passing for molecular graphs. In International Conference on Learning Representations (ICLR), 2020.

  8. Liu, Y., Wang, L., Liu, M., Zhang, X., Oztekin, B. and Ji, S., 2021. Spherical message passing for 3D graph networks. arXiv preprint arXiv:2102.05013.

  9. Schütt, K.T., Sauceda, H.E., Kindermans, P.J., Tkatchenko, A. and Müller, K.R., 2018. Schnet–a deep learning architecture for molecules and materials. The Journal of Chemical Physics, 148(24), p.241722.

  10. Klicpera, J., Groß, J. and Günnemann, S., 2020. Directional message passing for molecular graphs. In International Conference on Learning Representations (ICLR), 2020.

  11. Liu, Y., Wang, L., Liu, M., Zhang, X., Oztekin, B. and Ji, S., 2021. Spherical message passing for 3D graph networks. arXiv preprint arXiv:2102.05013.

  12. Ramakrishnan, R., Dral, P.O., Rupp, M. and Von Lilienfeld, O.A., 2014. Quantum chemistry structures and properties of 134 kilo molecules. Scientific data, 1(1), pp.1-7.