microsoft / gated-graph-neural-network-samples

Sample Code for Gated Graph Neural Networks
MIT License
1.03k stars 264 forks source link

How to use the trained models? #14

Closed xuzhang5788 closed 6 years ago

xuzhang5788 commented 6 years ago

After training, how to use those trained models? How to predict the properties of chemicals? Any examples? Thanks a lot.

mmjb commented 6 years ago

We don't have an explicit test mode at the moment in this example code release. You could one by using the existing code to load stored models (from the --restore option) and by modifying make_model in chem_tensorflow.py to expose the computed values as a graph op accessible from the outside (i.e., by writing it to self.ops).

51alg commented 6 years ago

For chem_tensorflow_dense.py we have a short example of what code for a test mode would look like after loading a stored model with --restore.

xuzhang5788 commented 6 years ago

@51alg Thank you for your response. However, it is not very clear for me. Using --restore is for continuing training. Did you modify your "short example" which has a link in your reply? Is it the same file as chem_tensorflow_dense.py ? Thanks a lot

51alg commented 6 years ago

I've added a command line argument --evaluate to chem_tensorflow_dense.py to make this easier.

Example usage:

$ python chem_tensorflow_dense.py (produces ./[hash]_model_best.pickle) $ python chem_tensorflow_dense.py --restore ./[hash]_model_best.pickle --evaluate

xuzhang5788 commented 6 years ago

Thank you @51alg