microsoft / gated-graph-neural-network-samples

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

Can I use float rather than int in the graph? #15

Open B-C-WANG opened 6 years ago

B-C-WANG commented 6 years ago

Hello: I want to use this awesome tool on my chemical reaction path search, but I want to make graphs from molecule coordinates, so the graph in .json file should be [, distance of atom1,2 , ], rather than single_bond = 1, double_bond = 2, trans_bond = 3, the targets is molecule energy, it changes with atom distance.

I don't know much about your algorithm, so I tried to change these int into different float, only chem_tensorflow_async.py works(chem_tensorflow_gcn.py works but results keep same), but I don't know if it really did what I want. So I want to know can I use float in the graph, is algorithm supported for this function? qq 20180803104453

mmjb commented 6 years ago

Heya,

Thanks for the interest. At the moment, the adjacency information is only used in binary form (i.e., edge present/not present). In principle, the dense implementation can take float values (not sure why this didn't work for you), but they would be treated as a "weight" on the edge; i.e., small values would reduce the influence of that edge, and large values would increase it.

However, it sounds as if you would want to use the edge information more as a feature associated with the edge than just a linear weight on the edge. We do have code to handle this fairly well, but did not release it here for lack of an appropriate public dataset to test this on. If you could share the data, I would be happy to release this extension as well.

Marc

B-C-WANG commented 6 years ago

@mmjb Thanks for your reply, now I'm encoding my molecule coordinates data to graphs, and the weight on the edges is the distance of molecules. My dataset is ~30 molecules on metal surface, each molecule contains about ~100 different coordinates and the energy on that condition. I will share the data and the scripts once I finished it, but I'm not sure these samples are enough for you. B.C.Wang

B-C-WANG commented 6 years ago

@mmjb I've uploaded a dataset with 26355 samples, using a float weight on edge, hope it helps to improve your algorithm. #16